//导航菜单
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// JavaScript Document//写cookies函数 作者：翟振?
function SetCookie(name,value)//两个参数，一个是cookie的名子，一个是?
{
    var Days = 1; //?cookie 将被保存 30 ?
    var exp  = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)//删除cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

//弹出菜单
function changeto(highlightcolor){
source=event.srcElement
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD")
source=source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
alert
source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if (event.toElement!=source)
source.style.backgroundColor=originalcolor
}
function show()
{
var rng=document.body.createTextRange();
}

function topturnit(ss)
{
topcloseall();
ss.style.display="block";
}
function topcloseall()
{
topcloseit(tmenu1); 
topcloseit(tmenu2); 
topcloseit(tmenu3);
//topcloseit(tmenu4);
//topcloseit(tmenu5);
//topcloseit(tmenu6);
}
function topcloseit(ss)
{
    ss.style.display="none";
}
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
imgmenu = eval("imgmenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
imgmenu.src="images/ico03.jpg";
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
imgmenu.src="images/ico02.jpg";
}
}

//顶部用户登陆

		function top_Checkmyform()
		{		
		if(top_myform.UserName.value=="")
		{
		alert("Please enter E-Mail Address");
		top_myform.UserName.focus();
		return false;
		}
		if(top_myform.PassWord.value=="")
		{
		alert("Please enter PassWord");
		top_myform.PassWord.focus();
		return false;
		}			
		}
//用户注册页面
function check1()
{
	if(form1.email.value=="")
		{
		alert("Please fill out the contact e-mail!");
		form1.email.focus();
		return false;
		}
	if (form1.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
  		{
   		alert("Email format is not right!"); 
   		form1.email.focus();
   		return false;
   		}
	if(form1.password.value=="")
		{
		alert("Please fill in the user's password!");
		form1.password.focus();
		return false;
		}
	if(form1.password.value!=form1.repassword.value)
		{
		alert("Please fill in the confirmation password is incorrect!");
		form1.repassword.focus();
		return false;
		}
	if(form1.name.value=="")
		{
		alert("Please fill in contact real name!");
		form1.name.focus();
		return false;
		}	
	if(form1.CompanyID.value=="")
		{
		alert("Please fill in company name!");
		form1.CompanyID.focus();
		return false;
		}
	if(form1.memberID.value=="")
		{
		alert("Please fill in user name!");
		form1.memberID.focus();
		return false;
		}
	
	/*if(form1.question.value=="")
		{
		alert("Please fill in the password hint question!");
		form1.question.focus();
		return false;
		}
	if(form1.answer.value=="")
		{
		alert("Please fill in the password hint question answer!");
		form1.answer.focus();
		return false;
		}
	
	if(form1.phone.value=="")
		{
		alert("Please fill in contact phone!");
		form1.phone.focus();
		return false;
		}
	
	if(form1.address.value=="")
		{
		alert("Please fill out the contact address!");
		form1.address.focus();
		return false;
		}*/
		
	return true;
}
function RTreset()
{
	form1.reset();	
}
//用户登陆
function Checkmyform()
		{		
		if(myform.UserName.value=="")
		{
		alert("Please enter E-Mail Address");
		myform.UserName.focus();
		return false;
		}
		if(myform.PassWord.value=="")
		{
		alert("Please enter PassWord");
		myform.PassWord.focus();
		return false;
		}			
		}
//Feedbacl
function check()
{
	if(form1.name.value=="")
		{
		alert("Please fill in the names of!");
		form1.name.focus();
		return false;
		}
	if(form1.address.value=="")
		{
		alert("Please fill out the contact address!");
		form1.address.focus();
		return false;
		}
	if(form1.email.value=="")
		{
		alert("Please fill out the email!");
		form1.email.focus();
		return false;
		}	
		
	if(form1.phone.value=="")
		{
		alert("Please fill in contact phone !");
		form1.phone.focus();
		return false;
		}
		
	return true;
}