function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',menubars=no,toolbars=no,resizable=yes'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

window.onload=show;

function show(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='none';
		}
	}
	if (d) {d.style.display='block';}
}

function DoHide(id,button){

	if(document.getElementById(id).style.display=='block'){
		document.getElementById(id).style.display='none';
		document.getElementById(button).innerHTML="show";
	}else{
		document.getElementById(id).style.display='block';
		document.getElementById(button).innerHTML="hide";
	}
}

function popimage(imagesrc,winwidth,winheight)
{
var look='width='+winwidth+',height='+winheight+','
popwin=window.open("","",look)
popwin.document.open()
popwin.document.write('<title>Image Window</title><body topmargin=0 leftmargin=0><img onclick="self.close()" src="'+imagesrc+'"></body>')
popwin.document.close()
}

function checkValidation_becomepartner ()
	{
		var chkDot = true;
		var usEmail = true;
		//this function is used to check the e-mail address, and it must have "@", ".", and the domain name "com"
   		function validEmail(eAddr)
   		{
      			var lenSuffix = (usEmail) ? 4 : 3;
      			var result = false;
      			var ndxAt = ndxDot =  0;

      			ndxAt  = eAddr.indexOf("@");
      			ndxDot = eAddr.indexOf(".") ;
      			ndxDot2 = eAddr.lastIndexOf(".") ;

      			if ((ndxDot < 0) || (ndxAt < 0))
         			alert("Your email address lacks '.' or '@'.");
         		else if ( (ndxDot2 - 3) <= ndxAt)
         			alert("You may be missing your domain name.");
      			else
           			result=true;
          		return result;
   		}

   		var valid = true;
	    	var msg = "";
	    	//check whether some fields are empty, and give a warning msg
	    	if (document.BecomePartner.firstName.value == "")   {
	        	msg += "Please enter your First Name.\n" ;
	        	valid =  false ;
	    	}
	    	if (document.BecomePartner.lastName.value == "") {
	        	msg += "Please enter your Last Name.\n" ;
	        	valid =  false ;
	    	}
	    	if (document.BecomePartner.compName.value == "") {
	        	msg += "Please enter your Company Name.\n" ;
	        	valid =  false ;
	    	}
	     	if (document.BecomePartner.jobTitle.value == "") {
	        	msg += "Please enter your Job Title.\n" ;
	        	valid =  false ;
	    	}
	    	if (document.BecomePartner.phoneNo.value == "") {
	        	msg += "Please enter your Phone Number.\n" ;
	        	valid =  false ;
	    	}
	    	if (document.BecomePartner.eMail.value == "") {
	        	msg += "Please enter your Email Address.\n" ;
	        	valid =  false ;
	    	}
	    	else if (!(validEmail(document.BecomePartner.eMail.value))){
	        	valid =  false ;
	    	}

	    	if (!(valid)) {
	   		if (!(msg=="" ))
	   		alert(msg);
	   	}
	return valid ;
	}


	function checkValidation_reseller ()
		{
			var chkDot = true;
			var usEmail = true;
			//this function is used to check the e-mail address, and it must have "@", ".", and the domain name "com"
	   		function validEmail(eAddr)
	   		{
	      			var lenSuffix = (usEmail) ? 4 : 3;
	      			var result = false;
	      			var ndxAt = ndxDot =  0;

	      			ndxAt  = eAddr.indexOf("@");
	      			ndxDot = eAddr.indexOf(".") ;
	      			ndxDot2 = eAddr.lastIndexOf(".") ;

	      			if ((ndxDot < 0) || (ndxAt < 0))
	         			alert("Your email address lacks '.' or '@'.");
	         		else if ( (ndxDot2 - 3) <= ndxAt)
	         			alert("You may be missing your domain name.");
	      			else
	           			result=true;
	          		return result;
	   		}

	   		var valid = true;
		    	var msg = "";
		    	//check whether some fields are empty, and give a warning msg
		    	if (document.resellerLocate.firstName.value == "")   {
		        	msg += "Please enter your First Name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.resellerLocate.lastName.value == "") {
		        	msg += "Please enter your Last Name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.resellerLocate.compName.value == "") {
		        	msg += "Please enter your Company Name.\n" ;
		        	valid =  false ;
		    	}
		     	if (document.resellerLocate.jobTitle.value == "") {
		        	msg += "Please enter your Job Title.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.resellerLocate.phoneNo.value == "") {
		        	msg += "Please enter your Phone Number.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.resellerLocate.eMail.value == "") {
		        	msg += "Please enter your Email Address.\n" ;
		        	valid =  false ;
		    	}
		    	else if (!(validEmail(document.resellerLocate.eMail.value))){
		        	valid =  false ;
		    	}

		    	if (!(valid)) {
		   		if (!(msg=="" ))
		   		alert(msg);
		   	}
		return valid ;
		}




	function Disable_keyapply(aList)
	{
	var x=document.getElementById("IMCInstall")
	var y=document.getElementById("IMCMode")
	var z=document.getElementById("IMCMAC")

	x.disabled=!(aList.selectedIndex == 0);
	y.disabled=!(aList.selectedIndex == 0);
	z.disabled=!(aList.selectedIndex == 0);
	}
	function init()
	{
	document.getElementById("requestKey").selectedIndex=0;
	}

	function checkValidation_keyapply ()
		{
			var x=document.getElementById("IMCInstall")
			var y=document.getElementById("IMCMode")
			var z=document.getElementById("IMCMAC")

			var chkDot = true;
			var usEmail = true;
			//this function is used to check the e-mail address, and it must have "@", ".", and the domain name "com"
	   		function validEmail(eAddr)
	   		{
	      			var lenSuffix = (usEmail) ? 4 : 3;
	      			var result = false;
	      			var ndxAt = ndxDot =  0;

	      			ndxAt  = eAddr.indexOf("@");
	      			ndxDot = eAddr.indexOf(".") ;
	      			ndxDot2 = eAddr.lastIndexOf(".") ;

	      			if ((ndxDot < 0) || (ndxAt < 0))
	         			alert("Your email address lacks '.' or '@'.");
	         		else if ( (ndxDot2 - 3) <= ndxAt)
	         			alert("You may be missing your domain name.");
	      			else
	           			result=true;
	          		return result;
	   		}

	   		var valid = true;
		    	var msg = "";
		    	//check whether some fields are empty, and give a warning msg
		    	if (document.KeyApply.compName.value == "")   {
		        	msg += "Please enter the company name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.compAddr.value == "") {
		        	msg += "Please enter the company address.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.compTel.value == "") {
		        	msg += "Please enter the company telephone number.\n" ;
		        	valid =  false ;
		    	}
		     	if (document.KeyApply.compWebsite.value == "") {
		        	msg += "Please enter company website.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.contactName.value == "") {
		        	msg += "Please enter the contact name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.contactMail.value == "") {
		        	msg += "Please enter the contact email address.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.sellerName.value == "") {
		        	msg += "Please enter the reseller name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.prodMode.value == "") {
		        	msg += "Please enter the product model.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.serialNo.value == "") {
		        	msg += "Please enter the serial number.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.MACAddr.value == "") {
		        	msg += "Please enter the product MAC address.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.Warranty.value == "") {
		        	msg += "Please enter the warranty year.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.KeyApply.invoiceDate.value == "") {
		        	msg += "Please enter the invoice/ship date.\n" ;
		        	valid =  false ;
		    	}
			if (!y.disabled && document.KeyApply.IMCMode.value == "") {
			        msg += "Please enter the IMC Model.\n" ;
			        valid =  false ;
			}

			if (!z.disabled && document.KeyApply.IMCMAC.value == "") {
			        msg += "Please enter the IMC MAC address.\n" ;
			        valid =  false ;
			}

		    	else if (!(validEmail(document.KeyApply.contactMail.value))){
		        	valid =  false ;
		    	}



		    	if (!(valid)) {
		   		if (!(msg=="" ))
		   		alert(msg);
		   	}
		return valid ;
	}


	function checkValidation_contactsales ()
		{
			var chkDot = true;
			var usEmail = true;
			//this function is used to check the e-mail address, and it must have "@", ".", and the domain name "com"
	   		function validEmail(eAddr)
	   		{
	      			var lenSuffix = (usEmail) ? 4 : 3;
	      			var result = false;
	      			var ndxAt = ndxDot =  0;

	      			ndxAt  = eAddr.indexOf("@");
	      			ndxDot = eAddr.indexOf(".") ;
	      			ndxDot2 = eAddr.lastIndexOf(".") ;

	      			if ((ndxDot < 0) || (ndxAt < 0))
	         			alert("Your email address lacks '.' or '@'.");
	         		else if ( (ndxDot2 - 3) <= ndxAt)
	         			alert("You may be missing your domain name.");
	      			else
	           			result=true;
	          		return result;
	   		}

	   		var valid = true;
		    	var msg = "";
		    	//check whether some fields are empty, and give a warning msg
		    	if (document.SalesRequest.firstName.value == "")   {
		        	msg += "Please enter your First Name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.SalesRequest.lastName.value == "") {
		        	msg += "Please enter your Last Name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.SalesRequest.compName.value == "") {
		        	msg += "Please enter your Company Name.\n" ;
		        	valid =  false ;
		    	}
		     	if (document.SalesRequest.jobTitle.value == "") {
		        	msg += "Please enter your Job Title.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.SalesRequest.phoneNo.value == "") {
		        	msg += "Please enter your Phone Number.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.SalesRequest.eMail.value == "") {
		        	msg += "Please enter your Email Address.\n" ;
		        	valid =  false ;
		    	}
		    	else if (!(validEmail(document.SalesRequest.eMail.value))){
		        	valid =  false ;
		    	}

		    	if (!(valid)) {
		   		if (!(msg=="" ))
		   		alert(msg);
		   	}
		return valid ;
	}



	function checkValidation_contactprodinfo ()
		{

			var chkDot = true;
			var usEmail = true;

			//this function is used to check the e-mail address, and it must have "@", ".", and the domain name "com"

	   		function validEmail(eAddr)
	   		{
	      			var lenSuffix = (usEmail) ? 4 : 3;
	      			var result = false;
	      			var ndxAt = ndxDot =  0;

	      			ndxAt  = eAddr.indexOf("@");
	      			ndxDot = eAddr.indexOf(".") ;
	      			ndxDot2 = eAddr.lastIndexOf(".") ;

	      			if ((ndxDot < 0) || (ndxAt < 0))
	         			alert("Your email address lacks '.' or '@'.");
	         		else if ( (ndxDot2 - 3) <= ndxAt)
	         			alert("You may be missing your domain name.");
	      			else
	           			result=true;
	          		return result;
	   		}

	   		var valid = true;
		    	var msg = "";


		    	//check whether some fields are empty, and give a warning msg

		    	if (document.ProdInfoRequest.firstName.value == "")   {
		        	msg += "Please enter your First Name.\n" ;
		        	valid =  false ;
		    	}

		    	if (document.ProdInfoRequest.lastName.value == "") {
		        	msg += "Please enter your Last Name.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.ProdInfoRequest.compName.value == "") {
		        	msg += "Please enter your Company Name.\n" ;
		        	valid =  false ;
		    	}
		     	if (document.ProdInfoRequest.jobTitle.value == "") {
		        	msg += "Please enter your Job Title.\n" ;
		        	valid =  false ;
		    	}
		    	if (document.ProdInfoRequest.phoneNo.value == "") {
		        	msg += "Please enter your Phone Number.\n" ;
		        	valid =  false ;
		    	}
		    	else if (document.ProdInfoRequest.eMail.value == "") {
		        	msg += "Please enter your Email Address.\n" ;
		        	valid =  false ;
		    	}
		    	else if (!(validEmail(document.ProdInfoRequest.eMail.value))){
		        	valid =  false ;
		    	}

		    	if (!(valid)) {
		   		if (!(msg=="" ))
		   		alert(msg);
		   	}
		return valid ;
	}