function check_profilecv(frm){
	if(frm.user_Gender.value==""){
		alert('Please select gender');
		frm.user_Gender.focus();
		return false;
	}
	if(frm.user_DOB.value==""){
		alert('Please select DOB');
		frm.user_DOB.focus();
		return false;
	}
	if(frm.user_Qualification_Id.value==""){
		alert('Please select education level');
		frm.user_Qualification_Id.focus();
		return false;
	}
	if(frm.user_Experience.value==""){
		alert('Please enter professional experience');
		frm.user_Experience.focus();
		return false;
	}
	if(frm.user_Designation_Id.value==""){
		alert('Please select career level');
		frm.user_Designation_Id.focus();
		return false;
	}
}
function maskZIPandPhone(abc){
	if(abc){
		$("#listing_Zip").unmask();
		$("#listing_Phone").unmask();
		$("#listing_Fax").unmask();
		$("#listing_Zip").mask("***-***");
		$("#listing_Phone").mask("999-999-9999");
		$("#listing_Fax").mask("999-999-9999");
	}else{
		$("#listing_Zip").unmask();
		$("#listing_Phone").unmask();
		$("#listing_Fax").unmask();
	}
}
function check_apply(frm){
	if(frm.resume_Fname.value==""){
		alert('Please enter first name');
		frm.resume_Fname.focus();
		return false;
	}
	if(frm.resume_Lname.value==""){
		alert('Please enter last name');
		frm.resume_Lname.focus();
		return false;
	}
	if(frm.resume_Address1.value==""){
		alert('Please enter address1');
		frm.resume_Address1.focus();
		return false;
	}
	if(frm.resume_City.value==""){
		alert('Please enter city');
		frm.resume_City.focus();
		return false;
	}
	if(frm.resume_State.value==""){
		alert('Please enter province / state');
		frm.resume_State.focus();
		return false;
	}
	if(frm.resume_Country.value==""){
		alert('Please select country');
		frm.resume_Country.focus();
		return false;
	}
	if(frm.resume_Email.value==""){
		alert('Please enter email address');
		frm.resume_Email.focus();
		return false;
	}else{
		if(!emailCheck(frm.resume_Email.value)){
			alert('Please enter valid email address');
			frm.resume_Email.focus();
			return false;				
		}			
	}
	if(frm.resume_Resume.value==""){
		alert('Please upload your resume');
		frm.resume_Resume.focus();
		return false;
	}
	if(frm.code.value==""){
		alert('Please fill captcha code');
		frm.code.focus();
		return false;
	}
}
function check_job(frm){
	if(frm.job_Listing_Id.value==""){
		alert('Please select listing');
		frm.job_Listing_Id.focus();
		return false;
	}
	if(frm.job_Date.value==""){
		alert('Please enter job date');
		frm.job_Date.focus();
		return false;
	}
	if(frm.job_Designation_Id.value==""){
		alert('Please select designation');
		frm.job_Designation_Id.focus();
		return false;
	}
	if(frm.job_Subject.value==""){
		alert('Please enter subject');
		frm.job_Subject.focus();
		return false;
	}
	if(frm.job_Description.value==""){
		alert('Please enter job description');
		frm.job_Description.focus();
		return false;
	}
	if(frm.job_Contact_Email.value==""){
		alert('Please enter contact email');
		frm.job_Contact_Email.focus();
		return false;
	}
	if(frm.job_Deadline_Date.value==""){
		alert('Please enter job deadline date');
		frm.job_Deadline_Date.focus();
		return false;
	}
	if(frm.job_Remarks.value==""){
		alert('Please select remarks');
		frm.job_Remarks.focus();
		return false;
	}
}
function check_topsearch(frm){
	if((frm.crt.value=="" || frm.crt.value=="Find a Company ...") && frm.cid.value=="" && frm.countryid.value==""){
		alert('Please enter some criteria to search');
		return false;
	}
}
function check_brochure(frm){
	
}
function check_refer(frm){
	/*if(frm.name.value=="")
	{
		alert('Please enter your name');
		frm.name.focus();
		return false;
	}
	if(frm.email.value==""){
		alert('Please enter your email address');
		frm.email.focus();
		return false;
	}else{
		if(!emailCheck(frm.email.value)){
			alert('Your entered email address seems to be incorrect');
			frm.email.focus();
			return false;				
		}			
	}
	if(frm.fname.value=="")
	{
		alert('Please enter your friend name');
		frm.fname.focus();
		return false;
	}
	if(frm.femail.value==""){
		alert('Please enter your friend email address');
		frm.femail.focus();
		return false;
	}else{
		if(!emailCheck(frm.femail.value)){
			alert('Your entered email address seems to be incorrect');
			frm.femail.focus();
			return false;				
		}			
	}*/
	if(frm.code.value==""){
		alert('Please enter security code as you see in image');
		frm.code.focus();
		return false;		
	}
}
function check_seo(frm){
	if(frm.id.value==""){
		alert('Please select listing');
		frm.id.focus();
		return false;		
	}	
}
function check_step5(frm){

}
function check_step4(frm){

}
function check_step3(frm){
	if(frm.listing_Address1.value==""){
		alert('Please enter address1');
		frm.listing_Address1.focus();
		return false;		
	}	
	if(frm.listing_Phone.value==""){
		alert('Please enter phone');
		frm.listing_Phone.focus();
		return false;		
	}	
	if(frm.listing_Email.value==""){
		alert('Please enter email address');
		frm.listing_Email.focus();
		return false;
	}else{
		if(!emailCheck(frm.listing_Email.value)){
			alert('Please enter valid email address');
			frm.listing_Email.focus();
			return false;				
		}			
	}
}
function check_step2(frm){
	if(frm.listing_Company_Name.value==""){
		alert('Please enter company name');
		frm.listing_Company_Name.focus();
		return false;		
	}	
	if(frm.listing_Location_Type.value==""){
		alert('Please select location type');
		frm.listing_Location_Type.focus();
		return false;		
	}	
	if(frm.listing_Ownership.value==""){
		alert('Please select ownership');
		frm.listing_Ownership.focus();
		return false;		
	}	
	if(frm.listing_Employees.value==""){
		alert('Please select number of employees');
		frm.listing_Employees.focus();
		return false;		
	}	
	if(frm.listing_Revenue.value==""){
		alert('Please select company revenue');
		frm.listing_Revenue.focus();
		return false;		
	}	
	if(frm.listing_Start_Date.value==""){
		alert('Please enter start date');
		frm.listing_Start_Date.focus();
		return false;		
	}	
}
function check_step1(frm){
	if(frm.listing_Country.value==""){
		alert('Please select country');
		frm.listing_Country.focus();
		return false;		
	}	
	if(frm.listing_State.value==""){
		alert('Please enter state');
		frm.listing_State.focus();
		return false;		
	}	
	if(frm.listing_City.value==""){
		alert('Please enter city');
		frm.listing_City.focus();
		return false;		
	}	
	if(frm.listing_Type_Id.value==""){
		alert('Please select type');
		frm.listing_Type_Id.focus();
		return false;		
	}	
	if(frm.listing_Category_Pid1.value==""){
		alert('Please select preferred directory');
		frm.listing_Category_Pid1.focus();
		return false;		
	}	
	if(frm.listing_Category_Id1.value==""){
		alert('Please select preferred directory');
		frm.listing_Category_Id1.focus();
		return false;		
	}	
	/*var tmp = $('#listing_Category').val().toString(); 
	var arr = tmp.split(',');
	if(arr.length>3){
		alert('select maximum 3 directories');
		return false;
	}*/
}
function check_listing(frm){
	if(frm.listing_Type_Id.value==""){
		alert('Please select type');
		frm.listing_Type_Id.focus();
		return false;		
	}	
	if(frm.listing_Category_Pid1.value==""){
		alert('Please select preferred directory');
		frm.listing_Category_Pid1.focus();
		return false;		
	}	
	if(frm.listing_Category_Id1.value==""){
		alert('Please select preferred directory');
		frm.listing_Category_Id1.focus();
		return false;		
	}	
	if(frm.listing_Company_Name.value==""){
		alert('Please enter company name');
		frm.listing_Company_Name.focus();
		return false;		
	}	
	if(frm.listing_Location_Type.value==""){
		alert('Please select location type');
		frm.listing_Location_Type.focus();
		return false;		
	}	
	if(frm.listing_Ownership.value==""){
		alert('Please select ownership');
		frm.listing_Ownership.focus();
		return false;		
	}	
	if(frm.listing_Employees.value==""){
		alert('Please select employees');
		frm.listing_Employees.focus();
		return false;		
	}	
	if(frm.listing_Revenue.value==""){
		alert('Please select revenue');
		frm.listing_Revenue.focus();
		return false;		
	}	
	if(frm.listing_Start_Date.value==""){
		alert('Please enter start date');
		frm.listing_Start_Date.focus();
		return false;		
	}	
	if(frm.listing_Address1.value==""){
		alert('Please enter address');
		frm.listing_Address1.focus();
		return false;		
	}	
	if(frm.listing_City.value==""){
		alert('Please enter city');
		frm.listing_City.focus();
		return false;		
	}	
	if(frm.listing_State.value==""){
		alert('Please enter state / province');
		frm.listing_State.focus();
		return false;		
	}	
	if(frm.listing_Country.value==""){
		alert('Please select country');
		frm.listing_Country.focus();
		return false;		
	}	
	if(frm.listing_Phone.value==""){
		alert('Please enter phone');
		frm.listing_Phone.focus();
		return false;		
	}	
	if(frm.listing_Email.value==""){
		alert('Please enter email address');
		frm.listing_Email.focus();
		return false;
	}else{
		if(!emailCheck(frm.listing_Email.value)){
			alert('Please enter valid email address');
			frm.listing_Email.focus();
			return false;				
		}			
	}
	if(!confirm('Sure to submit now?')){
		return false;
	}
}
function check_giftcert(frm){
	//cmd = document.getElementById("cmd");
	//if(cmd="giftcertificate"){
		if(frm.giftcertificate_Code.value==""){
			alert('Please enter gift certificate code');
			frm.giftcertificate_Code.focus();
			return false;
		}
	//}
}
function check_change(frm){
	if(frm.user_Password_Old.value==""){
		alert('Please enter old password');
		frm.user_Password_Old.focus();
		return false;		
	}	
	if(frm.user_Password.value==""){
		alert('Please enter new password');
		frm.user_Password.focus();
		return false;		
	}	
	if(frm.user_Password2.value==""){
		alert('Please re-type password');
		frm.user_Password2.focus();
		return false;		
	}
	if(frm.user_Password2.value!=frm.user_Password.value){
		alert('Passwords do not match');
		frm.user_Password2.focus();
		return false;			
	}
}
function check_changepassword(frm){
	if(frm.oldpassword.value==""){
		alert('Please enter your old password');
		frm.oldpassword.focus();
		return false;		
	}	
	if(frm.newpassword.value==""){
		alert('Please enter your new password');
		frm.newpassword.focus();
		return false;		
	}	
	if(frm.repeatpassword.value==""){
		alert('Please repeat your password');
		frm.repeatpassword.focus();
		return false;		
	}	
	if(frm.newpassword.value!=frm.repeatpassword.value){
		alert('Password does not match');
		frm.repeatpassword.focus();
		return false;		
	}	
}
function check_profile(frm){
	if(frm.name.value==""){
		alert('Please enter name');
		frm.name.focus();
		return false;		
	}	
	if(frm.country.value==""){
		alert('Please select country');
		frm.country.focus();
		return false;		
	}	
}
function check_forgot(frm){
	if(frm.user_Username.value==""){
		alert('Please enter your username');
		frm.user_Username.focus();
		return false;		
	}	
}
function check_login(frm){
	if(frm.user_Username.value==""){
		alert('Please enter your username');
		frm.user_Username.focus();
		return false;		
	}	
	if(frm.user_Password.value==""){
		alert('Please enter your password');
		frm.user_Password.focus();
		return false;		
	}	
}

