
// -->
var testresults

function checkemail(){
 	var str=document.producerform.email.value
 	var filter=/^.+@.+\..{2,3}$/

	if (filter.test(str))
    	testresults=true
 	else {
    	alert("Please enter a valid email address!")
		document.producerform.email.value="";
		document.producerform.email.focus();
    	testresults=false
	}
 	return (testresults)
}

function cronicDigit(c){
	var test = "" + c;

	if (test == "0" || test == "1" || test == "2" || test == "3" || test == "4" || test == "5" 
	|| test == "6" || test == "7" || test == "8" || test == "9" || test == "-" || test == "+" || test == " ")
	{
	    return true;
	}
	    return false;  
}
	
function cronicAllDigit(s){
	var test = "" + s;
	for (var k =0; k < test.length; k++){
		var c = test.substring(k, k+1);
	    	if (cronicDigit(c) == false){
	        	return false;
	        }
	}
}
	
function cronicFieldYes(){
	document.producerform.txtQ3.disabled=false;
	document.producerform.txtQ3.focus();
}

function cronicFieldNo(){
	document.producerform.txtQ3.disabled=true;
	document.producerform.txtQ3.value="";
}

function checkinfo(form){
	missinginfo="";
	
	if (document.producerform.name.value ==""){
		missinginfo += "Please enter your name";
		alert(missinginfo);
		document.producerform.name.focus();
		return false;
	}
	
	if (document.producerform.mobileno.value ==""){
		missinginfo += "Please enter your mobile number";
		alert(missinginfo);
		document.producerform.mobileno.focus();
		return false;
	}
	else if (cronicAllDigit(document.producerform.mobileno.value) == false){
		alert("Please enter a valid mobile number!");
		document.producerform.mobileno.value="";
		document.producerform.mobileno.focus();
		return false;
	}
	
	if (document.producerform.email.value ==""){
		missinginfo += "Please enter your e-mail";
		alert(missinginfo);
		document.producerform.email.focus();
		return false;
	}
		
		
	if (document.producerform.txtQ1.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ1.focus();
		return false;
	}
	
	if (document.producerform.txtQ2.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ2.focus();
		return false;
	}
	
	var groupa = document.producerform.rdbQ3;
	for (var i=0; i<groupa.length; i++){
		if (groupa[i].checked) break;
	if (i==groupa.length){
		alert("Please answer the question");
		return false;
	}
		var a=i+1;
		if (a==2){
			if (document.producerform.txtQ3.value==""){
			alert("Please answer the question");
			document.producerform.txtQ3.focus();
			return false;
			}
		}
	}
	
	if (document.producerform.txtQ4.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ4.focus();
		return false;
	}
	
	if (document.producerform.txtQ5.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ5.focus();
		return false;
	}
		 
	if (document.producerform.txtQ6.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ6.focus();
		return false;
	}
	
	var groupc = document.producerform.rdbQ7;
	for (var i=0; i<groupc.length; i++){
		if (groupc[i].checked) break;
		}
		if (i==groupc.length){
			alert("Please answer the question");
			return false;
		} 
	if (document.producerform.txtQ7.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ7.focus();
		return false;
	}
	
	if (document.producerform.txtQ8.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ8.focus();
		return false;
	}
		if (document.producerform.txtQ9.value ==""){
		missinginfo += "Please answer the question";
		alert(missinginfo);
		document.producerform.txtQ9.focus();
		return false;
	}
		
	if (document.producerform.txtresume.value ==""){
		missinginfo += "Please create your own text resume";
		alert(missinginfo);
		document.producerform.txtcv.focus();
		return false;
	}
	
	if (document.layers||document.all){
		return checkemail()
	}
	else{
		return true
	}

}

function textLimit(field, maxlen){
	if (field.value.length > maxlen + 1)
	alert('You have exceeding the text limit, Your resume has been truncated!');
	if (field.value.length > maxlen)
	field.value = field.value.substring(0, maxlen);
}
