function emptyValidation(fieldList) {
	
		var field=new Array();
		field=fieldList.split("~");
		var counter=0;
		for(i=0;i<field.length;i++) {
			if(document.getElementById(field[i]).value=="" || document.getElementById(field[i]).value == "XNAX") {
				document.getElementById(field[i]+'-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
				counter++;
			} else {
				document.getElementById(field[i]+'-l').innerHTML="";
				
			}
		}
		if(counter>0) {
			alert('Please populate the required fields.');
			return false;				
		}  else {
			return true;
		}		
		
}

function register()
{
	//ussecurity~employed~searchstatus1~confiresume
	//postres~searchstatus~curemp~industry~careerStatus~experience~workAuth~usclear~educationLevel~edusummary~objstatement~resumetext~travelPercent~dtitle~rolewant~minSalAnnual~salary
	
	//fulltime parttime intern contract permanent
	
	var ussecurity1=document.getElementById("ussecurity1").checked;
	var ussecurity2=document.getElementById("ussecurity2").checked;
	var employed1=document.getElementById("employed1").checked;
	var employed2=document.getElementById("employed2").checked;
	var searchstatus1=document.getElementById("searchstatus1").checked;
	var searchstatus2=document.getElementById("searchstatus2").checked;
	var confiresume1=document.getElementById("confiresume1").checked;
	var confiresume2=document.getElementById("confiresume2").checked;	
	
	var fulltime=document.getElementById("fulltime").checked;
	var parttime=document.getElementById("parttime").checked;
	var intern=document.getElementById("intern").checked;
	var contract=document.getElementById("contract").checked;
	var permanent=document.getElementById("permanent").checked;
	
	
	if(ussecurity1 == false && ussecurity2 == false) {
		document.getElementById('ussecurity-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
	} else {
		document.getElementById('ussecurity-l').innerHTML="";	
	}
	if(employed1 == false && employed2 == false) {
		document.getElementById('employed-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
	} else {
		document.getElementById('employed-l').innerHTML="";	
	}
	if(searchstatus1 == false && searchstatus2 == false) {
		document.getElementById('searchstatus-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
	} else {
		document.getElementById('searchstatus-l').innerHTML="";	
	}
	if(confiresume1 == false && confiresume2 == false) {
		document.getElementById('confiresume-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
	} else {
		document.getElementById('confiresume-l').innerHTML="";	
	}
	if(fulltime == false && parttime == false && intern == false) {
		document.getElementById('fulltime-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
	} else {
		document.getElementById('fulltime-l').innerHTML="";	
	}
	if(contract == false && permanent == false) {
		document.getElementById('contract-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
	} else {
		document.getElementById('contract-l').innerHTML="";	
	}
	
	
	
	var checkValidation=emptyValidation('industry~careerlevel~experience~uswork~highedu~edusummary~objective~resumetext~preflocation~willtravel~postionsint~desiredtitle~jobrole~annualpay~idealjob');
	if(checkValidation == false)
	return false;

	/*var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
	if(!RegExp.test(email)){
		document.getElementById("email-l").innerHTML='Invalid Email...';
		return false;
	}*/
	
}



function steponevalid() {
	

//firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~phone~mobile~jobalerts	
	
	var username=document.getElementById("username").value;
	var password=document.getElementById("password").value;
	var cpword=document.getElementById("cpword").value;
	var email=document.getElementById("email").value;
	var cemail=document.getElementById("cemail").value;
	var phone=document.getElementById("phone").value;
	var mobile=document.getElementById("mobile").value;
	var state=document.getElementById("state").value;
	//var seccode=document.getElementById("seccode").value;
	//var code=document.getElementById("code").value;
	var country=document.getElementById("country").value;
	var flag = 0;
	
	var arr = new Array('','Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island and Providence Plantations','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming','AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY');
	
	//var checkValidation=emptyValidation('firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~country~code');
	var checkValidation=emptyValidation('firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~country');

	

	if(checkValidation == false) {
		flag=1;
	}
	document.getElementById('mobile-l').innerHTML="";
	if(password != cpword) {
		document.getElementById('cpword-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Pasword Mismatch');
		flag=1;
	} else if(username == password && username!='' && password!='') {
		document.getElementById('username-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Username and password must not be same.');
		flag=1;
	} else if(email != cemail) {
		document.getElementById('cemail-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Email Mismatch');
		flag=1;
	} else if(mobile=='' && phone=='') {
		document.getElementById('mobile-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please fill any one of your contact no.');
		flag=1;
	} /*else if(seccode != code) {
		document.getElementById('code-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Invalid security code');
		flag=1;
	} */else if(state != '') {
		var sflag=0;
		for(i=0; i<arr.length; i++) {
			if(state.toLowerCase() == arr[i].toLowerCase())
				sflag=i;
		}
		if(sflag == 0 && country=='US') {
		document.getElementById('state-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please check state');
		flag=1;
		}
	}
	
	if(email != '' && flag==0) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
			flag=0;
		} else {
			document.getElementById('email-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
			alert('Invalid Email');
			flag=1;
		}
	}
	
	if(flag==1) {
		return false;	
	} else {
		return true;	
	}


}

/*function checkEmail(fid) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById(fid).value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}*/


function stepfourvalid() {
	
	
	//cardtype~cardno~expiremonth~expireyear~cardaddress~cardzip~tos
	
	var cardtype=document.getElementById("cardtype").value;
	var cardno=document.getElementById("cardno").value;
	var expiremonth=document.getElementById("expiremonth").value;
	var expireyear=document.getElementById("expireyear").value;
	var cardaddress=document.getElementById("cardaddress").value;
	var cardzip=document.getElementById("cardzip").value;
	var tos=document.getElementById("tos").checked;
	var flag = 0;
	
	
	
	myDate = new Date();
	var curr_month = myDate.getMonth();
	curr_month++;
	var curr_year = myDate.getFullYear();
	
	curr_month = parseInt(curr_month);
	curr_year = parseInt(curr_year);
	expiremonth = parseInt(expiremonth);
	expireyear = parseInt(expireyear);
	
	
	var checkValidation=emptyValidation('cardtype~cardno~expiremonth~expireyear~cardaddress~cardzip');
	if(checkValidation == false) {
		flag=1;
	} else if(tos == false) {
		document.getElementById('tos-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please accept the terms of service');
		flag=1;
	} else if(expireyear <= curr_year && expiremonth <= curr_month) {
		document.getElementById('expireyear-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please check the expiration date');
		flag=1;	
	} else {
		document.getElementById('tos-l').innerHTML="";
		document.getElementById('expireyear-l').innerHTML="";
	}
	
	if(flag==1) {
		return false;	
	} else {
		return true;	
	}
		
}

function AccountValid() {
	

//firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~phone~mobile~jobalerts	
	
	var email=document.getElementById("email").value;
	var phone=document.getElementById("phone").value;
	var mobile=document.getElementById("mobile").value;
	var flag = 0;
	
	var checkValidation=emptyValidation('firstname~lastname~email~address~city~state~zip~country');
	if(checkValidation == false) {
		flag=1;
	}
	document.getElementById('mobile-l').innerHTML="";
	if(mobile=='' && phone=='') {
		document.getElementById('mobile-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please fill any one of your contact no.');
		flag=1;
	} else if(email !='') {
		var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
		if(!RegExp.test(email)){
			document.getElementById('email-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
			alert('Invalid Email');
			flag=1;
		}
	}
	
	if(flag==1) {
		return false;	
	} else {
		return true;	
	}


}


function ChangepassValid() {
	

//firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~phone~mobile~jobalerts
	var password=document.getElementById("password").value;
	var newpass=document.getElementById("newpass").value;
	var newpass2=document.getElementById("newpass2").value;
	var flag = 0;
	
	var checkValidation=emptyValidation('password~newpass~newpass2');
	if(checkValidation == false) {
		flag=1;
	} else if(newpass != newpass2) {
		document.getElementById('newpass2-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Pasword Mismatch');
		flag=1;
	}
	
	if(flag==1) {
		return false;	
	} else {
		return true;	
	}


}





	function steponevalid11() { alert("1");
	
var username=document.getElementById("username").value;
	var password=document.getElementById("password").value;
	var cpword=document.getElementById("cpword").value;
	var email=document.getElementById("email").value;
	var cemail=document.getElementById("cemail").value;
	var phone=document.getElementById("phone").value;
	var mobile=document.getElementById("mobile").value;
	var state=document.getElementById("state").value;
	
	var country=document.getElementById("country").value;
	var flag = 0;
	
	var arr = new Array('','Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island and Providence Plantations','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming','AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY');
	
	var checkValidation=emptyValidation('firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~country');
	if(checkValidation == false) {
		flag=1;
	}
	document.getElementById('mobile-l').innerHTML="";
	if(password != cpword) {
		document.getElementById('cpword-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Pasword Mismatch');
		flag=1;
	} else if(username == password && username!='' && password!='') {
		document.getElementById('username-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Username and password must not be same.');
		flag=1;
	} else if(email != cemail) {
		document.getElementById('cemail-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Email Mismatch');
		flag=1;
	} else if(mobile=='' && phone=='') {
		document.getElementById('mobile-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please fill any one of your contact no.');
		flag=1;
	} else if(state != '') {
		var sflag=0;
		for(i=0; i<arr.length; i++) {
			if(state.toLowerCase() == arr[i].toLowerCase())
				sflag=i;
		}
		if(sflag == 0 && country=='US') {
		document.getElementById('state-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
		alert('Please check state');
		flag=1;
		}
	}
	
	if(email != '' && flag==0) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
			flag=0;
		} else {
			document.getElementById('email-l').innerHTML="<img src='/JobBoard/images/error.gif' alt='Required Field' />";
			alert('Invalid Email');
			flag=1;
		}
	}
	
	if(flag==1) {
		return false;	
	} else {
		return true;	
	}
//firstname~lastname~username~password~cpword~email~cemail~address~city~state~zip~phone~mobile~jobalerts	
	
	


}
