﻿// JScript 文件

var getObj = function(o)
{
    return document.getElementById ? document.getElementById(o) : document.all(o);
}


//判断是否做过安保计划
function IspwdProtect(id)
{
    var url;

    var nowqq = new Date();
    url = "IspwdProtect.asp?ID=" + id + "&t=" + nowqq.getTime();

    doRequest(url,Ispwdpro); 

}
var Ispwdpro = function(){

    if (httpRequest.readyState == 4 && httpRequest.status == 200){
        var operInfo = httpRequest.responseText;
			var question=operInfo.split("|")[1];
			var answer=operInfo.split("|")[2];
			var getid=operInfo.split("|")[3];
			 
        switch (operInfo.split("|")[0])
		{
			case "1":
				CloseMessageBox('G_PwdSecurity1.asp?question='+question+'&id='+getid+'');
				break;
			case "0":
				CloseMessageBox('G_PwdSecurity4.asp?id='+getid+'');
				//alert("处理失败！");
				break;
			default:
				alert("处理出错，请另选时间处理！");
				break;
		}
    }

}
//


///'''''''''''''''''''''''''''''''''''
 var box_open = 0;
//重定向框架位置
function resize_box()
{
	if(get_obj('msgDiv'))
	{
		if(box_open)
		{
			var width = (document.body.scrollWidth - 440) / 2;
			get_obj('msgDiv').style.left = width + "px";

			var width = (document.body.scrollWidth - 440) / 2;
			get_obj('closeDiv').style.left = (width + 405) + "px";
		}
		else
		{
			var width = (document.body.scrollWidth - 440) / 2;
			get_obj('msgDiv').style.left = width + "px";

			var width = (document.body.scrollWidth - 440) / 2;
			get_obj('closeDiv').style.left = (width + 405) + "px";
		}
	}
}

var isIE = document.all ? true : false;  //判断是否是IE

//得到文档对象
function get_obj(id) 
{
	return document.getElementById ? document.getElementById(id) : document.all(id);
	//return document.getElementById(id);
}

//打开游戏内部购买层
 function CloseMessageBox(url)
 {
		CloseBox();

	   var msgw=450;//框架窗口的宽度 
	   var msgh=400;//框架窗口的高度 
	   box_open = 0;

	   var sWidth,sHeight; 
	   sWidth=document.body.offsetWidth;  
	   sHeight=document.body.offsetHeight;

	   
	   
	   var msgObj=document.createElement("div") 
			msgObj.setAttribute("id","msgDiv"); 
			msgObj.setAttribute("align","center");
			msgObj.style.position="absolute";
		
		//判断屏幕分辩率
		var width = (document.body.scrollWidth - 500) / 2;
		msgObj.style.left = width + "px";
		msgObj.style.top = "63px"; 


			msgObj.style.width = msgw + "px"; 
			msgObj.style.height = msgh + "px"; 
			msgObj.style.zIndex = "10001";

		msgObj.innerHTML='<iframe id="pay_iframe" src="'+url+'" width="450" height="400" frameborder="0" scrolling="no" ></iframe>';


	document.body.appendChild(msgObj);


	  var closeObj=document.createElement("div");
	  closeObj.setAttribute("id","closeDiv"); 

	  //判断屏幕分辩率
		closeObj.style.left = (width + 408) + "px";
		closeObj.style.top = "83px"; 
	  
	  closeObj.setAttribute("valign","top");
	  closeObj.style.position="absolute";

	  closeObj.style.zIndex = "10002";
	  closeObj.innerHTML='<img onclick="CloseBox();" src="http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose.jpg" width="26" height="26" style="cursor:pointer" onmouseover="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose_h.jpg\'" onmouseout="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose.jpg\'"  onmousedown="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose_p.jpg\'"/>'; 
	  document.body.appendChild(closeObj);
	   
		 
		 
 }

  function CreatePanel(url,width,height)
 {
		CloseBoxNew();
	   var msgw=width;//框架窗口的宽度 
	   var msgh=height;//框架窗口的高度 
	   box_open = 0;

	   var sWidth,sHeight; 
	   sWidth=document.body.offsetWidth;  
	   sHeight=document.body.offsetHeight;
	   
	   var msgObj=document.createElement("div") 
			msgObj.setAttribute("id","msgDivNew"); 
			msgObj.setAttribute("align","center");
			msgObj.style.position="absolute";
		
		//判断屏幕分辩率
		//var width = (document.body.scrollWidth - 500) / 2;
		var mainPlay = get_obj('main_playL_body');
		
		msgObj.style.left= (sWidth - 856)/2 +"px"
		msgObj.style.top = "8px"; 


			msgObj.style.width = msgw + "px"; 
			msgObj.style.height = msgh + "px"; 
			msgObj.style.zIndex = "10001";

		//msgObj.innerHTML='<iframe id="pay_iframe" src="'+url+'" width="'+sWidth+'" height="'+sHeight+'" frameborder="0" scrolling="no" ></iframe>';

		msgObj.innerHTML='<iframe id="pay_iframe" src="'+url+'" width="'+width+'" height="'+height+'" frameborder="0" scrolling="auto"  ></iframe>';

		document.body.appendChild(msgObj);

		/*if(url != "Html/HappyMath_new.html"){
		var closeObj=document.createElement("div");
		closeObj.setAttribute("id","closeDiv"); 

		//判断屏幕分辩率
		closeObj.style.left = ((sWidth - 856)/2 + 730)+"px";
		closeObj.style.top = "514px"; 
	  
		closeObj.setAttribute("valign","top");
		closeObj.style.position="absolute";

		closeObj.style.zIndex = "10002";
		// closeObj.innerHTML='<img onclick="CloseBox();" src="http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose.jpg" width="26" height="26" style="cursor:pointer" onmouseover="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose_h.jpg\'" onmouseout="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose.jpg\'"  onmousedown="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose_p.jpg\'"/>'; 
		//closeObj.innerHTML='<div id="flash_show" style="float:left;overflow:visible;z-index:10005;top:-20px;position:relative;"><script language="javascript" type="text/javascript"> var so = new SWFObject("html/flashs/btnMath.swf", "flash_1", "80", "80", "8", "");so.addParam("quality", "high"); so.addParam("wmode", "transparent"); so.write("flash_show");</script></div>' 
		closeObj.innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="80" height="90" id="flash_math" align="middle"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="html/flashs/btnMath.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#28a0f0" /><embed src="html/flashs/btnMath.swf" quality="high" bgcolor="#28a0f0" width="80" height="90" name="flash_math" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_cn" />' 
	
		document.body.appendChild(closeObj);
		}
		
		var closeObj1=document.createElement("div");
		closeObj1.setAttribute("id","closeDiv1"); 

		//判断屏幕分辩率
		closeObj1.style.left = ((sWidth - 856)/2+2)+"px";
		closeObj1.style.top = "524px"; 
	  
		closeObj1.setAttribute("valign","top");
		closeObj1.style.position="absolute";

		closeObj1.style.zIndex = "10003";
		// closeObj.innerHTML='<img onclick="CloseBox();" src="http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose.jpg" width="26" height="26" style="cursor:pointer" onmouseover="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose_h.jpg\'" onmouseout="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose.jpg\'"  onmousedown="this.src=\'http://www.wawayaya.net/space/play/pwdprotect/images/btn_PWDclose_p.jpg\'"/>'; 
		//closeObj.innerHTML='<div id="flash_show" style="float:left;overflow:visible;z-index:10005;top:-20px;position:relative;"><script language="javascript" type="text/javascript"> var so = new SWFObject("html/flashs/btnMath.swf", "flash_1", "80", "80", "8", "");so.addParam("quality", "high"); so.addParam("wmode", "transparent"); so.write("flash_show");</script></div>' 
		closeObj1.innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="80" height="80" id="flash_learn" align="middle"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="html/flashs/btnLearn.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#28a0f0" /><embed src="html/flashs/btnLearn.swf" quality="high" bgcolor="#28a0f0" width="80" height="80" name="flash_math" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_cn" />' 
	
		document.body.appendChild(closeObj1);
	   
		 */
		 
 }

