// JavaScript Document


function validate_career()
{	
	
	if (document.form1.resume.value==null || document.form1.resume.value=="" || validateti(document.form1.resume.value)==false)
     {
       document.getElementById('docfile').style.border = '1px solid red';
		document.getElementById('docfile').style.background="#ffc8b9";
			   
			  return false;
		
     }else
	 {  
	    if(whole_validate()==false)
		return false;
		else
		return true;
	   
	 }
	
}

function whole_validate()
{
 if (document.form1.name.value==null || document.form1.name.value=="")
     {
       document.getElementById('name').style.border = '1px solid red';
			   document.getElementById('name').style.background="#ffc8b9";
		return false;
	  
     }else if (document.form1.email.value==null || document.form1.email.value=="" || validate_email(document.form1.email.value,"emails") == false )
     {
       document.getElementById('emails').style.border = '1px solid red';
			   document.getElementById('emails').style.background="#ffc8b9";
		
	  return false;
     } else if (document.form1.contact.value==null || document.form1.contact.value=="" || check_len(document.form1.contact.value,"contactno") == false)
     {
       document.getElementById('contactno').style.border = '1px solid red';
			   document.getElementById('contactno').style.background="#ffc8b9";
		return false;
	  
     }else if (document.form1.interested.value==null || document.form1.interested.value=="")
     {
       document.getElementById('interested').style.border = '1px solid red';
			   document.getElementById('interested').style.background="#ffc8b9";
		return false;
	  
     }else return true;
	

}

function validate_name(val,ids)
{
  if (val==null || val=="")
     {
       document.getElementById(ids).style.border = '1px solid red';
			   document.getElementById(ids).style.background="#ffc8b9";
		
	  
     }else 
	 {document.getElementById(ids).style.border = '';
			   document.getElementById(ids).style.background="";
			  
	 }

}

function check_len(no,inputid1)
{ 
   no1=no.length
   check_it(no,inputid1);
   if (no1 != 10)
     {
       document.getElementById(inputid1).style.border = '1px solid red';
			   document.getElementById(inputid1).style.background="#ffc8b9";
			   return false;
	  
     }else 
	 {document.getElementById(inputid1).style.border = '';
			   document.getElementById(inputid1).style.background="";
			   return true;
	 }
      
	
	 
}




function check_it(n,inputid)
  {
   // chkprice(n,inputid);
    	
		
   if (IsNumeric(n) == false)
     {
       document.getElementById(inputid).style.border = '1px solid red';
			   document.getElementById(inputid).style.background="#ffc8b9";
	   
      
	   
	   /*alert("Enter Integer value!");
       return false;*/
     }else 
	 {document.getElementById(inputid).style.border = '';
			   document.getElementById(inputid).style.background="";
	 }
      
	
   }
 


 


function IsNumeric(strString)
// check for valid numeric strings
{
var strValidChars = "0123456789";
var strChar;
var blnResult = true;

if (strString.length == 0) return false;
if (strString.length == 1 && strString==0) return false;


// test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
if(strString.charAt(1) =="." || strString.charAt(1) =="." && strString.charAt(2) ==".")
{
blnResult = false;
}
}
return blnResult;
}


//emial validation
function validate_email(no,inputid)
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = no;
   if(reg.test(address) == false) {
	   
       document.getElementById(inputid).style.border = '1px solid red';
		document.getElementById(inputid).style.background="#ffc8b9";
		return false;
	  
     }else 
	 {document.getElementById(inputid).style.border = '';
			   document.getElementById(inputid).style.background="";
	           return true;
	 }
}

