function frmCheck() {
	if(document.getElementById('cfName').value == '') {
		document.getElementById('disMsg').innerHTML = 'Please enter your name.';
		document.getElementById('cfName').focus();
		return false;
	}	
	
	if(document.getElementById('cfCAddress').value == '') {
		document.getElementById('disMsg').innerHTML = 'Please enter your address.';
		document.getElementById('cfCAddress').focus();
		return false;
	}	
	
	if(document.getElementById('cfEmail').value == '') {
		document.getElementById('disMsg').innerHTML = 'Please enter your email.';
		document.getElementById('cfEmail').focus();
		return false;
	}
	
	if(chkMail(document.getElementById('cfEmail').value)==false) {
		document.getElementById('disMsg').innerHTML = 'Please enter a valid email.';
		document.getElementById('cfEmail').focus();
		return false;
	}
	
	if(document.getElementById('cfCompany').value == '') {
		document.getElementById('disMsg').innerHTML = 'Please select company name.';
		document.getElementById('cfCompany').focus();
		return false;
	}	
	
	if(document.getElementById('cfContact').value == '') {	
		document.getElementById('disMsg').innerHTML = 'Please enter your contact number.';
		document.getElementById('cfContact').focus();
		return false;
	}
	
	if(document.getElementById('security').value == '') {
		document.getElementById('disMsg').innerHTML = 'Please enter the code.';
		document.getElementById('security').focus();
		return false;
	}
	
	return true;
}

function chkMail(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}

	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	
	if (str.indexOf(" ")!=-1){
		return false
	}

	return true					
}

function chkAppForm() {
	if ((document.frmApp.fName.value == '') || (document.frmApp.lName.value == '') ||
		(document.frmApp.bDate.value == '') || (document.frmApp.mName.value == '') ||
		(document.frmApp.appGender.value == '') || (document.frmApp.appStatus.value == '') ||
		(document.frmApp.appCurAdd.value == '') || (document.frmApp.appCurCity.value == '') ||
		(document.frmApp.appCurContact.value == '') || (document.frmApp.appCurMail.value == '') ||
		(document.frmApp.appPerAdd.value == '') || (document.frmApp.appPerCity.value == '') || 
		(document.frmApp.appPerContact.value == '') || (document.frmApp.appResume.value == '')) {
		
		document.frmApp.appNow.disabled=true;
	} else {
		document.frmApp.appNow.disabled=false;
	}
}

function chkAppSubmit() {
	if(chkMail(document.getElementById('appCurMail').value)==false) {
		document.getElementById('disMsg').innerHTML = 'Please enter a valid email.';
		document.getElementById('appCurMail').focus();
		return false;
	}	
}
