function acceptterms()

{ 
	if(document.personalForm.check1[1].checked)
   {
	   window.alert("Please accept terms and conditions");	  

	return false;

    }

 }

function submitform()

  {
    if(document.login_form.emailid.value.length==0 || document.login_form.password.value.length==0)
	{
		window.alert("Please enter the email id and password.");

		document.login_form.emailid.focus();

			return false;
	}
	else
    {

		document.login_form.submit();

	}

}
// this function is used for validating registration page
////////////////////////////////////////////////////////
function ValidateRegistrationForm(frm)
{
	if(frm.firstname.value.length==0)
	{
		window.alert("Please enter the first name");

		frm.firstname.focus();

		return false;
	}

	if(frm.lastname.value.length==0)

	{

		window.alert("Please enter the last name");

		frm.lastname.focus();

		return false;

	}

	if(!echeck(frm.emailid.value))

	{

		frm.emailid.focus();

		return false;

	}
	
	if(frm.emailid.value!=frm.confirm_emailid.value)

	{

		window.alert("The email addresses you entered do not match");

		frm.emailid.focus();

		return false;

	}

	if(frm.password.value.length==0)

	{

		window.alert("Please enter the password");

		frm.password.focus();

		return false;

	}



	if(frm.confirm_password.value.length==0)

	{

		window.alert("Please enter the confirm password");

		frm.confirm_password.focus();

		return false;

	}
	if((frm.password.value)!=(frm.confirm_password.value))

	{

		window.alert("The passwords you entered do not match");

		frm.confirm_password.focus();

		return false;

	}

}


