
function MOver(obj, image) {
	try {
		obj.src = image;
	} catch (e) { }
}
function MOut(obj, image) {
	try {
		obj.src = image;
	} catch (e) { }
}

function searchProduct() {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.form;
	}
	else {
		theform = document.forms["form"];
	}
	theform.action = 'Search.aspx';
	//theform.method = 'GET';
	theform.submit();
}

function searchProductThai() {
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.form;
	}
	else {
		theform = document.forms["form"];
	}
	theform.action = 'Searchth.aspx';
	//theform.method = 'GET';
	theform.submit();
}


	function trim(str)
	{
		return str.replace(/^\s*|\s*$/g,"");
	}
			
   function chkBeforeSendMail(){
         
		if(trim(document.forms[0].txtName.value)=="")
		{
			alert("Please insert Name");
			document.forms[0].txtName.focus();
			return false;
		}		

  		if(trim(document.forms[0].txtEmail.value)=="")
		{
			alert("Please insert YourEmail");
			document.forms[0].txtEmail.focus();
			return false;
		}else
		{
			if (document.layers||document.getElementById||document.all)
			if(checkemail()){  
			}else {
			document.forms[0].txtEmail.focus();
			return false;
			}
		}
	
	  	if(trim(document.forms[0].txtSubject.value)=="")
		{
			alert("Please insert Subject");
			document.forms[0].txtSubject.focus();
			return false;
		}
		
		if(trim(document.forms[0].txtMessage.value)=="")
		{
			alert("Please insert Message");
			document.forms[0].txtMessage.focus();
			return false;
		}	
   }
   
   
   //Check Email
	var testresults
	function checkemail(){
	var str=document.forms[0].txtEmail.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str))
	testresults=true
	else{
	alert("Please input a valid email address")
	testresults=false
	}
	return (testresults)
	}

	function checkbae(){
	if (document.layers||document.getElementById||document.all)
	return checkemail()
	else
	return true
	}


