// JavaScript Document

function mandatoryContactField(val) {
	if(val == true) {
		document.getElementById('lblSupContact').style.display = "block";
		//document.getElementById('lblContact').style.display = "none";
	} else {
		document.getElementById('lblSupContact').style.display = "none";
		//document.getElementById('lblContact').style.display = "block";
	} 
}

function validation(form) {
	if(form.txtName.value == "") {
		//alert("Error: Name cannot be blank!");
		form.txtName.focus();
		return false;
	}
	
	rel = /^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/;
	if(!rel.test(form.txtEmailID.value)) {
		alert ("Please specify proper email address.");
		form.txtEmailID.focus();
		return false;
	}
	
	if(form.txtCountry.value == "") {
		//alert("Error: Country cannot be blank!");
		form.txtCountry.focus();
		return false;
	}
	
	if(form.txtCity.value == "") {
		//alert("Error: Location cannot be blank!");
		form.txtCity.focus();
		return false;
	}
	
	if(form.optPreferences[0].checked == true && form.txtContactNo.value == "") {
		//alert("Error: Cantact Number cannot be blank!");
		form.txtContactNo.focus();
		return false;
	}
	
	regExp = /^[0-9]{6,15}$/
	if(form.optPreferences[0].checked == true && !regExp.test(form.txtContactNo.value)) {
		alert("Please enter valid contact No.");
		form.txtContactNo.focus();
		return false;
	}
	
	if(form.chkReadPrivacy.checked == false) {
		//alert ("Please check privacy terms and conditions.");
		form.chkReadPrivacy.focus();
		return false;
	}
}