function echeck(str) 
{

		var at="@"

		var dot="."

		var lat=str.indexOf(at)

		var lstr=str.length

		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1)
		{

		   alert("Invalid E-mail ID")

		   return false

		}


		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{

		   alert("Invalid E-mail ID")

		   return false

		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		    alert("Invalid E-mail ID")

		    return false

		}

		 if (str.indexOf(at,(lat+1))!=-1)
		 {

		    alert("Invalid E-mail ID")

		    return false

		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {

		   alert("Invalid E-mail ID")

		    return false

		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {

		    alert("Invalid E-mail ID")

		    return false

		 }	

		 if (str.indexOf(" ")!=-1)
		 {

		   alert("Invalid E-mail ID")

		    return false

		 }

 		 return true					

}
	
	
	//////////////////////////////////////////////////////////////////////

	/////this function is used for validating nanny profile page/////////

	
function ValidateRegistrationForm1()

{

     if(personalForm1.lastname.value.length==0)

	{

		window.alert("Please enter the Last Name");

		personalForm1.lastname.focus();

		return false;

	}

	if(personalForm1.firstname.value.length==0)

	{

		window.alert("Please enter the First Name");

		personalForm1.firstname.focus();

		return false;

	}

	if(personalForm1.address1.value.length==0)

	{

		window.alert("Please enter the address details");

		personalForm1.address1.focus();

		return false;

	}
   if(personalForm1.city.value.length==0)

	{

		window.alert("Please enter the city details");

		personalForm1.city.focus();

		return false;

	}

	if(personalForm1.state.value.length==0)

	{

		window.alert("Please enter the state details");

		personalForm1.state.focus();

		return false;

	}	

	if(personalForm1.pin.value.length==0)

	{

		window.alert("Please enter 5 digit zip code");

		personalForm1.pin.focus();

		return false;

	}

	if(!IsNumeric(document.personalForm1.pin.value))

     {

        alert("Please enter 5 digit zip code");

		personalForm1.pin.focus();

		return false;

	 }
	if(document.personalForm1.pin.value.length!=5 )

	{

		window.alert("Please enter 5 digit zip code");
		
		personalForm1.pin.focus();

		return false;

	}
   
   /* UPDATED BY : RAJESH KUMAR VISHWAKARMA
   	  UPDATED ON : 2 MARCH 2007
	  BECAUSE    : THERE IS DROPDOWN YES / NO
   */
   
   
   /* if(document.personalForm1.ssn.value.length==0 )

	    {
		window.alert("Please enter the  9 digit ssn number");

		personalForm1.ssn.focus();

		return false;

		}
	if(document.personalForm1.ssn.value.length!=9 )

	{
		window.alert("Please enter the  9 digit ssn number");

		personalForm1.ssn.focus();

		return false;

	}

		if(!IsNumeric(document.personalForm1.ssn.value))

         {
         alert("Please enter the ssn number in this format:xxx-xx-xxx value");

		personalForm1.ssn.focus();

		return false;

		}*/

		if(document.personalForm1.homephone.value.length!=0 && document.personalForm1.homephone.value.length!=10)

		{

		if(!checkInternationalPhone(document.personalForm1.homephone.value))

			{

				alert("Please enter the 10 digit home phone number(including area code)with no dashes,spaces,or parentheses");

				personalForm1.homephone.focus();

				return false;

			}

			

		}

		if(document.personalForm1.workphone.value.length!=0 && document.personalForm1.workphone.value.length!=10)

		{

		if(!checkInternationalPhone(document.personalForm1.workphone.value))

			{
				alert("Please enter the 10 digit work phone number(including area code)with no dashes,spaces,or parentheses");

				personalForm1.workphone.focus();

				return false;

			}

		}

	if(document.personalForm1.mobile.value.length!=0 && document.personalForm1.mobile.value.length!=10)

		{

		if(!checkInternationalPhone(document.personalForm1.mobile.value))

			{

				alert("Please enter the 10 digit cell phone number(including area code)with no dashes,spaces,or parentheses");

				personalForm1.mobile.focus();

				return false;

			}

			

		}
		if(personalForm1.why.value.length==0)

	     {

		window.alert("Please enter why do you want to be a nanny");

		personalForm1.why.focus();

		return false;

	    } 

	
	if(personalForm1.experience.value.length==0)

	{ 

		window.alert(" Please enter the previous experiences with childcare (professional or personal family)");

		personalForm1.experience.focus();

		return false;

	}
   if(personalForm1.relative.value.length==0)

	{

		window.alert(" Please enter the Name, address and phone number of closest relative");

		personalForm1.relative.focus();

		return false;

	}
   if(personalForm1.references1.value.length==0)

	{ 

		window.alert("Please list names and contact information of at least, 2 employer references (preferably child care employers)");

		personalForm1.references1.focus();

		return false;

	 }
	if(personalForm1.references2.value.length==0)
	{
		window.alert("Please list names and contact information of at least, 2 employer references (preferably child care employers)");

		personalForm1.references2.focus();

		return false;

	}		
		//change the code on 10 oct 20	

	if(personalForm1.resume.value.length!=0)

	{			

	//var imgRe = /^.+\.(application\/msword|application/octet-stream|text/plain|png)$/i;    

	var imgRe =/^.+\.(doc|rtf|txt|pdf|wps)$/i;    

    var path = document.personalForm1.resume.value;

    if (path.search(imgRe) == -1)

       {  
		alert("Please enter the .doc or .rtf or .txt files only");

		return false;

       }

    }     

	if(personalForm1.userfile.value.length!=0)

	 { 

	var imgRe = /^.+\.(jpg|jpeg|gif|png|bmp)$/i;    

    var path = document.personalForm1.userfile.value;

       if (path.search(imgRe) == -1)

        {   

		alert("JPG, PNG, BMP, and GIFs only!");

		return false;

         }       

      }

	if(personalForm1.userfile1.value.length!=0)

	{

	var imgRe = /^.+\.(jpg|jpeg|gif|png|bmp)$/i;    

    var path = document.personalForm1.userfile1.value;

      if (path.search(imgRe) == -1)

        {   

		alert("JPG, PNG, BMP and GIFs only!");

		return false;

         }       

      }

	if(personalForm1.userfile2.value.length!=0)

			{

	var imgRe = /^.+\.(jpg|jpeg|gif|png|bmp)$/i;    

    var path = document.personalForm1.userfile2.value;

    if (path.search(imgRe) == -1)

       {   

		alert("JPG, PNG, BMP and GIFs only!");

		return false;

        }       

     }

	  <!-- end of change   -->

		if(document.personalForm1.check1[1].checked)
 		 {
	    window.alert("You may not submit your profile until you have read and accepted our Terms & Conditions");
   		return false;

          } 

}

//this function is used to enable or disable crime textarea according to selection of radio button in //nanny profile page
function checkcrime()
	 {   
		 if(document.personalForm1.crime[0].checked)
		 
		{ 
		document.personalForm1.crime_explanation.disabled=false;
		
		}
		
		if(document.personalForm1.crime[1].checked)
		{ 
		
		document.personalForm1.crime_explanation.disabled=true;
		document.personalForm1.crime_explanation.value="";
		}
	 } 


////this function is used for validating member profile page
////////////////////////////////////////////////////////////


function ValidateRegistrationForm2()

{
	if(personalForm.city.value.length==0)

	{

		window.alert("Please enter the city details");

		personalForm.city.focus();

		return false;

	}

	if(personalForm.state.value.length==0)

	{

		window.alert("Please enter the state ");

		personalForm.state.focus();

		return false;

	}

	if(personalForm.pin.value.length==0)

	{

		window.alert("Please enter 5 digit zip code ");

		personalForm.pin.focus();

		return false;

	}
   if(personalForm.pin.value.length >=1)
    {
	  if(!IsNumeric(personalForm.pin.value)) 

       {

	     alert("Please enter the zip code of 5 digits");

	     personalForm.pin.focus();

	     return false;

       }
	   
    if ( personalForm.pin.value.length != 5 ) 
       {  
         alert("Please enter the zip code of 5 digits");

	     personalForm.pin.focus();

	     return false;
       }
   }
   if(personalForm.homephone.value.length >=1)
    {
	  if(!IsNumeric(personalForm.homephone.value)) 

       {

	     alert("Please enter the 10 digit  homephone number(including area code)with no dashes,spaces,or parentheses");
	     personalForm.homephone.focus();

	     return false;

       }
    if ( personalForm.homephone.value.length!=10 ) 
       {  
         alert("Please enter the 10 digit homephone number(including area code)with no dashes,spaces,or parentheses");

	     personalForm.homephone.focus();

	     return false;
       }
     }
  if(personalForm.workphone.value.length >=1)
   {
	  if(!IsNumeric(personalForm.workphone.value)) 

       {

	     alert("Please enter the 10 digit workphone number(including area code)with no dashes,spaces,or parentheses");

	     personalForm.workphone.focus();

	     return false;

       }
    if ( personalForm.workphone.value.length!=10 ) 
       {  
         alert("Please enter the 10 digit workphone number(including area code)with no dashes,spaces,or parentheses");

	     personalForm.workphone.focus();

	     return false;
       }
   }


  if((personalForm.fax.value.length)>=1)
    {
	 
	 if(!IsNumeric(personalForm.fax.value)) 

       {

	      alert("Please enter the 10 digit fax number(including area code)with no dashes,spaces,or parentheses");
	     personalForm.fax.focus();

	     return false;

       }
    if ((personalForm.fax.value.length) !=10 ) 
       {  
          alert("Please enter the 10 digit  fax number(including area code)with no dashes,spaces,or parentheses");
	     personalForm.fax.focus();
		
	     return false;
       }
	  

   }
  			 
   if(document.personalForm.check1[1].checked)

    {

	   window.alert("You may not submit your profile until you have read and accepted our Terms & Conditions");

	return false;

    }//alert("

}


function IsNumeric(strString)

   //  check for valid numeric strings	

   {

   var strValidChars = "0123456789.-";

   var strChar;

   var blnResult = true;

   if (strString.length == 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;

         }

      }

   return blnResult;

   }





