function swapMenu(menuB,menuDiv){
	if(!('block'==document.getElementById(menuDiv).style.display)){
		document.getElementById(menuDiv).style.display='block';
		menuB.innerHTML=menuB.innerHTML.replace('rightbutton','downbutton');
	}else{
		document.getElementById(menuDiv).style.display='none';	
		menuB.innerHTML=menuB.innerHTML.replace('downbutton','rightbutton');
	}
	
}

function checkForm() {
	var theForm=document.getElementById('enquiryForm');
	if(theForm.customerName.value=='name'||theForm.customerName.value.length<2){
		alert('Please input correct name.');
		return false;
	}
	if(theForm.customerEmail.value=='email'||theForm.customerEmail.value.length<2){
		alert('Please input correct email.');
		return false;
	}

	
	document.getElementById('enquireDiv').style.display='none'; 
	document.getElementById('thankDiv').style.display='block';
     return true;
} 

function checkForm2() {  
	var theForm=document.getElementById('enquiryForm2');
	if(theForm.customerName.value=='name'||theForm.customerName.value.length<2){
		alert('Please input correct name.');
		return false;
	}
	if(theForm.customerEmail.value=='email'||theForm.customerEmail.value.length<2){
		alert('Please input correct email.');
		return false;
	}

	
	document.getElementById('enquireDiv2').style.display='none'; 
	document.getElementById('thankDiv2').style.display='block';
     return true;
}

function checkEmail() {
	var email=document.getElementById('email').value;;
	if(email=='email'||email.length<4){
		alert('Please input correct email.');
		return false;
	}

	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(email))) { 
	       error = "Please enter a valid email address.\n";
		alert(error);
		return false;
	}
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (email.match(illegalChars)) {
	   error = "The email address contains illegal characters.\n";
		alert(error+'Please enter valid email address.');
	return false;		
	}
	
	document.getElementById('enquireDiv').style.display='none'; 
	document.getElementById('thankDiv').style.display='block';
     return true;
}       
