document.write("<script src='static/lib/spin/spin.min.js'></script>");

/**
 * 获取链接参数
 * 
 * @param key
 *            参数的键
 * @returns 参数的值
 */
function getParameter(key) {
	var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null)
		return decodeURI(r[2]);
	return null;
};

/**
 * 显示正在载入的动画
 * 
 * @param spinner
 *            载入的动画
 * @param container
 *            动画所在的容器
 * @returns 动画
 */
function showLoading(spinner, container) {
	if (spinner) {
		return spinner;
	}
	var opts = {
		lines : 9 // The number of lines to draw
		,
		length : 17 // The length of each line
		,
		width : 10 // The line thickness
		,
		radius : 26 // The radius of the inner circle
		,
		scale : 1 // Scales overall size of the spinner
		,
		corners : 1 // Corner roundness (0..1)
		,
		color : '#000' // #rgb or #rrggbb or array of colors
		,
		opacity : 0.5 // Opacity of the lines
		,
		rotate : 0 // The rotation offset
		,
		direction : 1 // 1: clockwise, -1: counterclockwise
		,
		speed : 1 // Rounds per second
		,
		trail : 60 // Afterglow percentage
		,
		fps : 20 // Frames per second when using setTimeout() as a fallback
		// for CSS
		,
		zIndex : 2e9 // The z-index (defaults to 2000000000)
		,
		className : 'spinner' // The CSS class to assign to the spinner
		,
		top : '50%' // Top position relative to parent
		,
		left : '50%' // Left position relative to parent
		,
		shadow : false // Whether to render a shadow
		,
		hwaccel : false // Whether to use hardware acceleration
		,
		position : 'absolute' // Element positioning
	}
	return new Spinner(opts).spin(container);
}

/**
 * 关闭正在载入的动画
 * 
 * @param spinner
 *            载入的动画
 * @returns 动画
 */
function hideLoading(spinner) {
	if (spinner) {
		spinner.stop();
	}
	return null;
}