/////////////////////////////////

	

/**

 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)

 */



// Declaring required variables

var digits = "0123456789";

// non-digit characters which are allowed in phone numbers

var phoneNumberDelimiters = "()- ";

// characters which are allowed in international phone numbers

// (a leading + is OK)

var validWorldPhoneChars = phoneNumberDelimiters + "+";

// Minimum no of digits in an international phone no.

var minDigitsInIPhoneNumber = 10;



function isInteger(s)

{   var i;

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character is number.

        var c = s.charAt(i);

        if (((c < "0") || (c > "9"))) return false;

    }

    // All characters are numbers.

    return true;

}



function stripCharsInBag(s, bag)

{   var i;

    var returnString = "";

    // Search through string's characters one by one.

    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character isn't whitespace.

        var c = s.charAt(i);

        if (bag.indexOf(c) == -1) returnString += c;

    }

    return returnString;

}



function checkInternationalPhone(strPhone){

s=stripCharsInBag(strPhone,validWorldPhoneChars);

return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);

}



//function ValidateForm(){

	//window.alert("su");

	//var Phone=document.frmSample.txtPhone

	

	//if ((fax.value==null)||(fax.value=="")){

		//alert("Please Enter your Phone Number")

		//Phone.focus()

		//return false

	//}

	//if (checkInternationalPhone(fax.value)==false){

	//	alert("Please Enter a Valid Phone Number")

	//	Phone.value=""

	//	Phone.focus()

	//	return false

	//}

	//return true

 //}



	//this is another test

	

	//this is test message

	function IsNumeric(strString)

   //  check for valid numeric strings	

   {

   var strValidChars = "0123456789.-";

   var strChar;

   var blnResult = true;



   if (strString.length == 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;

         }

      }

   return blnResult;

   }

   



///////////////

/*

function numeralsOnly(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 ))

	{

		return false;

	}

	return true;

}

*/

//////



	