var js9787 = {
	global:function() {
		jQuery("#act_gdgn_html,.moregn").NavPop({
			popPanel:"#act_gdgn_html"
		});
		jQuery(".icon_dlbg,.dla_name").bind("click",function(){
			return false;
		});
		jQuery("#toploginlink").attr("href","https://passport.9787.com/login.php?rurl="+window.location);
		jQuery("#topregisterlink,#topregisterlink1").attr("href","https://passport.9787.com/member/register.php?rurl="+window.location);
		jQuery(".WeatherPost").weather();
		
		jQuery(".Moredluqu").login({
	    	url:"/src/ajax.php",
	    	username:"#username2",
			password:"#password2",
			logintype:0
	    });
		
		jQuery("#toploginlink,.Moredluqu").NavPop({
			popPanel:".Moredluqu"
		});
		jQuery(".icon_gubi").bind("click",function(){
			jQuery("#Msg").hide();
			return false;
		});
		jQuery(".Moredluqu").hover(function(){},function(){
			jQuery(".dsishizu").hide();
		});
		
		jQuery(".act_lt,#bbslist").NavPop({
			popPanel:"#bbslist"
		});
		jQuery("#homepage").click(function(){
			homePage(this,"http://www.9787.com");
		});
		jQuery("#favorite").click(function(){
			jQuery.Favorite();return false;
		});
		jQuery(".moregn,.icon_dlbg,.dla_name").bind("click",function(){
			return false;
		});
		jQuery("#LeftLoginForm").login({
			username:"#username",
			password:"#password",
	    	url:"/src/ajax.php"
	    });
		
		jQuery.initPage();
		jQuery("#logout,#logout1").logout({
			url:"/src/ajax.php"
		});
	   	jQuery(".moregn").bind("click",function(){
			if(jQuery(".MapPostBar").css("display")!="block"){
				jQuery(".MapPostBar").show();
			}else{
				jQuery(".MapPostBar").hide();
			}
			return false;
		});
		jQuery(".moregn").hover(function(){
			
		},function(){
			jQuery(".MapPostBar").hide();
		});
		jQuery(".MapPostBar").NavPop({
			popPanel:".MapPostBar"
		});
		var date = new Date();
		//'今天是：' + date.getFullYear() + '年' + date.getMonth() + '月' + date.getDate() + '日 '; 
		jQuery("#MapTops").html("今天是" + date.getFullYear() + "年" + (date.getMonth()+1) + "月" + date.getDate() + "日 ，欢迎来到9787！");
		
	},
	index:function() {
		jQuery(act_gdgn_html_inner).append(act_gdgn_html);
		jQuery("#act_gdgn_html").css('top', act_gdgn_html_top);
		jQuery("#act_gdgn_html").css('right', act_gdgn_html_right);
		js9787.global();
	},
	gallery:function() {
		js9787.global();
		$("#galleryshow").GalleryImageShow({
			speed : 500,
			timer : 4000
		});
		
	},
	gallerylist:function() {
		js9787.global();
		$("#cat_type,#web_type").bind("change",function(){
			window.location.href= "?cat_type="+$("#cat_type").val()+"&web_type="+$("#web_type").val();
		});
	},
	galleryshow:function() {
		js9787.global();
		$(".bagsshowZu").ImageList({
			next: ".rightPost",
	        prev: ".leftPost",
	        frame: ".mmshowzu",
	        child: "li",
	        auto: true,
	        width : 150
		});
		
		$(".TKshowBar").galleryshow();
	}
	
};
(function(jQuery){
	jQuery.extend({
		Favorite:function(o) {
			o = jQuery.extend({
				webUrl : "http://www.9787.com",
				webName : "9787网"
	    	}, o);
			if(jQuery.browser.msie) {
				window.external.AddFavorite(o.webUrl,o.webName);
			}else if(jQuery.browser.safari){
				 window.sidebar.addPanel(o.webName, o.webUrl, "");
			}else if(jQuery.browser.mozilla){
			}else if(jQuery.browser.opera) {
			}else {
			}
			return false;
		}
	});
	jQuery.fn.extend({
		share:function(o) {
			o = jQuery.extend({
				url:window.location,
				title:encodeURIComponent(document.title),
				height:200,
				width:200,
				toolbar:"no",
				menubar:"no",
				scrollbars:"no",
				resizable:"no",
				location:"no",
				status:"no"
			}, o);
			jQuery("a",jQuery(this)).each(function(){
				jQuery(this).bind("click",function(){
					var url="";
					switch(jQuery(this).attr("rel")) {
					case "sl":
						url="http://service.weibo.com/share/share.php?url="+o.url+"&appkey=&title=&pic=&ralateUid=2150092351";
						break;
					case "rr":
						url="http://share.renren.com/share/buttonshare.do?link="+o.url+"&title="+o.title;
						break;
					case "kx":
						url="http://www.kaixin001.com/repaste/share.php?rtitle="+o.title+"&rurl="+o.url+"&rcontent="+o.title;
						break;
					case "qb":
						url="http://v.t.qq.com/share/share.php?title="+o.title+"&url="+o.url+"&appkey=&site=&pic=";
						break;
					case "db":
						url="http://www.douban.com/recommend/?url="+o.url+"&title="+o.title;
						break;
					case "qz":
						url="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+o.url;
						break;
					default:
							break;
					}
					window.open(url,"9787网", "height=500, width=600");
					return false;
				});
			});
		},
		//天气获取
		weather : function(o) {
			o = jQuery.extend({
				cityid : "101020100"
			}, o);
			var showDiv=jQuery(this);
			var html=jQuery.Cookie("uuzu_WEATHER");
			if(html!=null) {
				showDiv.html(html);
				return;
			}
			var url="http://61.4.185.48:81/g/";
			jQuery.ajax({
				url:url,
				type:"get",
				dataType:"Script",
				error:function() {
					
				},
				success:function(data) {
					o.cityid=id;
					var url="/src/weather.php?cityid="+o.cityid;
					jQuery.ajax({
						url:url,
						type:"get",
						dataType:"JSON",
						error:function(data) {
							showDiv.html("ERROR");
						},
						success:function(data) {
							
							var html='<span class="w_city">'+data.weatherinfo["city"]+'</span>\
								<span class="w_tubiao"><img src="http://pic.9787.com/www/images/icon/weather/s_a'+data.weatherinfo["img1"]+'.jpg" alt="'+data.weatherinfo["weather1"]+'" /></span>\
								<span class="w_wendu">'+data.weatherinfo["temp1"]+'</span>\
								<span class="w_tianq">'+data.weatherinfo["weather1"]+'</span>';
							jQuery.Cookie("uuzu_WEATHER", html,{ path: '/', expires: 0,domain:'9787.com' });
							showDiv.html(html);
						}
					});
				}
			});
		},
		NavPop:function(o) {
			o=jQuery.extend({
				popPanel:null
			},o||{});
			return this.each(function(){
				var pop = jQuery(o.popPanel);
				jQuery(this).hover(function(){
					pop.show();
				},function(){
					pop.hide();
				});
			});
		},
		Tabs: function(o) {
			o=jQuery.extend({
				firstOn:0,
				className:"selected",
				eventName:"all",
				loadName:"加载中...",
				fadeIn:"normal",
				autoFade:false,
				autoFadeTime:3,
				pdiv:null
			},o||{});
			return this.each(function(){
				var target=jQuery(this),tabs=target.find("ul:eq(0) li");
				if(o.pdiv) {
					var div=jQuery(o.pdiv);
				} else {
					var div = target.children().not("ul,span");
				}
				
				function Tabs() {
					if(jQuery(this).hasClass(o.className)) {
						return false;
					}
					tabsShow(div,jQuery(this));
					return false;
				}
				
				function tabsShow(div,li,index) {
					div.stop(true,true).hide();
					if(typeof(index)=="number") {
						if (li.find("a").attr("rel")) 
							ajax(div, li);
	                    jQuery(div[index]).stop(true,true).fadeIn(o.fadeIn);
	                    tabs.stop(true, true).removeClass(o.className);
	                    jQuery(tabs[index]).stop(true, true).addClass(o.className);
					} else {
						var tabBody = div.filter(li.find("a").attr("href"));
	                    if (li.find("a").attr("rel")) ajax(div, li);
	                    tabBody.stop(true,true).fadeIn(o.fadeIn);
	                    tabs.stop(true, true).removeClass(o.className);
	                    li.stop(true, true).addClass(o.className);
					}
				}
				
				function ajax(div, li) {
	                var href = li.find("a").attr("href");
	                var rel = li.find("a").attr("rel");     // ajax请求url
	                var i = div.filter(href);                 // 当前div
	                if (rel) {                                      // 如果ajax请求url不为空，只ajax一次
	                    i.html(o.loadName);
	                    jQuery.ajax({
	                        url: rel,
	                        cache: false,
	                        success: function (html) {
	                            i.html(html);
	                        },
	                        error: function () {
	                            i.html('加载错误，请重试！');
	                        }
	                    });
	                    li.find("a").removeAttr("rel");  // 只ajax一次
	                }
	            }
				if (o.autoFade) {
	                var index = o.firstOn + 1;
	                setInterval(function () {
	                    if (index >= div.length) {
	                        index = 0;
	                    }
	                    tabsShow(div, jQuery(this), index++);
	                }, o.autoFadeTime * 1000);
	            }
				tabs.bind(o.eventName == 'all' ? 'click mouseover' : o.eventName, Tabs).filter(':first').trigger(o.eventName == 'all' ? 'click' : o.eventName);
			});
		},
		ImageList:function(o) {
			o=$.extend({
				next : "buttonNext",
				prev : "buttonPrev",
				frame : "viewerFrame",
				width : 120,
				child : "li",
				auto : true
			},o||{});
			var _btnNext = $(o.next);
			var _btnPrev = $(o.prev);
			var _imgFrame = $(o.frame);
			var _width = o.width;
			var _child = o.child;
			var _auto = o.auto;
			var _itv;
			var turnLeft = function() {
				_btnPrev.unbind("click", turnLeft);
				if (_auto)
					autoStop();
				_imgFrame.animate({
					marginLeft : -_width
				}, 'fast', '', function() {
					_imgFrame.find(_child + ":first").appendTo(_imgFrame);
					_imgFrame.css("marginLeft", 0);
					_btnPrev.bind("click", turnLeft);
					if (_auto)
						autoPlay();
				});
			};

			var turnRight = function() {
				_btnNext.unbind("click", turnRight);
				if (_auto)
					autoStop();
				_imgFrame.find(_child + ":last").clone().show().prependTo(_imgFrame);
				_imgFrame.css("marginLeft", -_width);
				_imgFrame.animate({
					marginLeft : 0
				}, 'fast', '', function() {
					_imgFrame.find(_child + ":last").remove();
					_btnNext.bind("click", turnRight);
					if (_auto)
						autoPlay();
				});
			};

			_btnNext.css("cursor", "hand").click(turnRight);
			_btnPrev.css("cursor", "hand").click(turnLeft);

			var autoPlay = function() {
				_itv = window.setInterval(turnLeft, 3000);
			};
			var autoStop = function() {
				window.clearInterval(_itv);
			};
			if (_auto)
				autoPlay();
		},
		InfoImageShow:function(o) {
			o=$.extend({
				speed : "normal",
				timer : 1000
			},o||{});
			return this.each(function(){
				var currentImage;
				var currentIndex = -1;
				var interval;
				var timerID;
				var currDiv=$(this);
				function showImage(index) {
					$('.sylhBigtuzu li:eq('+currentIndex+')',currDiv).hide(); 
				    $('.sylhBigtuzu li:eq('+index+')',currDiv).fadeTo(o.speed,1); 
				    $('.Xiaotushowzu li',currDiv).removeClass('current');
				    $('.Xiaotushowzu li:eq('+index+')',currDiv).addClass('current');
				    currentIndex=index;
				}
				function showNext(){
				    var len = $(".Xiaotushowzu li",currDiv).length;
				    var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
				    showImage(next);
				}
				function showPriv(){
				    var len = $(".Xiaotushowzu li",currDiv).length;
				    var priv = currentIndex > 0 ? currentIndex - 1 : len-1;
				    showImage(priv);
				}
				showNext();
				timerID = setInterval(showNext, o.timer);
				$('.Xiaotushowzu li',$(this)).click(function(){
			    	var count = $(this).attr('rel');
			    	showImage(parseInt(count)-1);
			    	return false;
			    });
				$('.leftPost',$(this)).click(function(){
					showPriv();
					return false;
			    });
				$('.rightPost',$(this)).click(function(){
					showNext();
					return false;
			    });
				$('.sylhBigtuzu li,.Xiaotushowzu li,.rightPost,.leftPost',$(this)).hover(function(){
					clearInterval(timerID);
			    },function(){
			    	timerID = setInterval(showNext, o.timer);
			    });
			});
		},
		GalleryImageShow:function(o) {
			o=$.extend({
				speed : "normal",
				timer : 1000
			},o||{});
			return this.each(function(){
				var currentImage;
				var currentIndex = -1;
				var interval;
				var timerID;
				var currDiv=$(this);
				function showImage(index) {
					$('.sylhBigtuzu li:eq('+currentIndex+')',currDiv).hide(); 
				    $('.sylhBigtuzu li:eq('+index+')',currDiv).fadeTo(o.speed,1); 
				    $('.Xiaotushowzu li',currDiv).removeClass('stu_1cur');
				    $('.Xiaotushowzu li:eq('+index+')',currDiv).addClass('stu_1cur');
				    currentIndex=index;
				}
				function showNext(){
				    var len = $(".Xiaotushowzu li",currDiv).length;
				    var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
				    showImage(next);
				}
				function showPriv(){
				    var len = $(".Xiaotushowzu li",currDiv).length;
				    var priv = currentIndex > 0 ? currentIndex - 1 : len-1;
				    showImage(priv);
				}
				showNext();
				timerID = setInterval(showNext, o.timer);
				$('.Xiaotushowzu li',$(this)).click(function(){
			    	var count = $(this).attr('rel');
			    	showImage(parseInt(count)-1);
			    	return false;
			    });
				$('.leftPost',$(this)).click(function(){
					showPriv();
					return false;
			    });
				$('.rightPost',$(this)).click(function(){
					showNext();
					return false;
			    });
				$('.sylhBigtuzu li,.Xiaotushowzu li',$(this)).hover(function(){
					clearInterval(timerID);
			    },function(){
			    	timerID = setInterval(showNext, o.timer);
			    });
			});
		},
		galleryshow:function(o) {
			o=$.extend({
				speed : "normal",
				timer : 1000,
				purl:$(".tkSide_01 a").attr("href"),
				nurl:$(".tkSide_02 a").attr("href")
			},o||{});
			return this.each(function(){
				var currentImage;
				var currentIndex = -1;
				var interval;
				var timerID;
				var currDiv=$(this);
				function showImage(index) {
					var len = $(".tkSidelhn li",currDiv).length;
					$('.tkpic_tu li:eq('+currentIndex+')',currDiv).hide(); 
				    $('.tkpic_tu li:eq('+index+')',currDiv).fadeTo(o.speed,1); 
				    $('.tkSidelhn li',currDiv).removeClass('current');
				    if(index>0){
				    	if(index>currentIndex){
					    	$(".tkSidelhn").animate({marginTop:-105*(index-1)},o.speed,function(){
					    		$(".tkSidelhn").css("marginTop", -105*(index-1));
					    		$('.tkSidelhn li:eq('+index+')',currDiv).addClass('current');
							});
					    	
					    } else {
					    	$(".tkSidelhn").animate({marginTop:-105*(index-1)},o.speed,function(){
					    		$('.tkSidelhn li:eq('+index+')',currDiv).addClass('current');
					    		$(".tkSidelhn").css("marginTop", -105*(index-1));
							});
					    }
				    } else {
				    	$('.tkSidelhn li:eq('+index+')',currDiv).addClass('current');
				    }
				    //$(".tkpic_jsbt",currDiv).html($('.tkSidelhn li:eq('+index+') a',currDiv).attr("title"));
				    currentIndex=index;
				}
				function showNext(){
				    var len = $(".tkSidelhn li",currDiv).length;
				    if(currentIndex<len-1) {
				    	showImage(currentIndex+1);
				    } else {
				    	this.disabled=true;
				    	window.location.href=o.nurl;
				    }
				}
				function showPriv(){
				    var len = $(".tkSidelhn li",currDiv).length;
				    //var priv = currentIndex > 0 ? currentIndex - 1 : len-1;
				    if(currentIndex>0) {
				    	showImage(currentIndex-1);
				    } else {
				    	this.disabled=true;
				    	window.location.href=o.purl;
				    }
				    
				}
				showNext();
				//timerID = setInterval(showNext, o.timer);
				$('.tkSidelhn li',$(this)).click(function(){
			    	var count = $(this).attr('rel');
			    	showImage(parseInt(count)-1);
			    	return false;
			    });
				$('.tubiaoqu_left,.picIcon_up,.tu_up',$(this)).click(function(){
					showPriv();
					return false;
			    });
				$('.tubiaoqu_right,.picIcon_next,.tu_next',$(this)).click(function(){
					showNext();
					return false;
			    });
				$(".tubiaoqu_left,.tubiaoqu_right",$(this)).hover(function(){
					$(".tubiaoqu_left").show();
			    	$(".tubiaoqu_right").show();
			    },function(){
			    	
			    });
				$('.tkpic_tu li',$(this)).hover(function(){
					$(".tubiaoqu_left").fadeTo(1000,0.8);
					$(".tubiaoqu_right").fadeTo(1000,0.8);
			    },function(){
			    	$(".tubiaoqu_left").hide();
			    	$(".tubiaoqu_right").hide();
			    });
				
				$(".picIcon_yuantu").click(function(){
					//url=$('.tkSidelhn li:eq('+currentIndex+') img',currDiv).attr("src");
					//var img=$('.tkpic_tu li:eq('+currentIndex+') img',currDiv).attr("src");
					var img = $('.tkpic_tu li:eq('+currentIndex+') img',currDiv);
					var theimage = new Image();
					theimage.src = img.attr("src");
					window.open (img.attr("src"), "newwindow", "height="+(theimage.height+20)+", width="+(theimage.width+20)+", scrollbars=no, resizable=no");
					return false;
				});
			});
		}
	});
})(jQuery);

