
function Aover(e) {
	bk=e.style.background;
	e.style.backgroundPosition="0 -70";
}
function Aout(e) {
	e.style.backgroundPosition="0 0";
}

function ChangeLanguage(EE)
{//1:繁體,2:簡體,3:English

	var URL;

	switch(EE.options[EE.selectedIndex].value)
	{
		case "1": URL="/CHT/index.htm";break;
		case "2": URL="/CHS/index.htm";break;
		case "3": URL="/EN/index.htm";break;
	}	
	if (URL=="")
	{
		return false;
	}else 
		document.location=URL;
		//alert(URL);
		
}

function FriendLink(EE) {

	var URL = EE.options[EE.selectedIndex].value; 

	if (URL=="")
	{
		return false;
	}else
		window.open(URL,'','');
}
//--------------------打開新窗口------------------------------------------------
function openwindow(p)
{//1: /images/CompanyImage/address_small.gif
 //2:
	
	var URL;
	var featurelist;
	var width;
	var height;

	if(p=="address_sml"){
		URL="image/address.jpg";
		width=780;
		height=600;		
	}
	else if(p=="iso_sml"){
		URL="image/iso_big.jpg";
		width=600;
		height=540;		
	}	
	//---------------設備圖片-------------------------------
	else if(p=="dvc_1_sml") {
		URL="image/dvc_1_big.jpg";
		width=780;
		height=540;
	}

	//-------------------實際打開窗口的代碼---------------------------
	featurelist="toolbar=no,status=no,menubar=no,resizable=1,width="+width+",height="+height+",scrollbars=yes";	
	window.open(URL,'',featurelist);
}


var testresults
function validate(form)
{

	var counter=0;
	var msg="Please fill in the following fields :\n\n";
	
	if(form.company.value == "")
	{
		counter=1;
		msg=msg + "    Your Company" + "\n";
	}
	if(form.name.value == "")
	{
		counter=1;
		msg=msg + "    Your Name" + "\n";
	}
	
	if(form.email.value == "") 
	{
		counter=1;
		msg=msg + "    Email" + "\n";
	}
	
	if(form.phone.value == "")
	{
		counter=1;
		msg=msg + "    Your Phone Number" + "\n";
	}


	if(counter==1)
	{
		alert(msg);
		return false;
	}


	else
	{
		return checkemail(form);
	}

}


function checkemail(form)
{
	var str=form.email.value
	var filter=/^.+@.+\..{2,3}$/
	
	if (filter.test(str))
	{
		testresults=true
	}
	
	else
	{
		alert("Please input a valid email address!")
		testresults=false
	}
	
	return (testresults)
}
