// JavaScript Document
//var HOME_PATH='/samarthnew/';


 function sleepTimeOutDisplay(divId){	
 	if(eval(document.getElementById(divId))){
		document.getElementById(divId).style.display	=	'none';
		//document.getElementById('LoaderText').style.display="none";	
		//document.getElementById('iframpdf').style.visibility	=	'visible';
	}
	
}
function CheckResolution(){
  alert('Your resolution is '+screen.width+'x'+screen.height);
}

function feedbackLinit(field,maxlimit,batchId){	
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);	
	}else{ 
		var t = maxlimit - field.value.length;		
		document.getElementById("charLen_"+batchId).innerHTML = maxlimit - field.value.length;
	}

}

function CheckFeedback()
{
    var cntError = 0;
	var errorMsg = Array();		
	
	var company_name		=	document.feedbackfrm.companyname;	
	var contact_name	    =	document.feedbackfrm.contactperson;
	var contact_email      =   document.feedbackfrm.email;
	var address      =   document.feedbackfrm.address;
	var phone      =   document.feedbackfrm.phone;	   
		
	if(company_name.value==""){		
		//company_name.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Company Name';
		cntError++;
	}else{
	   //company_name.style.background="#FFFFFF";
	}
	if(contact_name.value==""){		
		//contact_name.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Contact Name';
		cntError++;
	}else{
	    //contact_name.style.background="#FFFFFF";
	}
	
	if(contact_email.value==""){
		//contact_email.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Email Address';
		cntError++;
	}else if(!isValidEmail(contact_email.value)){
	    //contact_email.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Valid Email Address';
		cntError++;
	}else{
	    //contact_email.style.background="#FFFFFF";
	}
	/*else if(contact_email.value!="")
	{  if(!isValidEmail(contact_email.value)){
		contact_email.style.background="#FC788F";
		errorMsg[cntError] = 'four';
		cntError++;
		}
	}*/	
	
    if(phone.value==""){
		//phone.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Phone Number';
		cntError++;
	}else{
	   //phone.style.background="#FFFFFF";
	}
    
	 if(errorMsg.length > 0){
		/*if(errorMsg.length>1){
		 alert('Please Enter All Red Color Required Field')	 
		}else{
		 alert('Please Enter Red Color Required Field')	 
		}*/	
		document.getElementById("errorDiv").style.display='block';
		document.getElementById("errorDiv").style.visibility='visible';
		showErrorMsg = document.getElementById("errorInnerDiv");
		showErrorMsg.style.display='block';
		showErrorMsg.innerHTML = "";
		for(i=0;i<errorMsg.length;i++){
			showErrorMsg.innerHTML += '<div class="errorList">'+errorMsg[i]+'</div>';
		}
		 setTimeout("sleepTimeOutDisplay('errorDiv');",11000);
		//setTimeout("sleepTimeOut('errorDiv')",5000);
		return false;
	/*}else if(!isValidEmail(contact_email.value)){
		    contact_email.style.background="#FC788F"; 
	        alert('Please Enter Valid Email Address')
			return false*/
	}else{
		document.getElementById("saveMyContact").value='Processing...';
        document.getElementById("saveMyContact").disabled=true; 		
		document.feedbackfrm.submit();
		return true;
	}
}




function CheckcareerForm(id,from)
{   var cntError = 0;
	var errorMsg = Array();		
	var frm='career_'+id;
	var username		=	document.getElementById('username_'+id).value;	
	var userphone	    =	document.getElementById('userphone_'+id).value;
	var file      =   document.getElementById('file_'+id).value;
		
	if(username==""){		
		//company_name.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Your Name';
		cntError++;
	}else{
	   //company_name.style.background="#FFFFFF";
	}
	if(userphone==""){		
		//contact_name.style.background="#FC788F";
		errorMsg[cntError] = 'Please Enter Your Phone Number';
		cntError++;
	}else{
	    //contact_name.style.background="#FFFFFF";
	}
	
	if(file==""){
		//contact_email.style.background="#FC788F";
		errorMsg[cntError] = 'Please Upload your Resume';
		cntError++;
	}
   
	 if(errorMsg.length > 0){
		/*if(errorMsg.length>1){
		 alert('Please Enter All Red Color Required Field')	 
		}else{
		 alert('Please Enter Red Color Required Field')	 
		}*/	
		document.getElementById("errorDiv").style.display='block';
		document.getElementById("errorDiv").style.visibility='visible';
		showErrorMsg = document.getElementById("errorInnerDiv");
		showErrorMsg.style.display='block';
		showErrorMsg.innerHTML = "";
		for(i=0;i<errorMsg.length;i++){
			showErrorMsg.innerHTML += '<div class="errorList">'+errorMsg[i]+'</div>';
		}
		 setTimeout("sleepTimeOutDisplay('errorDiv');",11000);
		//setTimeout("sleepTimeOut('errorDiv')",5000);
		return false;
	/*}else if(!isValidEmail(contact_email.value)){
		    contact_email.style.background="#FC788F"; 
	        alert('Please Enter Valid Email Address')
			return false*/
	}else{
		//document.getElementById("saveMyContact").value='Processing...';
       // document.getElementById("saveMyContact").disabled=true; 		
		from.submit();
		return true;
	}
}


function ResetField(){
    var company_name		=	document.feedbackfrm.companyname;	
	var contact_name	    =	document.feedbackfrm.contactperson;
	var contact_email      =   document.feedbackfrm.email;
	var address      =   document.feedbackfrm.address;
	var phone      =   document.feedbackfrm.phone;
	company_name.style.background="#FFFFFF";
	contact_name.style.background="#FFFFFF";
	contact_email.style.background="#FFFFFF";
	address.style.background="#FFFFFF";
	phone.style.background="#FFFFFF";
}

/*--------------------Common functions used in the entire site#START#BRIJENDRA----------------*/
function isValidEmail(str) {
	if(!(/^[^a-zA-Z0-9]/.test(str)) && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str))) {
		return true
	} else {
		return false
	}
 }
/*function to validate email for any form //END*/
/*function to validate & restrict user to enter only numeric values*/
//call function below on key events i.e. onkeypress, onkeyup etc.
function numericValue(evt) {
	evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}/*END function numericValue(evt)*/
//call function below on key events i.e. onkeypress, onkeyup etc.
function phoneValue(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=45) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
} /*END function phoneValue(evt)*/
//call function below on key events i.e. onkeypress, onkeyup etc.
function floatValue(evt) {////46 for DOT(.)
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
} /*END function phoneValue(evt)*/
/*//functin to check field value contains valid string characters //STRT*/
//function call ->if(isValidString(document.frmPrudential.clientName.value)==false)
	function isValidString(str){
		var result	=	true;
		var iChars = "`~!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
		//if string is NULL return false;
		if(str.length == 0) return false;
		for (var i = 0; i < str.length; i++) {
			if (iChars.indexOf(str.charAt(i)) != -1) {
				result	=	false;
			}
		}
	 return result;
	}

/*//functin to check field value contains valid string characters// END*/

/** function below is to check if field value is a valid zip code for US // START*/
function isValidZip(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   if(strString.length!=5) return false;
	var totalValue	=	0;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
	  totalValue	+=	parseInt(strString.charAt(i));
		
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
	
      }
	if(totalValue==0) return false;
   return blnResult;
   }
/** function below is to check if field value is a valid zip code for US//END */

/*function to check if field value is valid phone number for US // START*/
function isValidPhone(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789-";
   var strChar;
   var blnResult = true;

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