(function(jQuery){
	jQuery.extend({
		//Cookie扩展
		Cookie:function(name,value,options){
			if (typeof value != 'undefined') {
		        options = options || {};
		        if (value === null) {
		            value = '';
		            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;
		    }
		},
		//代码安全扩展
		urlencode:function(str) {
			str = encodeURIComponent(str);
			str = str.replace(/\~/g, "%7E");
			str = str.replace(/\!/g, "%21");
			str = str.replace(/\*/g, "%2A");
			str = str.replace(/\(/g, "%28");
			str = str.replace(/\)/g, "%29");
			str = str.replace(/\'/g, "%27");
			return str;
		}
	});
})(jQuery);

(function(jQuery){
	jQuery.extend({
		initPage:function(){
			if(typeof(js9787.onInitPage)=='function') js9787.onInitPage();
			if(jQuery.Cookie("uuzu_UNICKNAME")) {
				jQuery(".Dlupostqu,#LeftLoginForm").hide();
				jQuery("#toploginForm").hide()
		    	jQuery("#TopLogoutForm,#LeftLogoutForm").show();
		    	jQuery("#toplogoutForm").show();
		    	jQuery.initUser();
		    	
			}else {
				jQuery(".Dlupostqu,#LeftLoginForm,#toploginForm").show();
		    	jQuery("#TopLogoutForm,#LeftLogoutForm,#toplogoutForm").hide();
		    	jQuery("#topnameid").hide();
		    	
		    	var url=window.location.href;
		    	var patt1=new RegExp("http://cs.9787.com/myservice/myservice.php");
		    	if(patt1.test(url)&&getQueryStringRegExp("action")!='')window.location.href=window.location.href; 
		    	if(patt1.test(url)&&getQueryStringRegExp("action")==''){
		    		jQuery.kfzx_login();
		    	}
			}
		},
		initUser:function(){
			if(typeof(js9787.onInitPage)=='function') js9787.onInitPage();
			//topusername,leftUsername,leftLevel,leftScore			
			if(jQuery.Cookie("uuzu_UNICKNAME")) {
				jQuery("#topusername,#leftUsername,#topnameid,#tun").html(jQuery.Cookie("uuzu_UNICKNAME"));
				var url=window.location.href;
		    	var patt1=new RegExp("http://cs.9787.com/myservice/myservice.php");
		    	if(patt1.test(url)&&getQueryStringRegExp("action")==''){
		    		jQuery.kfzx_login();
		    	}
			}
			if(jQuery.Cookie("uuzu_LEVEL")) {
				jQuery.uuzuLevel(jQuery.Cookie("uuzu_LEVEL"),jQuery.Cookie("uuzu_TIMER"));
			} else {
				jQuery.changeTimer("/src/timer.php");
				jQuery.getLevelInfo("/src/timer.php");
			}
			setInterval(function(){
				jQuery.changeTimer("/src/timer.php");
			},1000*60*5);
		},
		changeTimer:function(url) {
			if(jQuery.Cookie("uuzu_UNICKNAME")==null){
				jQuery.Cookie("uuzu_TIMER",null,{ path: '/', expires: -1,domain:'9787.com' });
				return null;
			} else {
				var date=new Date();
				jQuery.ajax({
					url:url+"?action=changetimer&v="+date.getTime(),
					type:"get",
					error:function() {},
					success:function(data) {
						jQuery.Cookie("uuzu_TIMER",data.time_temp,{ path: '/', expires: 0,domain:'9787.com' });
						jQuery.Cookie("uuzu_USERPIC",data.user_pic,{ path: '/', expires: 0,domain:'9787.com' });
					}
				});
			}
		},
		getLevelInfo:function(url) {
			if(jQuery.Cookie("uuzu_UNICKNAME")==null){
				jQuery.Cookie("uuzu_LEVEL",null,{ path: '/', expires: -1,domain:'9787.com' });
				return null;
			} else {
				var date=new Date();
				jQuery.ajax({
					url:url+"?action=getLevelInfo&v="+date.getTime(),
					type:"get",
					dataType:"JSON",
					error:function() {
					},
					success:function(data) {
						jQuery.Cookie("uuzu_LEVEL",data.level,{ path: '/', expires: 0,domain:'9787.com' });
						jQuery.Cookie("uuzu_USERPIC",data.user_pic,{ path: '/', expires: 0,domain:'9787.com' });
//						jQuery.Cookie("uuzu_TIMER",data.time_temp,{ path: '/', expires: 0,domain:'9787.com' });
//						jQuery.uuzuLevel(jQuery.Cookie("uuzu_LEVEL"));
						
						var url=window.location.href;
				    	var patt1=new RegExp("http://cs.9787.com/myservice/myservice.php");
				    	if(patt1.test(url)&&getQueryStringRegExp("action")==''){
				    		jQuery.kfzx_login();
				    	}
						jQuery.Cookie("uuzu_TIMER",data.time_temp,{ path: '/', expires: 0,domain:'9787.com' }); 
						jQuery.uuzuLevel(data.level,data.time_temp);
					}
				});
			}
		},
		uuzuLevel:function(level,time_temp) {
			var strHtml = "";
		    var step = level%10;
		    var grade = parseInt(level/10);
		    
		    for(var i=5;i>0;i--){
		        if(i == grade) {
		        	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/step'+step+'.gif"><img src="http://pic.9787.com/uuzu_new/images/icon/level/grade'+i+'.gif">';
		        } else if(i < grade){
		        	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/grade'+i+'.gif">';
		        } else{
		        	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/grade'+i+'uc.gif">';
		        }
		    }
		    if(grade == 0){
		     	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/step'+step+'.gif">';
		    }
		    var userPic = jQuery.Cookie("uuzu_USERPIC");
		    if(userPic==null||userPic=="") {
		    	userPic="http://pic.9787.com/uuzu_new/images/icon/head/default_small.gif";
		    } else {
		    	userPic=decodeURIComponent(userPic)
		    }
		    
		    jQuery("#level_icon_left").attr("title",level+'级');
		    jQuery("#level_icon_left").html(strHtml);
		    jQuery("#usrpic_left").attr("src",userPic);
		    
		    var html='';
			html= '<p class="user_name"><a href="#" target="_self">'+jQuery.Cookie("uuzu_UNICKNAME")+'</a></p>';
		    html+= '<div id="userCard0" style="display:none;position: absolute;z-index: 333;top:25px;padding-left:65px;"></div>';
		    html+= '<div class="user_level"><span  class="level_num">Lv'+level+'</span><span title="等级:'+level+'" class="level_icon">'+strHtml+'</span></div>'
		    html+= '<p class="user_photo"><a target="_self" title="'+jQuery.Cookie("uuzu_UNICKNAME")+'" href="#"><img src="'+userPic+'" alt="'+jQuery.Cookie("uuzu_UNICKNAME")+'" width="48" height="48" border="0" /></a></p>';
		    html+='<div id="userCard1" style="display:none;position: absolute;z-index: 333;top:60px; padding-left:5px;"></div>';
		    jQuery(".mild",jQuery("#logoutForm")).html(html);
		    jQuery("#tun").html(jQuery.Cookie("uuzu_UNICKNAME"));
		    if(time_temp == "-1"){
	            jQuery(".onlinetime").html("两小时+");
	            jQuery(".dlTime").html("在线:两小时+");
	            return;
	        }else {
	        	
	        	var tmpTime = time_temp.split(":");
	 	        h = tmpTime[0];
	 	        i = tmpTime[1];
	 	        s = tmpTime[2];
	 	       function inittime() {
	 	    	  if(s>=59){
		 	            s =0;
		 	            i++;
		 	        } else{
		 	            s++;
		 	        }
		 	        
		 	        if(i>=59){
		 	            i = 0;
		 	            h++;
		 	        }
	
		 	        if(h>=2){
		 	        	jQuery(".onlinetime").html("两小时+");
		 	        	jQuery(".dlTime").html("在线:两小时+");
		 	        } else{
		 	        	jQuery(".onlinetime").html(h+":"+(i<10?"0"+i:i)+":"+(s<10?"0"+s:s));
		 	        	jQuery(".dlTime").html("在线:"+h+":"+(i<10?"0"+i:i)+":"+(s<10?"0"+s:s));
		 	        }
	 	       }
	 	      inittime();
	 	      	setInterval(inittime,1000);
	        }
		    
		}
	});
	jQuery.fn.extend({
		login:function(o) {
			function error(data,type) {
				if(type==1) {
					jQuery("#Msgtext").html(data);
					jQuery("#Msg").show();
					setTimeout(function(){
						jQuery("#Msg").hide();
					},5000);
				} else {
					jQuery("#Msgtext2").html(data);
					jQuery(".dsishizu").show();
					setTimeout(function(){
						jQuery(".dsishizu").hide();
					},5000);
				}
			}
			function success(data) {
				if (objLogin.status == 1) {
					jQuery.Cookie("uuzu_UNICKNAME", objLogin.nickname,{ path: '/', expires: 0,domain:'9787.com' });
					jQuery.Cookie("uuzu_UAUTH", objLogin.uauth,{ path: '/', expires: 0,domain:'9787.com' });
					jQuery(".Dlupostqu,#LeftLoginForm").hide();
			    	jQuery("#TopLogoutForm,#LeftLogoutForm").show();
			    	jQuery("#toplogoutForm").show();
			    	jQuery("#toploginForm").hide();
			    	jQuery("#topnameid").show();
					jQuery(".Moredluqu").hide();//登录成功立即隐藏登录框
			    	jQuery.initUser();
					jQuery(o.password).val("");
				
				} else if (objLogin.status == 3) { // logout failed
					window.location.href = objLogin.url;
				} else if (objLogin.status == 0) {
					if (objLogin.message == '您输入的密码有误，请重试!') {
						jQuery(o.password).val("");
						jQuery(o.password).focus();
					} else if (objLogin.message == '无此通行证!') {
						jQuery(o.password).val("");
						jQuery(o.username).focus();		
					}
					if(jQuery("#nrwrap_index").length>0){
						jQuery("#Msg").css({"top":"-30px","left":"100px"});
					}else{
						jQuery("#Msg").css({"top":"145px"});
					}
					
					error("<p class=\"warnjshi\"><img src=\"http://pic.9787.com/www/images/layout/icon_warn.gif\" />登陆失败</p><p class=\"warntxt\">"+objLogin.message+"</p><p class=\"warntxt\">&nbsp;</p>",o.logintype);
					//error(objLogin.message);
				} else {
					
				}
			}
			o=jQuery.extend({
				username:"#username",
				usernameMsg:"<p class=\"warntxt\">请输入用户名！</p>",
				password:"#password",
				passwordMsg:"<p class=\"warntxt\">请输入密码！</p>",
				url:"#",
				type:"get",
				dataType:"script",
				timeout:10000,
				data:null,
				error:error,
				success:success,
				complete:null,
				logintype:0
			},o||{});
			
			jQuery(":submit",jQuery(this)).bind('click',function(e){
				o.logintype=jQuery(":submit").index(jQuery(this));
				var msg="<p class=\"warnjshi\"><img src=\"http://pic.9787.com/www/images/layout/icon_warn.gif\" />请输入完整信息</p>",flag=0;
				if(jQuery(o.username).val()=="") {
					msg+=o.usernameMsg;
					flag=1;
				}
				if(jQuery(o.password).val()=="") {
					msg+=o.passwordMsg;
					flag=flag==1?1:2;
				}
				if(msg!="<p class=\"warnjshi\"><img src=\"http://pic.9787.com/www/images/layout/icon_warn.gif\" />请输入完整信息</p>") {
					if(flag==1) {
						if(jQuery("#nrwrap_index").length>0){
							jQuery("#Msg").css({"top":"-30px","left":"100px"});
						}else{
							jQuery("#Msg").css({"top":"145px"});
						}
						
						jQuery(o.username).focus();	
					}else if(flag==2){
						if(jQuery("#nrwrap_index").length>0){
							jQuery("#Msg").css({"top":"20px","left":"100px"});
						}else{
							jQuery("#Msg").css({"top":"197px"})
						}
						
						jQuery(o.password).focus();	
					}
					o.error(msg,o.logintype);
					return false;
				}
				
				var date=new Date();
				var params = "act=login&username=" + jQuery.urlencode(jQuery(o.username).val()) + "&password=" + jQuery.urlencode(jQuery(o.password).val());
				o.url+="?type=login&params=" + jQuery.urlencode(params) + "&time=" + date.getTime();
				jQuery.ajax({
					url:o.url,
					type:o.type,
					dataType:o.dataType,
					timeout:o.timeout,
					data:o.data,
					error:function() {
						o.error("新的错误！");
					},
					success:function(data) {
						if(objLogin.status == 1) {
							
						}else if(objLogin.status == 2) {
							
						}
						if(o.success){
							o.success(data);
						}
					},
					complete:function(data) {
						if(o.complete) {
							o.complete(data);
						}
					}
				});
		    	return false;
		    });
		},
		logout:function(o) {
			function error(data) {
				alert(data);
			}
			function success(data) {
				if (objLogin.status == 2) {
					jQuery.Cookie("uuzu_UNICKNAME", null,{ path: '/', expires: -1,domain:'9787.com' });
					jQuery.Cookie("uuzu_UAUTH", null,{ path: '/', expires: -1,domain:'9787.com' });
					jQuery.Cookie("uuzu_LEVEL",null,{ path: '/', expires: -1,domain:'9787.com' });
					jQuery.Cookie("uuzu_USERPIC",null,{ path: '/', expires: -1,domain:'9787.com' });
					jQuery.Cookie("uuzu_USERINFO",null,{ path: '/', expires: -1,domain:'9787.com' });
					jQuery.Cookie("uuzu_WEATHER",null,{ path: '/', expires: -1,domain:'9787.com' });
					jQuery.initPage();
					
				}else if (objLogin.status == 3) { // logout failed
					window.location.href = objLogin.url;
				} else {
					
				}
			}
			o=jQuery.extend({
				url:"#",
				type:"get",
				dataType:"script",
				timeout:10000,
				data:null,
				error:error,
				success:success,
				complete:null
			},o||{});
			jQuery(this).bind("click",function(e){
				var msg="";
				if(jQuery(o.username).val()=="") {
					msg+=o.usernameMsg;
				}
				if(jQuery(o.password).val()=="") {
					msg+="\n"+o.passwordMsg;
				}
				if(msg!="") {
					o.error(msg);
					return false;
				}
				var params = "rurl=" + window.location;
				o.url+="?type=loginout&params=" + jQuery.urlencode(params);
				jQuery.ajax({
					url:o.url,
					type:o.type,
					dataType:o.dataType,
					timeout:o.timeout,
					data:o.data,
					error:function() {
						o.error("未知错误！");
					},
					success:function(data) {
						if(o.success){
							o.success(data);
						}
					},
					complete:function(data) {
						if(o.complete) {
							o.compalete(data);
						}
					}
				});
		    	return false;
		    });
		}
	});
})(jQuery);
jQuery.extend({
	//用户信息
  kfzx_login:function(){
	  if(jQuery.Cookie('uuzu_UNICKNAME')){
		  jQuery("#serwtDengluqu_left").hide();
		  jQuery("#UserInfoQu_left").show();
          jQuery("#user_level_left").show();
		  jQuery('#user_name').html(jQuery.Cookie('uuzu_UNICKNAME'));
	      var userPic = jQuery.Cookie("uuzu_USERPIC");
		    if(userPic==null||userPic=="") {
		    	userPic="http://pic.9787.com/uuzu_new/images/icon/head/default_small.gif";
		    } else {
		    	userPic=decodeURIComponent(userPic)
		    }
		   jQuery(".User_photoZu img:eq(0)").attr('src',userPic);
			var strHtml = "";
		    var step = jQuery.Cookie("uuzu_USERLEVEL")%10;
		    var grade = parseInt(jQuery.Cookie("uuzu_USERLEVEL")/10);
		    
		    for(var i=5;i>0;i--){
		        if(i == grade) {
		        	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/step'+step+'.gif"><img src="http://pic.9787.com/uuzu_new/images/icon/level/grade'+i+'.gif">';
		        } else if(i < grade){
		        	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/grade'+i+'.gif">';
		        } else{
		        	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/grade'+i+'uc.gif">';
		        }
		    }
		    if(grade == 0){
		     	strHtml += '<img src="http://pic.9787.com/uuzu_new/images/icon/level/step'+step+'.gif">';
		    }
		    jQuery(".mild>.user_level>.level_icon").html(strHtml);
		    if(jQuery.Cookie("uuzu_USERLEVEL")!=undefined&&jQuery.Cookie("uuzu_USERLEVEL").length>0)
		    	jQuery(".mild>.user_level>.level_num").html(jQuery.Cookie("uuzu_USERLEVEL")+'级');
		    else
		        jQuery(".mild>.user_level>.level_num").html(jQuery.Cookie("uuzu_LEVEL")+'级');
      }else{
           jQuery("#UserInfoQu_left").hide();
           jQuery("#user_level_left").hide();
           jQuery("#kfzx_login1").attr("href","https://passport.9787.com/login.php?rurl="+window.location);
           jQuery("#kefzx_user1").attr("href","https://passport.9787.com/login.php?rurl=https://passport.9787.com/member/my.php");
           jQuery("#serwtDengluqu_left").show();
      }
  }
});
//------header start------
var act_gdgn_html_inner = '.TopCiteBar';
var act_gdgn_html_top = 28;
var act_gdgn_html_right = 0;
var nowdate =new Date();
var y=nowdate.getFullYear();
var m=nowdate.getMonth()+1;
var d=nowdate.getDate();
var act_gdgn_html = '<div class="MapPostBar" id="act_gdgn_html" style="display:none;position:absolute;z-index:99999;"> \
	  <div class="tops">今天是'+y+'年'+m+'月'+d+'日，欢迎来到9787网页游戏大本营！</div> \
	  <div class="mild"> \
	    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Map_xxbiao"> \
	      <tr> \
	        <td valign="top" class="lie1">站内导航</td> \
	        <td valign="top" class="lie2"><a title="平台首页" href="http://www.9787.com/" class="current">平台首页</a><a title="游戏大厅" href="http://www.9787.com/ugame/">游戏大厅</a><a title="活动中心" href="http://www.9787.com/uactivity/">活动中心</a><a title="资讯中心" href="http://www.9787.com/uinfo/">游戏资讯</a><a title="客服中心" href="http://www.9787.com/u_service/" class="current">客服中心</a><a title="充值中心" href="https://passport.9787.com/payment/index.php">充值中心</a><a title="互动论坛" href="http://bbs.9787.com">互动论坛</a></td> \
	      </tr> \
	      <tr> \
	        <td valign="top" class="lie1"><a title="用户中心" href="https://passport.9787.com/member/my.php" class="current">用户中心</a></td> \
	        <td valign="top" class="lie2"><a title="9787身份证" href="https://passport.9787.com/member/usercard.php" class="current">9787身份证</a><a title="个人资料" href="https://passport.9787.com/member/my.php">个人资料</a><a title="密码修改" href="https://passport.9787.com/member/change_pwd.php">密码修改</a><a title="找回密码" href="https://passport.9787.com/service/getpwd.php#temail">找回密码</a><a title="认证信息" href="https://passport.9787.com/member/authentication.php#tmailAuth" class="current">认证信息</a></td> \
	      </tr> \
	      <tr> \
	        <td valign="top" class="lie1"><a title="充值服务" href="https://passport.9787.com/payment/index.php" class="current">充值服务</a></td> \
	        <td valign="top" class="lie2"><a title="立即充值" href="https://passport.9787.com/payment/index.php" class="current">立即充值</a><a title="充值记录" href="https://passport.9787.com/payment/pay_record.php">充值记录</a><a title="兑换游戏币" href="https://passport.9787.com/payment/exchange.php">兑换游戏币</a><a title="兑换记录" href="https://passport.9787.com/payment/exchange_record.php">兑换记录</a> </td> \
	      </tr> \
	      <tr> \
	        <td valign="top" class="lie1"><a title="我的客服" href="http://cs.9787.com/index.html" class="current">我的客服</a></td> \
	        <td valign="top" class="lie2"><a title="问题咨询" href="http://cs.9787.com/myservice/myservice.php?action=list&type=1" class="current">问题咨询</a><a title="意见反馈" href="http://cs.9787.com/myservice/myservice.php?action=list&type=2">意见反馈</a><a title="举报投诉" href="http://cs.9787.com/myservice/myservice.php?action=list&type=3">举报投诉</a><a title="常见问题" href="http://cs.9787.com/myservice/myservice.php">常见问题</a> </td> \
	      </tr> \
	      <tr> \
	        <td valign="top" class="lie1"><a href="http://www.9787.com/ugame/" title="游戏大厅">游戏大厅</a></td> \
	        <td valign="top" class="lie2"><a class="current" href="http://1.9787.com" title="一骑当先">一骑当先</a> <a href="http://jtxm.9787.com" title="九天仙梦">九天仙梦</a> <a href="http://sxd.9787.com" title="神仙道">神仙道</a> <a href="http://10.9787.com" title="十年一剑">十年一剑</a></td> \
	      </tr> \
	    </table> \
	  </div> \
	  <div class="ends"></div> \
	</div>';
//------header end------ 
	//收藏
	  function favorite(URL, title)
	  {
	      try
	      {
	          window.external.addFavorite(URL, title);
	      }
	      catch (e)
	      {
	          try
	          {
	              window.sidebar.addPanel(title, URL, "");
	          }
	          catch (e)
	          {
	              alert("加入收藏失败，请使用Ctrl+D进行添加");
	          }
	      }
	  }
	  //设为首页
	  function homePage(obj,val){
	  	  try{
	  	                obj.style.behavior='url(#default#homepage)';
	  	                obj.setHomePage(val);
	  	        }
	  	        catch(e){
	  	                if(window.netscape) {
	  	                        try {
	  	                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
	  	                        } 
	  	                        catch (e)  {
	  	                                alert("此操作被浏览器拒绝！"); 
	  	                        }
	  	                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
	  	                        prefs.setCharPref('browser.startup.homepage',val);
	  	                 }
	  	        }
	  	 }
	  function getQueryStringRegExp(name)
	  {
	      var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
	      if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return "";
	  };


	  
jQuery(function(){
	
	/**
	 * 浮动工具条
	 * @aliang
	 * 2011-10-21
	 */
	function flowBox(){

		var srcURL = 'http://pic.9787.com/common/images/flowbox/';

		var bodyWidth = 960;

		//invalid for 1024x? or the browser's width can not hold
		if(window.screen.width == 1024 || (bodyWidth + 62 + 11) > $(window).width()) return;

		var plinks = [
			{imgSrc:'caoact_03.gif', link:'https://passport.9787.com/member/register.php'},//平台注册
			{imgSrc:'caoact_05.gif', link:'http://www.9787.com/ugame/newpackage/'},//领取礼包
			{imgSrc:'caoact_07.gif', link:'https://passport.9787.com/payment/yeepay_bank.php'},//游戏充值
			{imgSrc:'caoact_09.gif', link:'http://bbs.9787.com/'},//游戏论坛
			{imgSrc:'caoact_11.gif', link:'http://cs.9787.com/myservice/myservice.php?1'},//常见问题
			{imgSrc:'caoact_13.gif', link:'http://passport.9787.com/member/my.php'},//完善资料
			{imgSrc:'caoact_15.gif', link:'http://www.9787.com'}//返回首页
		];

		var $wrap = $('<div class="fudongQu" style="padding:0;width:62px;height:483px;background:url('+srcURL+'caoact_bg.gif) repeat-y;"></div>');
		var html = '<p class="fudot_top" style="padding:0 0 4px 0;margin:0;"><img src="'+srcURL+'caoact_top.gif" /></p>';
		
		$.each(plinks, function(i, obj){
			html += '<p style="padding:8px 0;margin:0;"><a href="'+obj.link+'"><img src="' + srcURL+obj.imgSrc + '" border="0" /></a></p>';
		});

		html += '<p class="fudot_end" style="padding:4px 0 0;margin:0;"><img style="vertical-align:bottom;" src="'+srcURL+'caoact_end.gif" border="0" /></p>';
		$wrap.append(html);
		
		$('body').append($wrap);

		if($.browser.msie && $.browser.version == '6.0'){
			$(window).scroll(function(){
				 reset();
			}).scroll();
		}else{
			$(window).resize(function(){
				resize();
			}).resize();
		}

		function resize(){
			var offsetTop = parseInt(($(window).height() - $wrap.height()) / 2);
			if(offsetTop < 0) offsetTop = 0;
			var offsetLeft = parseInt(($(window).width() - bodyWidth) / 2 - $wrap.width()) - 11;

			if(offsetLeft < 0) offsetLeft = 0;

			$wrap.css({
				'position': 'fixed',
				'top': offsetTop,
				'left': offsetLeft
			});
		}

		function reset(){
			var m = parseInt(($(window).height() - $wrap.height()) / 2);
			var offsetTop = document.documentElement.scrollTop+document.documentElement.clientHeight - $wrap.height() - m;
			if(offsetTop < 0) offsetTop = 0;
			var offsetLeft = parseInt(($(window).width() - bodyWidth) / 2 - $wrap.width()) - 11;

			if(offsetLeft < 0) offsetLeft = 0;

			$wrap.css({
				'position': 'absolute',
				'top': offsetTop,
				'left': offsetLeft
			});
		}

		return $wrap;
	};

	flowBox();


	// GoldBox
	function goldBox(){

		var test = (location.hash == '#testgoldbox');
		var username = $.Cookie('uuzu_UNICKNAME');
		var account = null;
		if(!username) return;
		
		//概率事件显示宝箱
		$.get('/proxy.php', {url: 'http://www.9787.com/activity/goldbox.php', page: location.href, getbox: 1}, function(rdata){
			var rs = rdata.split('|');
			data = rs[0];
			if(rs[1]) username = rs[1];

			if(data != -1) display(data);// && test
		});
	
		//显示宝箱
		function display(data){
			var imgSrc = 'http://pic.9787.com/common/images/activity/goldbox.png';
			var imgWidth = imgHeight = 84;
			var scrollWidth = $('body').width() - imgWidth;
			var scrollHeight = $(document.body).height() - imgHeight;
			
			var offsetTop = rand(0, scrollHeight);
			var offsetLeft = rand(0, scrollWidth);

			var $img = $('<a href="javascript:;" title="9787我要找宝箱" id="glodBox"><img style="_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='+imgSrc+');" src="'+imgSrc+'" border="0" width="84" height="84"></a>');

			$('body').append($img);

			var shake = null;

			$img.css({
				'position': 'absolute',
				'top': offsetTop,
				'left': offsetLeft,
				'zIndex': 99999
			}).bind('click', function(){
				initPage(data);
				$(this).remove();
				return false;
			}).bind('mouseenter', function(){
				var _this = this;
				var tmp = 1;
				shake = setInterval(function(){
					if(tmp % 2 == 1) $(_this).css({'top': offsetTop + 3, 'left': offsetLeft + 3});
					else $(_this).css({'top': offsetTop, 'left': offsetLeft});
					tmp ++;
				}, 200);
			}).bind('mouseout', function(){
				if(shake) clearInterval(shake);
				$(this).css({'top': offsetTop, 'left': offsetLeft});
			});
		}

		//显示取激活码
		function initPage(chance){

			var servers = new Array();

			$.uboxs.open('/proxy.php?url='+encodeURIComponent('http://www.9787.com/activity/goldbox_window.html'),{
				type:'moterPopBar',
				contentType:'ajax',
				onopen:function(box){
					box.initEvent();
					$.getScript('/proxy.php?url='+encodeURIComponent('http://data.9787.com/js/server_4.js'), function(){
						for(var i in server_status){
							if(server_status[i].status == 1){
								servers[server_status[i].server_code] = server_status[i].server_domain;
								$('#goldbox_servers').append('<option value="'+server_status[i].server_code+'">'+server_status[i].server_name+'</option>');
							}
						}
					});

					box.dh.find('#goldbox_username').val(username);
					box.dh.find('#goldbox_chance').text(chance);
					$('#goldbox_servers').change(function(){
						//显示结果
						var server_code = $(this).val();
						if(server_code == '') return false;
						var _this = this;
						$.get('/proxy.php', {url: 'http://www.9787.com/activity/goldbox.php', getcode: 1, server_code: server_code, page: location.href}, function(data){
							if(!(parseInt(data) < 0)){
								box.dh.find('#goldbox_code').text(data);
								box.dh.find('#goldbox_result').show();
								box.dh.find('#goldbox_chance').text(parseInt(chance) - 1);

								$(_this).unbind('change');

								$(_this).change(function(){
									alert('一个宝箱只能领取一次，请再寻找吧.');
									return false;
								});
							}else{
								alert('激活码没有了，请稍后再试。');
							}
						});
					});

					// Copy code
					box.dh.find('#goldbox_copycode').click(function(){
						var code = box.dh.find('#goldbox_code').text();
						if($.Copy(code)){
							alert('已复制到您的剪切板.');
						}else alert('因安全问题浏览器不支持复制，请手动复制');

						return false;
					});
				},
				onok:function(box){
					var server_code = $('#goldbox_servers').val();
					if(server_code != ''){
						var server = servers[server_code];
						location.href = 'http://www.9787.com/frame.php?domain='+server;
					}else{
						alert('请选择游戏服务区。');
						return false;
					}
				}
			});
		}

		function rand(min, max){
			return parseInt(Math.random() * (max - min) + min);
		}
	}

	goldBox();
});


(function(){
	$.extend({
		Copy: function(copytext){
			if(window.clipboardData){
				return (window.clipboardData.setData("Text", copytext)); 
			}else if(window.netscape){
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
				var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
				if (!clip) return;
				var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
				if (!trans) return;
				trans.addDataFlavor('text/unicode');
				var str = new Object();
				var len = new Object();
				var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
				str.data=copytext;
				trans.setTransferData("text/unicode",str,copytext.length*2);
				var clipid=Components.interfaces.nsIClipboard;
				clip.setData(trans,null,clipid.kGlobalClipboard);
				return true; 
			}
		}
	});


})(jQuery);
