function $(id){return document.getElementById(id);}
function $n(name){return document.getElementsByName(name);}
function isIE(){return (navigator.appVersion.indexOf("MSIE") < 0) ? false : true;}

//flash 虚线
function LoadFlash(url,wmode,width,Height)
{
document.write('<embed src="' + url + '" wmode=' + wmode +
  ' quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' + width +
  '" height="' + Height + '"></embed>');
}

function tryE(){try{fixPng();}catch(ex){}}
/* menu */
function mOver(obj,c){ obj.src="img/button/mm"+c+".png";tryE()}
function mOut(obj,c){ obj.src="img/button/m"+c+".png";tryE()}

function popwindows(obj,c){
	$("popwindows").style.display = '';
	$("popwindows").style.left = $("wrap").offsetLeft+175+'px';
	$("popwindows").style.top = document.documentElement.scrollTop+47 + 'px';

	$("popwindows").style.width = "215px";
	$("popwindows").style.height = "583px";
	$("popwindowsc").style.height=isIE()?'97%':'565px';

	if(!obj){
		$("popwindows").style.display = 'none';
		$("popwindowsc").src ="";
		//if (Login==true)	{$("refresh_").src = "/index/GetMessage.asp";}
	}
	else{
		switch(obj){
			case "fax":
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://fax.ufo007.com/transfer.asp%3ffaxTarget=l%26lang=cn","popwindowsc");
				break;
			case "myufo007":
				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 "recreation":
				window.open("/8Hall/Menu.asp","popwindowsc");
				break;
			case "sms":
				$("popwindows").style.width = "666px";
				$("popwindows").style.height = "385px";
				$("popwindowsc").style.height=isIE()?'97%':'370px';
				//$('refresh_').src ='';
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://www.ufo007.com/sms_chat/chat/","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":
				window.open("/Common/Users/Login/?Action=Transfer&Path=http://uzone.cn.ufo007.com/lefthome/%3fh=home","popwindowsc");
				break;
			case "fnews":
				$("popwindows").style.width = "606px";
				$("popwindows").style.height = "498px";
				$("popwindowsc").style.height=isIE()?'97%':'498px';
				window.open("/index/news/mininews/mininews.asp?ufoWindow=News","popwindowsc");
				break;
			default:
				window.open(obj, "popwindowsc");
				break;
		}
	}
}

function displayDiv(o){$(o).style.display=='none'?$(o).style.display='':$(o).style.display='none';}

//跳转
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function checkform(form){
	if(!form){return false;}
	var un = form.elements("LoginName");
	if(!un){
		alert("页面错误，请刷新重试。");
		return false;
	}
	if(un.value=="" || un.value=="填写用户名"){
		alert("填写用户名");
		un.focus();
		return false;
	}
	pwd = form.elements("password");
	if(!pwd){
		alert("页面错误，请刷新重试。");
		return false;
	}
	if(pwd.value==""){
		alert("填写密码");
		pwd.focus();
		return false;
	}
}

//预载
function them(){
	var cssURL = new Array("036","fc3","0c0","c69","f00","60f","cf0","066","9c0","966","3cf","336","000","f3c","09c","c00","style");
	for(var c=0;c<cssURL.length;c++){
		$("theme").styleSheet.addImport("/index/bpm/inc/"+cssURL[c]+".css");
	}
}
if($("theme")) them();
//背景色
function _bg(obj,s){
	var sL=s.parentNode.getElementsByTagName("a");
	for(var i=0;i<sL.length;i++){sL[i].className="";}
	switch(obj){
		case ""+obj+"":
			$("_bg").href = "inc/"+obj+".css";
			s.className = "_"+obj+"";
			setCookie("cn_ufo007_bpm",""+obj+"");
			break;

		default:
			$("_bg").href = "_inc/036.css";
			s.className = "_036";
			setCookie("cn_ufo007_bpm","036");
			break;
	}
	slectbg();
}

function slectbg(){	$("bgcolor").style.display == 'none'?$("bgcolor").style.display = '':$("bgcolor").style.display = 'none';}


function getCookie(sName){
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++){
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0])	return unescape(aCrumb[1]);
	}
	return null;
}
function setCookie(sName, sValue){
	date = new Date();
	date.setMonth(date.getMonth() + 12);//12个月失效
	document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString()+"; path=/";
}

function iframeheight(obj){
	var initHeight = isIE()?window.frames[obj].document.body.offsetHeight :window.frames[obj].document.documentElement.offsetHeight ;
	$(obj).style.height = initHeight+"px"
}