    $(document).bind("contextmenu", function(){
		$("#deny").fadeIn();
		setTimeout(function(){$("#deny").fadeOut('slow');},1500);
		return false;
	}); 
    $("#toplink").hide(); 
	var waiter;
	var myurl; 
	var popupStatus = 0;
	function loadPopup(){   
	if(popupStatus==0){   
		$("#backgroundPopup").css({   
			"opacity": "0.7"  
		});   
		$("#backgroundPopup").fadeIn("slow");   
		$("#popupContact").fadeIn("slow");   
		popupStatus = 1;   
		}   
	}  
	function disablePopup(){   
		if(popupStatus==1){   
				$("#backgroundPopup").fadeOut("slow");   
				$("#popupContact").fadeOut("slow");   
				popupStatus = 0;   
			}   
	} 
	function centerPopup(){   
		var windowWidth = document.documentElement.clientWidth;   
		var windowHeight = document.documentElement.clientHeight;   
		var popupHeight = $("#popupContact").height();   
		var popupWidth = $("#popupContact").width();   
		$("#popupContact").css({   
			"position": "absolute",   
			"top": windowHeight/2-popupHeight/2,   
			"left": windowWidth/2-popupWidth/2  
		});   
		$("#backgroundPopup").css({   
			"height": windowHeight - 1  ,
			"width": windowWidth - 2  
		});   
	}
	$("#button").click(function(){
		centerPopup();   
		loadPopup();   
	});
	$("#popupContactClose").click(function(){ 
	        clearTimeout(waiters);  
			disablePopup();   
	});   
	$(document).keypress(function(e){   
		if(e.keyCode==27 && popupStatus==1){   
			disablePopup();   
		}   
	});  
    waiters=null;
	pausetime = 2500;
	function freshpage(obj){
	    myurls = $(obj).attr('outerlink');
	    if ($(obj).attr('allow')==1) {  
			if ($(obj).attr('haschild')==1) {  
				bigids = $(obj).attr("bigid");
				$.get("index.php?go=default&do=ajaxlink&linkid=" + bigids, function(data){
				  $("#toplink").hide();
				  $("#content").css({"margin-top":"95px","padding":"0px"});
				  $("#content div").html("");
				  $("#biglink").show().html(data);
				}); 	
			} else {
			    if ($(obj).attr('outerlink')!="") { 
					centerPopup();   
					loadPopup();
		            document.getElementById("newurl").onclick = function(){disablePopup();window.open(myurls,'_blank',"toolbar=yes,scrollbars=yes,menubar=yes,titlebar=yes,status=yes,location=yes,resizable=yes");return false;}
					$("#cancel").click(function(){disablePopup();return false;});
				} else { //否则内部链接处理
					$("#biglink").hide();
					$("#content div").html('<span style="color:red;">Loading data...</span>');
					myids = $(obj).attr('myid');
					if(myids==0) {
					  $("#toplink").hide();
					  $("#content").css({"margin-top":"95px","padding":"0px"});
					  $("#content div").html("");
						$.get("index.php?go=default&do=ajaxlink&home=yes", function(data){
						  $("#toplink").hide();
						  $("#content").css({"margin-top":"95px","padding":"0px"});
						  $("#content div").html("");
						  $("#biglink").show().html(data);
						}); 	
					  $("#biglink").show();
					  return true;
					}
					$("#toplink").show();
					$.get("index.php?go=info&do=ajaxinfo&infoid=" + myids, function(data){
					  $("#biglink").hide();
					  $("#content").css({"margin-top":"21px","padding":"2px"});
					  $("#content div").css({"overflow":"auto", "height":"380px", "width":"520px"}).html(data);
					}); 				
				}
			}
		} else {
		    return true;
		}
	}

