﻿// JScript File

function validateContactForm(frm) {
	if(!validateCombo(frm.cboTitle))
		return false;
	if(frm.cboTitle[frm.cboTitle.selectedIndex].value=='Others'){ 
		if(!validateBlankField(frm.txtOtherTitle))
			return false;
	}
	if(!validateBlankField(frm.txtFirstName))
		return false;
	if(!validateBlankField(frm.txtLastName))
		return false;
	if(!checkEmail(frm.txtEmail.value)) {
		frm.txtEmail.focus();
		return false;
	}		

	if(!validateBlankField(frm.txtLandlineCode)) 
		return false;	
		
	if(!validateBlankField(frm.txtLandline)) 
		return false;		
			
	
	if(!validateCombo(frm.cboCountry))
		return false;
	if(frm.cboCountry[frm.cboCountry.selectedIndex].value=='United Arab Emirates'){
		if(!validateCombo(frm.cboUAECity))
			return false;
	} else { 
		if(!validateBlankField(frm.txtOtherCity))
			return false;
	}
	if(!validateBlankField(frm.txtComments))
		return false;
		
	frm.hdnAction.value='email_contact_form';	
	return true;	
}

function showOtherField(cbo,spanOthers) {
	var disp = 'none';
	if(cbo[cbo.selectedIndex].value=='Others')
		disp = 'block';
		
	if(spanOthers!='undefined' && spanOthers!=null)	
		document.getElementById(spanOthers).style.display=disp;
}
function popUAECities(cbo) {
	if(cbo[cbo.selectedIndex].value=='United Arab Emirates') {
		document.getElementById('spanOtherCity').style.display='none';
		document.getElementById('spanUAECity').style.display='block';
		document.getElementById('lblEmirate').style.display='block';
		document.getElementById('lblOtherCity').style.display='none';
	} else { 
		document.getElementById('spanOtherCity').style.display='block';
		document.getElementById('spanUAECity').style.display='none';
		document.getElementById('lblEmirate').style.display='none';
		document.getElementById('lblOtherCity').style.display='block';
	}	
}

