var bg = getCookie("cn_home_bg")?getCookie("cn_home_bg"):"orange";
function __nav(c){
	var o = $("nav").getElementsByTagName("A");	
	var nav = new Array($("trade"),$("wholesale"),$("retail"));
	for(var i=0;i<o.length;i++){
		o[i].className="";
		nav[i].className="hidden";	
	}	
	if(o[c]) o[c].className="click";
}

function mallpop(c){	
	var nav = new Array($("trade"),$("wholesale"),$("retail"));
	__nav(c);
	nav[c].className="wrap cc";
}

function nav(s,c){if($("trade"))	setTimeout("mallpop("+c+")",200);}

/*
var h_timer=null;
function mallhide(){h_timer=setTimeout("__nav()",500);}
function mall(){if(h_timer)clearTimeout(h_timer);}
 */

function weather(){
	var o = $("weather");
	o.className=o.className=="hidden"?"weather b_Sd p_a":"hidden";
}


function search_item(s){
	var o = $("sItemPop");
	o.className=o.className=="hidden"?"sItem p_a l_18 t_l":"hidden";
}
function hidden_item(s){
	var o = $("sItemPop");
	var slide=function(){
		o.className="hidden";
	}
	setTimeout(slide, 3000);
}
function BOX_tab(s,c){
	var o = $n("box");
	var list = $("boxlist").getElementsByTagName("UL");
	for(var i=0;i<o.length;i++){
		o[i].className="b_Sd bg";
		list[i].className="hidden";
	}
	s.className="click b_Sd bg";
	list[c].className="tB"+(c+1)+" cc";
}

function bp_tab(s,c){
	var o = $("bp").getElementsByTagName("LI");
	var sa = s.parentNode.getElementsByTagName("A");
	var f = $("bpflash").getElementsByTagName("LI");
	for(var i=0;i<o.length;i++){
		o[i].className="hidden";
		f[i].className="hidden";	
		sa[i].className="";
	}
	if(c==1){
		$("bp").className="r r2 f_r b_Sd l_20 f_b";
		sa[0].className="click b_rSd b_bSd";
	}else{
		$("bp").className="r r1 f_r b_Sd l_20 f_b";
		sa[1].className="click b_rSd b_tSd";
	}
	o[c].className="cc";
	f[c].className="";
}
function popwindows(obj,c){
	$("popwindows").className = 'popwindows p_a b_Sd';
	$("popwindows").style.left = $("wrap").offsetLeft+175+'px';
	$("popwindows").style.top = $("wrap").offsetTop+document.documentElement.scrollTop + 'px';

	$("popwindows").style.width = "215px";
	$("popwindows").style.height = "583px";
	$("popwindowsc").style.height=isIE?'97%':'565px';

	if(!obj){
		$("popwindows").className = 'hidden';
		$("popwindowsc").src ="";
	}
	else{
		switch(obj){
			case "vshow":
				window.open("/index/vshow.asp","popwindowsc");
				$("popwindows").style.width = "300px";
				$("popwindows").style.height = "264px";
				$("popwindows").style.left = $("wrap").offsetLeft+10+'px';
				$("popwindows").style.top = $("wrap").offsetTop+document.documentElement.scrollTop+70 + 'px';			
				$("popwindowsc").style.height='246px';
				break;
			case "fax":
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://fax.ufo007.com/transfer.asp%3ffaxTarget=l%26lang=cn","popwindowsc");
				break;
			case "myufo007":
				$("popwindows").style.left = $("wrap").offsetLeft+360+'px';
				$("popwindows").style.top = $("wrap").offsetTop+document.documentElement.scrollTop + 'px';	
				Login?window.open("/Common/Users/Login/?Action=Transfer&Path=http://www.ufo007.com/zh-CN/Users/","popwindowsc"):window.open("/Common/Users/Login/?Action=Transfer&Path=http://www.ufo007.com/zh-CN/Users/menu.asp","popwindowsc");
				break;
			case "gts":
				window.open("/index/gts.asp?tab="+c+"","popwindowsc");
				break;
			case "cash":
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://www.ufo007.com/UPay/IMI/CashWithdrawal/?Lang=zh-CN","popwindowsc");
				break;
			case "invoice":
				window.open("/Common/Users/Login/?Action=Transfer&Path=https://www.ufo007.com/UPay/IMI/Invoice/?Type=1&Lang=zh-CN","popwindowsc");
				break;

			case "recreation":
				window.open("/8Hall/Menu.asp","popwindowsc");
				break;
			case "sms":				
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://www.ufo007.com/smsn/","popwindowsc");
				break;
			case "client-side":
				$("popwindows").style.width = "260px";
				$("popwindows").style.height = "683px";
				$("popwindowsc").style.height=isIE?'97%':'663px';
				window.open("/index/ufo007.asp","popwindowsc");
				break;
			case "b2b":
				$("popwindows").style.left = $("wrap").offsetLeft+360+'px';
				$("popwindows").style.top = $("wrap").offsetTop+document.documentElement.scrollTop + 'px';
				$("popwindows").style.height='565px';
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://uzone.cn.ufo007.com/lefthome/%3fh=home","popwindowsc");
				break;			
			default:
				window.open(obj, "popwindowsc");
				break;
		}
	}
}

