jQuery.extend({
	loading:function(){
		return "<img src='/admin/images/loading.gif' align='absmiddle'> Loading, please wait a moment ...";
	},
	random: function(X) {
		return Math.floor(X * (Math.random() % 1));
	},
	randomBetween:function(MinV, MaxV) {
		return MinV + jQuery.random(MaxV - MinV + 1);
	},
	add_swf:function(swf,width,height,toumingdu){
		//$jq("id").html($jq.add_swf("**.swf",73,55,"Transparent"));
		var swfstr="";
		swfstr=	'\
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'">\
					<param name="movie" value="'+swf+'" />\
					<param name="quality" value="best" />\
					<param name="menu" value="false" />\
					<param name="wmode" value="'+toumingdu+'" />\
					<embed src="images/index.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>\
				</object>\
				';
		return swfstr;
	},
	select_who:function(id){
		var str="";
		for(var i=0;i<document.getElementsByName(id).length;i++){
			if(document.getElementsByName(id)[i].checked==true){
				str+=document.getElementsByName(id)[i].value+",";
			}
		}
		return str;
	},
	set_nocheck:function(id){
		for(var i=0;i<document.getElementsByName(id).length;i++){
			if(document.getElementsByName(id)[i].checked==true){
				document.getElementsByName(id)[i].checked=false;
			}
		}
	},
	_ok:function(){
		return "<div class='itsok'></div>";	
	},
	copytonote:function(text){
		if (document.all){
			window.clipboardData.setData('text',text);
			alert("Copy success !");
		}else{
			alert("Your browser does not support the clipboard operation, please make copies of themselves. "); 
		}
	},
	doZoom:function(id,num){
		jQuery(id).css({
			"font-size":num+"px"
		});
	},
	add_class:function(id,sclass){
		jQuery(id).removeClass();
		jQuery(id).addClass(sclass);
	},
	add_html:function(id,html){
		jQuery(id).html(html);
	},
	cookie:function(name, value, options) {
		if (typeof value != 'undefined') {
			options = options || {};
			if (value === null) {
				value = '';
				options = $.extend({}, options);
				options.expires = -1;
			}
			var expires = '';
			if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
				var date;
				if (typeof options.expires == 'number') {
					date = new Date();
					date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
				} else {
					date = options.expires;
				}
				expires = '; expires=' + date.toUTCString();
			}
			var path = options.path ? '; path=' + (options.path) : '';
			var domain = options.domain ? '; domain=' + (options.domain) : '';
			var secure = options.secure ? '; secure' : '';
			document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
		} else {
			var cookieValue = null;
			if (document.cookie && document.cookie != '') {
				var cookies = document.cookie.split(';');
				for (var i = 0; i < cookies.length; i++) {
					var cookie = jQuery.trim(cookies[i]);
					if (cookie.substring(0, name.length + 1) == (name + '=')) {
						cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
						break;
					}
				}
			}
			return cookieValue;
		}
	}
});