//关闭层

function CloseBox()
{
		var msg_div = get_obj('msgDiv');
		var close_div = get_obj('closeDiv');
		var pay_iframe = get_obj('pay_iframe');

		if(pay_iframe)
		{
			pay_iframe.src = "";
		}

		if(msg_div)
		{
			if(isIE) msg_div.removeNode(true);
			else msg_div.parentNode.removeChild(msg_div);
		}
		
		if(close_div)
		{
			if(isIE) close_div.removeNode(true);
			else close_div.parentNode.removeChild(close_div);
		}
		
}
 
function CloseBoxNew()
{
		var msg_div = get_obj('msgDivNew');
		//var close_div = get_obj('closeDiv');
		//var close_div1 = get_obj('closeDiv1');
		if(msg_div)
		{
			if(isIE) msg_div.removeNode(true);
			else msg_div.parentNode.removeChild(msg_div);
		}
		/*if(close_div)
		{
			if(isIE) close_div.removeNode(true);
			else close_div.parentNode.removeChild(close_div);
		}
		if(close_div1)
		{
			if(isIE) close_div1.removeNode(true);
			else close_div1.parentNode.removeChild(close_div1);
		}
		*/
}
//以下为物品保护所需函数
function closeWuPin()
 {
	//alert("关闭物品");
	thisMovie("flash_3").setGoodsProt("00");
 }
 function openWuPin()
 {
	// alert("打开物品");
	 thisMovie("flash_3").setGoodsProt("01");
 }
 //交易函数 typeid 0人人交易 1人店交易  你自己看着规定就可以啦 
function jiaoyi(typeid)
{
	if(typeid == "1"){
		thisMovie("flash_3").showShop();
	}else if(typeid == "2"){
		thisMovie("flash_3").sendTradeInv();
	}else if(typeid == "3"){
		thisMovie("flash_3").agreeTrade();
	}
	thisMovie("flash_3").setGoodsProt("11");
    CloseBox();

}
// 获取用户信息
function getSwfUid()
{
	return thisMovie("flash_3").getSwfUid();
}
function getSwfGid()
{
	return thisMovie("flash_3").getSwfGid();
}
function getSwfNick()
{
	return thisMovie("flash_3").getSwfNick();
}
function getSwfPid()
{
	return thisMovie("flash_3").getSwfPid();
}