function pop(s,c){
	$(s).className = "ufo007pop p_a";
	$(s).style.padding="";
	$(s).style.margin="";
	switch(c){
		case "download":
			$(s).childNodes[0].src="http://pics.ufo007.com/img/web/cn/index/pop-downloads.gif";
			$(s).style.margin=isIE?"0 0 0 -380px":"0 0 0 280px";
			break;		
		case "soundbox":
			$(s).childNodes[0].src="http://pics.ufo007.com/img/web/cn/index/pop-login.gif";
			$(s).style.margin=isIE?"230px 0 0 -350px":"230px 0 0 325px";			
			break;
		case "favorites":
			$(s).childNodes[0].src="http://pics.ufo007.com/img/web/cn/index/pop-login.gif";
			$(s).style.margin=isIE?"230px 0 0 20px":"230px 0 0 700px";
			break;
	}	
}

function _pop(s){$(s).childNodes[0].src="http://asset.ufo007.com/img/common/blank.gif";$(s).className = "ufo007pop hidden";}


function copycode(c,s){	
	if(isIE){
		c.createTextRange().execCommand('Copy');
		alert('复制成功，请将代码加入到网页中！');
		c.select();
	}else{
		alert("您使用的浏览器不支持此复制功能，请使用Ctrl+C或鼠标右键。");
		c.select();
	}
}

function OpenTalkingForm(loginName)
	{
	   try
	   {
		  var obj = null;
		  try
		  {
			  var obj = new ActiveXObject("IEContextForUFO.TIEContextMenu");
		  }
		  catch (e)
		  {
			  location.href = "https://www.ufo007.com/member/?pid=download";
			  return;
		  }

		  if (obj)
		  {
			  obj.OpenTalkingForm(loginName);
			  delete obj;
			  return false;

		  }
	   }
	   catch (e)
	   {
		  alert(e.message);
	   }
	}

//Call Ufo
function ToTriggerEvent(sContent,sType,sUser){
   try{
	var obj = null;
	try{
		var obj = new ActiveXObject("UFOClientEventP.ClientEvent");
	}catch(e){alert("加载控件失败!")}
	if (obj) {
		obj.TiggerEvent(sContent,sType,sUser);
		delete obj;
		return;
		}
	}catch(e){}
}

/*
function banner_topup(){
var d=$('banner_top');
var h=d.offsetHeight;
var maxh=90;

	function banner_top(){
		h+=10; //设置层展开的速度
		if(h>=maxh){
			d.style.height='90px';
			clearInterval(iIntervalId);
		}else{
			d.style.display='block';
			d.style.height=h+'px';
		}
	}
	iIntervalId=setInterval(banner_top,5);
}
function banner_topdn(){
	var d=$('banner_top');
	var h=d.offsetHeight;
	var maxh=90;
	function banner_top(){
		h-=10;//设置层收缩的速度
		if(h<=0){
			d.style.display='none';
			clearInterval(iIntervalId);
		}else{
			d.style.height=h+'px';
		}
	}
	iIntervalId=setInterval(banner_top,5);
}

function topbanner(){
	var d=$('banner_top');
	d.style.display=='none'?banner_topup():banner_topdn();	
}*/

function topbanner(){
	var d=$('banner_top');
	d.className='hidden';	
}
