var now = new Date();

function showtime(date){

		var now_hour = now.getHours();
		var helloword = "";
		if (now_hour > 4 && now_hour < 10) {
		helloword = "早上";
		} else if (now_hour >= 10 && now_hour < 12) {
		helloword = "上午";
		} else if (now_hour >= 12 && now_hour < 14) {
		helloword = "中午";
		} else if (now_hour >= 14 && now_hour < 18) {
		helloword = "下午";
		} else if (now_hour >= 18 || now_hour < 14) {
		helloword = "晚上";
		}
		var weekday=["日","一","二","三","四","五","六"]
		document.getElementById("tdate").innerHTML = helloword + "好!今天是" + (now.getMonth() + 1) + "月" + now.getDate() + "日 星期"+weekday[now.getDay()];

	}

function externallinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if ( (anchor.getAttribute("href") && anchor.getAttribute("rel") == "nofollow") || (anchor.getAttribute("href") && anchor.getAttribute("rel") == "follow")) 
     anchor.target = "_blank"; 
 } 
}
window.onload = externallinks;


function showGame(width,height,sname){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ width +'" height="'+ height +'">');
	document.write('<PARAM NAME=movie VALUE="/game/flash/'+ sname +'"> <PARAM NAME=quality VALUE=high><param name=wmode value=opaque>');
	document.write('<EMBED src="/game/flash/'+ sname +'" quality=high WIDTH='+ width +' HEIGHT="'+ height +'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
	document.write('</object>');
}

function request(url,method,send,fun){
	if(send==undefined) send=null;
	if(method==undefined) method="GET";
	var xmlObj=window.XMLHttpRequest?new XMLHttpRequest():(window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):false);
	xmlObj.onreadystatechange=function(){
		if(xmlObj.readyState==4 && xmlObj.status==200){
			if(typeof fun=="function"){
				fun(xmlObj.responseXML);
			}
		}
	}
	xmlObj.open(method.toUpperCase(),url,true);
	xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlObj.send(send);
}

function ShowTheWindows(poptext)
{
	imagewidth = 258;
	imageheight = 90;
	speed = 40;
	x = screen.width-imagewidth-1;
	y = screen.height-imageheight-1;
	oPopup = window.createPopup();
	oPopupBody = oPopup.document.body;
	oPopupBody.style.cursor = "hand";
	oPopupBody.innerHTML = poptext;
	oPopup.document.body.onmouseover = new Function("clearTimeout(startani_A)");
	oPopup.document.body.onmouseout = pop; 
	oPopup.document.body.oncontextmenu = dismisspopup;
	pop_TC = 20;
	pop(oPopup,x,y,imagewidth,imageheight);
}
function pop(){oPopup.show(x,y,imagewidth, imageheight);startani_A=setTimeout("pop()",500);if(pop_TC<0){dismisspopup();};pop_TC=pop_TC-1;}
function dismisspopup(){oPopup.hide();clearTimeout(startani_A);}

function disablePage(){
document.getElementById("cover").style.position="absolute";
document.getElementById("cover").style.top=0;
document.getElementById("cover").style.left=0;
document.getElementById("cover").style.filter = "alpha(opacity=70)";
document.getElementById("cover").style.background = "#E4F3D1";
document.getElementById("cover").style.width=window.screen.width-21;
document.getElementById("cover").style.height=document.body.clientHeight+document.body.scrollHeight;
document.getElementById("cover").style.zIndex=2;
}

function click_return(strvar,strt)
{
  var tmpvar='';
  switch (strt)
  {
    case 1:
      tmpvar='您确定要'+strvar+'吗？';
      break;
    case 5:
      tmpvar=strvar;
      break;
    default :
      tmpvar='您确定要'+strvar+'吗？\n\n执行该操作后将不可恢复！';
      break;
  }
  var tmptrue=window.confirm(tmpvar);
  if (tmptrue) { return true; }
  return false;
}

function insert_value(strinput,strvalue)
{
	var client_browse="";
	if (document.getElementById)	// IE5+,NN6+	document.getElementById("id");
	{ client_browse="ie5"; }
	else if (document.all)		// IE4		document.all("id");
	{ client_browse="ie4"; }
	else if (document.layers)	// NN4		document.layers["id"];
	{ client_browse="ns4"; }
	var tmpstr="";
	switch (client_browse)
	{
	    case "ie5":
	      tmpstr="document.all."+strinput+".value='"+strvalue+"';";
	      break;
	    case "ns4":
	      tmpstr="document.layers.[\""+strinput+"\"].value='"+strvalue+"';";
	      break;
	    default :	//"ie4"
	      tmpstr="document.all."+strinput+".value='"+strvalue+"';";
	      break;
	}
	if (tmpstr!="") eval(tmpstr);
}

function EXIT(){window.location = 'quit.php';}
