﻿//function
function ge(z){return document.getElementById(z)}
function gE(z,y){return z.getElementsByTagName(y)}
function ce(z){return document.createElement(z)}
function de(z){z.parentNode.removeChild(z)}
function ct(z){return document.createTextNode(z)}
function rf(){return false}
function tb(){this.blur()}
function ac(z){var a=0,b=0;while(z){a+=z.offsetLeft;b+=z.offsetTop;z=z.offsetParent} return [a,b]}
function gp(o,z){o=o.parentNode;while(o.nodeName!=z){o=o.parentNode;} return o;}

function getEvent(){     //同时兼容ie和ff的写法　　取得操作对像
	 if(document.all)    return window.event;        
	 func=getEvent.caller;            
	 while(func!=null){    
		 var arg0=func.arguments[0];
		 if(arg0){
			 if((arg0.constructor==Event || arg0.constructor ==MouseEvent)
				 || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation)){    
				 return arg0;
			 }
		 }
		 func=func.caller;
	 }
	 return null;
}
var Get={
windowSize:function()
{
	var width = 0, height = 0;
	if(typeof window.innerWidth == 'number') //Non-IE
	{
		width = window.innerWidth;
		height = window.innerHeight;
		
	}
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
  	{
		//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	}
 	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		//IE 4 compatible
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	return [width, height];
}
,
scroll:function()
{
	var x = 0, y = 0;
	if(typeof(window.pageYOffset) == 'number')
	{
		//Netscape compliant
		x = window.pageXOffset;
		y = window.pageYOffset;
	}
	else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
	{
		//DOM compliant
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
	{
		//IE6 standards compliant mode
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	return [x, y];
}
}
 //删除文本节点，DEMO
function cleanWhitespace(node){
	if(node!=null){
	for (var x=0; x<node.childNodes.length; x++) {
		var child = node.childNodes[x];
		//if it's a whitespace text node  && (!notspace.test(child.nodeValue)
		if (child.nodeType == 3){
			node.removeChild(node.childNodes[x]);
			//node.childNodes[x].removeNode();
			x--;
		}
		//elements can have text child nodes of their own
		//if(child.nodeType == 1) {
		//	cleanWhitespace(child);
		//}
	}
	}
}

//添加脚本
function appendScript(url){
    var e=document.createElement('script');
    e.src=url;
    e.type='text/javascript';
    //e.charset="gCharset";
	document.getElementsByTagName("head")[0].appendChild(e)
    //var b=document.getElementsByTagName('body')[0];
    //b.insertBefore(e,b.firstChild);
}

function getCatalogue(){
	var ads = location.href.split("/"); ;
	var cu=ads[ads.length-2];
	return cu;
}

//=====================页面输出=============================================
function printLeftLink(){
    var _mode = getCatalogue();
    if(_mode.toLowerCase() == "download"){
	     var s ='<map name="Map" id="Map">'+
                '    <area shape="rect" coords="20,118,169,154" href="../Download/Wallpaper.aspx" />'+
                '    <area shape="rect" coords="21,71,170,107" href="../Download/Patch.aspx" />'+
                '    <area shape="rect" coords="21,23,170,59" href="../Download/Client.aspx" />'+
                '</map><div class="webLinks"><img src="../Images/Ty_down_links.jpg" border="0" usemap="#Map" /></div>'; 
    }else{
        var s = '<map name="Map" id="Map">'+
	            '    <area shape="rect" coords="23,159,172,195" href="http://passport.ferrygame.com/payment/PaymentBank.aspx?GID=9c486cbe-b706-442f-b35e-0855d91fe587" target="_blank" />'+
                '    <area shape="rect" coords="20,112,169,148" href="http://passport.ferrygame.com/account/tyactive.aspx" target="_blank" />'+
                '    <area shape="rect" coords="21,65,170,101" href="../download/client.aspx" />'+
                '    <area shape="rect" coords="21,17,170,53" href="http://passport.ferrygame.com/page/RegistAccount.aspx" target="_blank" />'+
                '</map><div class="webLinks"><img src="../Images/Ty_web_links.jpg" border="0" usemap="#Map" /></div>';        
    }
    document.write(s);
}

function printHeader(){
	var str='<div id="Header"><div id="Header_inner"></div></div>';		
	document.write(str);
	var fo=new FlashObject("../Swf/MainTop.swf", "FNav", "1000px", "250px", "8");
	fo.addParam("wmode","transparent");
	fo.write("Header_inner");	
}


//====================事件中心=========================================
//合作媒体鼠标事件
function MeadiaTurn(o){
	var _evt=getEvent();
	var _e=_evt.srcElement || _evt.target;
	o.className="on_mediaList";
	var ul=gE(o,"ul")[0];
	ul.style.top=30-ul.clientHeight+"px";			
	o.onmouseout=function(){
		this.className="off_mediaList";
	}				
}