//=========== Search Validations for index page =============================//
function searchValidation(){
if((document.frmSearch.txtKeywordsSearch.value=='' || document.frmSearch.txtKeywordsSearch.value=='Enter Job Title') && document.frmSearch.cmbLocationsSearch.selectedIndex==0){
	alert("Please enter Job Title or Location for search.");
	return false;
 }
return true;
}
//=====================================================================//
//===========Submiting the form for paging ============================//
	function submitPaging(frm,page)
	{
		document.frmPaging.pageNo.value = page;
		document.frmPaging.submit();
	}
//======================================================================//

//=========== Validations for ContactUs page =============================//
function submitContactUsForm(){
	 var regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.frmContactUs.email.value;
	 var phone = document.frmContactUs.phone.value;
			if(document.frmContactUs.name.value==""){
				alert("Please enter Name..");
				document.frmContactUs.name.focus();
				return false;
			}else if(document.frmContactUs.email.value==""){
				alert("Please enter email..");
				document.frmContactUs.email.focus();
				return false;
			}else if(regEmail.test(address) == false){
				alert('Invalid Email Address');
				document.frmContactUs.email.focus();
				return false;
			}else if(document.frmContactUs.phone.value =="") {
				alert("Please enter Phone Number.");
				document.frmContactUs.phone.focus();
				return false;
			}else if(Validate(document.frmContactUs.phone.value,"[^0-9+\\-\\+\\(\\)\\ ]") == true) {
				alert("Please enter valid Phone Number. Only digits and +,- and ( ) are allowed.");
				document.frmContactUs.phone.focus();
				return false;
			}else if(document.frmContactUs.mobile.value =="") {
				alert("Please enter Mobile Number.");
				document.frmContactUs.mobile.focus();
				return false;
			}else if(Validate(document.frmContactUs.mobile.value,"[^0-9+\\-\\+\\(\\)\\ ]") == true) {
				alert("Please enter valid Mobile Number. Only digits and +,- and ( ) are allowed.");
				document.frmContactUs.mobile.focus();
				return false;
			}else if(document.frmContactUs.address.value==""){
				alert("Please enter Address..");
				document.frmContactUs.address.focus();
				return false;
			}else if(document.frmContactUs.city.value==""){
				alert("Please enter City..");
				document.frmContactUs.city.focus();
				return false;
			}else if(document.frmContactUs.country.selectedIndex==0){
				alert("Please select Country..");
				document.frmContactUs.country.focus();
				return false;
			}else if(document.frmContactUs.inquiry.value==""){
				alert("Please enter your Inquiry..");
				document.frmContactUs.inquiry.focus();
				return false;			
			}else{
				document.frmContactUs.sendEmail.value="1";
				document.frmContactUs.submit();
			}	
		return false;
}	
//======================================================================//
//=========== Validations for Vacancies page =============================//
function submitVacanciesForm(){
	 var regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.frmContactUs.email.value;
	 var phone = document.frmContactUs.phone.value;
			if(document.frmContactUs.name.value==""){
				alert("Please enter Name..");
				document.frmContactUs.name.focus();
				return false;
			}else if(document.frmContactUs.email.value==""){
				alert("Please enter email..");
				document.frmContactUs.email.focus();
				return false;
			}else if(regEmail.test(address) == false){
				alert('Invalid Email Address');
				document.frmContactUs.email.focus();
				return false;
			}else if(document.frmContactUs.phone.value =="") {
				alert("Please enter Phone Number.");
				document.frmContactUs.phone.focus();
				return false;
			}else if(Validate(document.frmContactUs.phone.value,"[^0-9+\\-\\+\\(\\)\\ ]") == true) {
				alert("Please enter valid Phone Number. Only digits and +,- and ( ) are allowed.");
				document.frmContactUs.phone.focus();
				return false;
			}else if(document.frmContactUs.mobile.value =="") {
				alert("Please enter Mobile Number.");
				document.frmContactUs.mobile.focus();
				return false;
			}else if(Validate(document.frmContactUs.mobile.value,"[^0-9+\\-\\+\\(\\)\\ ]") == true) {
				alert("Please enter valid Mobile Number. Only digits and +,- and ( ) are allowed.");
				document.frmContactUs.mobile.focus();
				return false;
			}else if(document.frmContactUs.address.value==""){
				alert("Please enter Address..");
				document.frmContactUs.address.focus();
				return false;
			}else if(document.frmContactUs.city.value==""){
				alert("Please enter City..");
				document.frmContactUs.city.focus();
				return false;
			}else if(document.frmContactUs.country.selectedIndex==0){
				alert("Please Select Country..");
				document.frmContactUs.country.focus();
				return false;
			}else if(document.frmContactUs.inquiry.value==""){
				alert("Please Enter Your Inquiry..");
				document.frmContactUs.inquiry.focus();
				return false;			
			}else if(document.frmContactUs.cv.value==""){
				alert("Please attatch cv..");
				document.frmContactUs.cv.focus();
				return false;			
			}else{
				document.frmContactUs.sendEmail.value="1";
				document.frmContactUs.submit();
			}	
		return false;
}	
//======================================================================//


function Validate(strToValidate,RegPattern)
{
	var expr = new RegExp(RegPattern);
	var result = expr.test(strToValidate);
	if(result==true){
		return true;
	}else{
		return false;
	}
}
//=======================================================================//
function loginValidate()
	{
			if(document.getElementById("txtcanUsername").value == ""){
					alert("Please enter username.");
					document.getElementById("txtcanUsername").focus();
					return false;
			}
			if(Validate(document.getElementById("txtcanUsername").value,"[^A-Za-z0-9\\ ]") == true){
				 alert("Please enter valid username.");
				 document.getElementById("txtcanUsername").focus();
				 return false;
			}
			if(document.getElementById("txtcanPassword").value == ""){
				alert("Please enter Password");	
				document.getElementById("txtcanPassword").focus();
				return false;
			}	
			return true;
	}