//// check length of textarea
  function maxLength(field,maxChars)
 {
       if(field.value.length >= maxChars) {
          event.returnValue=false; 
          alert("Not more than " +maxChars + " chars allowed.");
          return false;
       }
 }  

 function maxLengthPaste(field,maxChars)
 {
       event.returnValue=false;
       if((field.value.length +  window.clipboardData.getData("Text").length) > maxChars) {
         alert("Not more than " +maxChars + " chars allowed.");
         return false;
       }
       event.returnValue=true;
 }

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function checkmail(e){
var returnval=emailfilter.test(e.value);
return returnval;
}

function IsNumeric(yrValue) {
	  var checkOK = "0123456789.";
      var checkStr = yrValue;
      var allValid = true;
      var decPoints = 0;
      var allNum = "";
      for (i = 0;  i < checkStr.length;  i++)
      {
        ch = checkStr.charAt(i);
        for (j = 0;  j < checkOK.length;  j++)
          if (ch == checkOK.charAt(j))
            break;
        if (j == checkOK.length)
        {
          allValid = false;
          break;
        }
        if (ch == ".")
        {
          allNum += ".";
          decPoints++;
        }
        else if (ch != ",")
          allNum += ch;
      }
      if (!allValid)
      {
        return (false);
      }

      if (decPoints > 1)
      {
        return (false);
      }
     return(true);
	}

function ShowError(elementID,elementTitle){
	var errorImg='<img src="images/exclamation.png" align="middle" />';
	document.getElementById("lbl"+elementID).style.color='red';
	document.getElementById("lbl"+elementID).title=elementTitle;
	document.getElementById("img"+elementID).innerHTML=errorImg;
	}

function ResetError(elementID){	
	document.getElementById("lbl"+elementID).style.color='#666666';
	document.getElementById("lbl"+elementID).title='';
	document.getElementById("img"+elementID).innerHTML='';
	}

function CheckForValid_ContactUS(theForm) 
	{
		var retVal=true;
		if(theForm.txtname.value=="") {
			alert('Required Field Missing\n A Full Name is required.');
			retVal=false; }

		if(theForm.txtemail.value=="") {
			alert('Required Field Missing\n A Email ID is required.');
			retVal=false; }
		else 
			if(checkmail(theForm.txtemail)==false) {
				alert('Required Field Missing\n Invalid Email ID.');
				retVal=false; }

		if(theForm.txtphone.value=="") {
			alert('Required Field Missing\n A Phone no. is required.');
			retVal=false; }

		if(theForm.txtaddress.value=="") {
			alert('Required Field Missing\n A Address is required.');
			retVal=false; }

		if (theForm.txtmessage.value=="") {
			alert('Required Field Missing\n A Message is required.');
			retVal=false; }
			
		if(retVal==false)
		{
			alert("Please fill the all Required Fields");
		}
		else
		{
		alert("Thank you for your interest. A Synergy HRS representative will be contacting you shortly.");
		}
		return(retVal);
	}

function Validatefor_SUBSCRIBEUS(theForm) 
	{
		var retVal=true;
/*		if(theForm.txtfname.value=="") {
			alert('Required Field Missing\n A First Name is required.');
			retVal=false; }

		if(theForm.txtlname.value=="") {
			alert('Required Field Missing\n A Last Name is required.');
			retVal=false; }
*/
		if(theForm.txtemailid.value=="") {
			alert('Required Field Missing\n A Email ID is required.');
			retVal=false; }
		else 
			if(checkmail(theForm.txtemailid)==false) {
				alert('Required Field Missing\n Invalid Email ID.');
				retVal=false; }

/*		if(theForm.txtcompany.value=="") {
			alert('Required Field Missing\n A Company is required.');
			retVal=false; }
*/			
		if(retVal==false)
		{
			alert("Please fill the all Required Fields");
		}
		else
		return(retVal);
	}