function emailCheck (emailStr) {


var checkTLD=1;

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;


var emailPat=/^(.+)@(.+)$/;


var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";


var validChars="\[^\\s" + specialChars + "\]";


var quotedUser="(\"[^\"]*\")";


var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;



var atom=validChars + '+';


var word="(" + atom + "|" + quotedUser + ")";



var userPat=new RegExp("^" + word + "(\\." + word + ")*$");


var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {


//	alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];



for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
//alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
//alert("Ths domain name contains invalid characters.");
return false;
   }
}

if (user.match(userPat)==null) {

//alert("The username doesn't seem to be valid.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
//alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
//alert("The domain name does not seem to be valid.");
return false;
   }
}

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
//alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

if (len<2) {
//alert("This address is missing a hostname!");
return false;
}


return true;
}

/// multi level drop down
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Bobby van der Sluis | http://www.bobbyvandersluis.com/ */
// Details can be found at:
// http://www.bobbyvandersluis.com/articles/unobtrusivedynamicselect.php

function dynamicSelect(id1, id2) {
 	// Feature test to see if there is enough W3C DOM support
 	if (document.getElementById && document.getElementsByTagName) {
  		// Obtain references to both select boxes
  		var sel1 = document.getElementById(id1);
  		var sel2 = document.getElementById(id2);
  		// Clone the dynamic select box
  		var clone = sel2.cloneNode(true);
  		// Obtain references to all cloned options
  		var clonedOptions = clone.getElementsByTagName("option");
  		// Onload init: call a generic function to display the related options in the dynamic select box
  		refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
  		// Onchange of the main select box: call a generic function to display the related options in the dynamic select box
  		if(id1=="member_Country" || id1=="volunteer_Country"){
			sel1.onchange = function() {
				refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
				hideshowpdt(sel1.value);
			};			
		}else{
			sel1.onchange = function() {
				refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
			};
		}
 	}
}

function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
 	// Delete all options of the dynamic select box
 	while (sel2.options.length) {
  		sel2.remove(0);
 	}
	
	// My customized select 10-April-2009
	var new_option = document.createElement('Option');
	new_option.value="";
	new_option.innerHTML="-- Select --";
	sel2.appendChild(new_option);
	//
	
 	// Create regular expression objects for "select" and the value of the selected option of the main select box as class names
 	var pattern1 = /( |^)(select)( |$)/;
 	var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)");
 	// Iterate through all cloned options
 	for (var i = 0; i < clonedOptions.length; i++) {
  		// If the classname of a cloned option either equals "select" or equals the value of the selected option of the main select box
  		if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) {
 	 		 // Clone the option from the hidden option pool and append it to the dynamic select box
  		 	sel2.appendChild(clonedOptions[i].cloneNode(true));
  		}
 	}
}


// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

// addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
//use below code in the file where u want to utilize it
/*addLoadEvent(function() {
dynamicSelect("pda-brand", "pda-type");
});*/

// end multi level drop down
