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='&nbsp;<img src="images/error_alert.gif" align="bottom">';
	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 ValidateEntries(theForm) {
		var retVal=true;
		var retDesc=true;
		
		var Visa = theForm.rgbVisa;
		for (var i=0; i< Visa.length; i++) 
		{
		    ResetError('Visa');
			
		}
		
		var RadioGroup1 = theForm.RadioGroup1;
		for (var i=0; i< RadioGroup1.length; i++) 
		{
		    ResetError('RadioGroup1');
			
		}
		
		if(theForm.txtfname.value=="") {
			ShowError('fname','Full Name field cannot be blank.');
			retVal=false; }
		else 
			ResetError('fname');

		/*if(theForm.txtaddress1.value=="") {
			ShowError('address1','Blank Address Line 1 Not Allowed.');
			retVal=false; }
		else 
			ResetError('address1');

		if(theForm.txtaddress2.value=="") {
			ShowError('address2','Blank Address Line 2 Not Allowed.');
			retVal=false; }
		else 
			ResetError('address2');*/
			
		if(theForm.txtcity.value=="") {
			ShowError('city','Please enter name of the City ');
			retVal=false; }
		else 
			ResetError('city');

        if (theForm.cbostate.selectedIndex < 0 ) 
		{
			ShowError('state','Please select state.');
			retVal=false; 
		}
		else
			ResetError('state');
			
		if(theForm.txtzip.value==""|| theForm.txtzip.value.length>5) {
			ShowError('zip','Field cannot be blank');
			retVal=false; }
		else
			if(!IsNumeric(theForm.txtzip.value)) {
			    ShowError('zip','Invalid ZipCode.');
			    retVal=false; }
		    else
			    ResetError('zip');
		
		if(theForm.txtemail.value.length>0)
		{
		if(checkmail(theForm.txtemail)==false) {
			ShowError('email','Invalid Email Address');
			retVal=false; }
		else 
			ResetError('email');
		}
		else
		{
			var btn = theForm.RadioGroup1;
			
			for (var i=0; i<btn.length; i++) 
			{
				if (btn[i].checked == 1 && btn[i].value=="Email") 
				{
				ShowError('email','Invalid Email Address');
				retVal=false;
				}
				if (btn[i].checked == 1 && btn[i].value=="Phone") 
				{
				ShowError('email','Invalid Email Address');
				retVal=false;
				}
			}
		}

		/*if(theForm.txtphone.value=="") {
			ShowError('phone','Please enter your Phone no. ');
			retVal=false; }
		else 
			ResetError('phone');
*/
		if((theForm.txtphone.value=="") || (theForm.txtphone2.value=="") || (theForm.txtphone3.value=="")) 
		{
			ShowError('phone','');
			retVal=false; 
		}
		else
			if(!IsNumeric(theForm.txtphone.value) || (!IsNumeric(theForm.txtphone2.value)) || (!IsNumeric(theForm.txtphone3.value))) 
			{
			    ShowError('phone','');
			    retVal=false; }
		    else
			    ResetError('phone');

		if (theForm.cboCamplocation.selectedIndex < 0 ) 
		{
			ShowError('CampusLocation','Please select Campus Location.');
			retVal=false; 
		}
		else
			ResetError('CampusLocation');
			
		if(theForm.txtcomments.value.length>=500)
         {
	      var count = theForm.txtcomments.value.length + 1
	      alert('Max 500 chars are allowed. You have entered ' + count + ' Characters.');
	      retDesc=false; 	            
         }
        else 
        {
	      ResetError('CampusLocation');
         }

		if(theForm.txtCaptcha.value == "")
		{
			ShowError('Captcha','');
			retVal=false; }
		else 
			ResetError('Captcha');

        if(retVal==false)
		{
		alert("Please fill the *Required Fields");
		return(retVal);
		}
		else
		{
			if(retDesc==false)  
			{
				//alert("Max 150 chars are allowed.");
				return(retDesc);
			}		
		}
return(retVal);
}

function ValidateCorpContactUs(theForm) {
		var retVal=true;
		var retDesc=true;
		
		if(theForm.txtcompname.value=="") {
			ShowError('compname','Comapny name field cannot be blank.');
			retVal=false; }
		else 
			ResetError('compname');
		
		if(theForm.txtcompaddress.value=="") {
			ShowError('compaddress','Comapny address field cannot be blank.');
			retVal=false; }
		else 
			ResetError('compaddress');
			
		
		if((theForm.txtphone.value=="") || (theForm.txtphone2.value=="") || (theForm.txtphone3.value=="")) 
		{
			ShowError('phone','');
			retVal=false; 
		}
		else
			if(!IsNumeric(theForm.txtphone.value) || (!IsNumeric(theForm.txtphone2.value)) || (!IsNumeric(theForm.txtphone3.value))) 
			{
			    ShowError('phone','');
			    retVal=false; }
		    else
			    ResetError('phone');

		if(theForm.txtemail.value=="")
		{		
			ShowError('email','Email field cannot be blank.');
			retVal=false; 
		}	
		else 
		{
			if(checkmail(theForm.txtemail)==false) {
				ShowError('email','Required Field Missing\n Invalid Email.');
				retVal=false; }
			else 
				ResetError('email');
		}
		
		if(theForm.txtcomments.value=="") 
		{
			ShowError('comments','Need / Requirements  field cannot be blank.');
		    retVal=false; 			
		}
		else 
		    if(theForm.txtcomments.value.length>=500)
            {
	            var count = theForm.txtcomments.value.length + 1
	            alert('Max 500 chars are allowed. You have entered ' + count + ' Characters.');
	            retDesc=false; 	            
            }
            else 
            {
	            ResetError('comments');
            }
			//ResetError('comments');

		if(theForm.txtCaptcha.value == "")
		{
			ShowError('Captcha','');
			retVal=false; }
		else 
			ResetError('Captcha');

    if(retVal==false)
		{
		alert("Please fill the *Required Fields");
		return(retVal);
		}
		else
		{
			if(retDesc==false)  
			{
				//alert("Max 150 chars are allowed.");
				return(retDesc);
			}		
		}
return(retVal);
}

function ValidCheckForLoanApp(theForm) {
		var retVal=true;

		if(theForm.LoanAmtRequested.value=="") {
			ShowError('LoanAmtRequested','Please enter Loan Amount.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.LoanAmtRequested.value)) {
			    ShowError('LoanAmtRequested','Invalid.');
			    retVal=false; }
		    else
			    ResetError('LoanAmtRequested');

		if(theForm.RepaymentTerms.value=="") {
			ShowError('RepaymentTerms','Please enter Loan Amount.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.RepaymentTerms.value)) {
			    ShowError('RepaymentTerms','Please enter Peariod For Loan in years.');
			    retVal=false; }
		    else
			    ResetError('RepaymentTerms');

		/*if (theForm.RequestedIntrestMonths.value == "")
		  {
			ShowError('RequestedIntrestMonths','');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.RepaymentTerms.value)) {
			    ShowError('RepaymentTerms','Please enter Peariod For Loan in years.');
			    retVal=false; }
		    else
				 ResetError('RepaymentTerms');*/

		if(theForm.BorrowerFirstName.value=="") {
			ShowError('BorrowerFirstName','Full Name field cannot be blank.');
			retVal=false; }
		else 
			ResetError('BorrowerFirstName');

		if(theForm.BorrowerMiddleName.value=="") {
			ShowError('BorrowerMiddleName','Please enter a value for Middle Name field.');
			retVal=false; }
		else 
			ResetError('BorrowerMiddleName');

		if(theForm.BorrowerLastName.value=="") {
			ShowError('BorrowerLastName','Please enter a value for the Last Name field.');
			retVal=false; }
		else 
			ResetError('BorrowerLastName');

		if(theForm.BorrowerSSNno.value=="") {
			ShowError('BorrowerSSNno','Please enter SSN No .');
			retVal=false; }
		else 
			ResetError('BorrowerSSNno');

		if(theForm.BorrowerAddress.value=="") {
			ShowError('BorrowerAddress','Please enter Address Correctly.');
			retVal=false; }
		else 
			ResetError('BorrowerAddress');

		if(theForm.BorrowerAddress.value=="") {
			ShowError('BorrowerAddress','Please enter Address Correctly.');
			retVal=false; }
		else 
			ResetError('BorrowerAddress');

		if(theForm.BorrowerCity.value=="") {
			ShowError('BorrowerCity','Please Enter City Name.');
			retVal=false; }
		else 
			if (theForm.BorrowerCity.selectedIndex < 1){
				ShowError('BorrowerCity','Please Enter City Name.');
				retVal=false; }
			else
				ResetError('BorrowerCity');

		if(theForm.BorrowerState.value=="") {
			ShowError('BorrowerState','Please Enter State Name.');
			retVal=false; }
		else 
			if (theForm.BorrowerState.selectedIndex < 1){
				ShowError('BorrowerState','Please Enter State Name.');
				retVal=false; }
			else
				ResetError('BorrowerState');
			
		if(theForm.BorrowerZipCode.value=="") {
			ShowError('BorrowerZipCode','Please enter a value for the Zip Code field.');
			retVal=false; }
		else 
			if (theForm.BorrowerZipCode.value.length < 5){
				ShowError('BorrowerZipCode','Please enter at least 5 characters in the ZIP Code field.');
				retVal=false; }
			else
				if (theForm.BorrowerZipCode.value.length > 5) {
					ShowError('BorrowerZipCode','Please enter at most 5 characters in the ZIP field.');
					retVal=false; }
				else
					if(!IsNumeric(theForm.BorrowerZipCode.value)) {
						ShowError('BorrowerZipCode','Please enter at most 5 characters in the ZIP field.');
						retVal=false; }
					else
						ResetError('BorrowerZipCode');

		if(theForm.BorrowerCountry.value=="") {
			ShowError('BorrowerCountry','Please select one of the Country from options.');
			retVal=false; }
		else 
			if (theForm.BorrowerCountry.selectedIndex < 0) {
				ShowError('BorrowerCountry','Please select one of the Country from options.');
				retVal=false; }
			else 
				ResetError('BorrowerCountry');

		if(theForm.LivingSinceYears.value=="") {
			ShowError('LivingSinceYears','Please enter value for Years.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.LivingSinceYears.value)) {
				ShowError('LivingSinceYears','Enter.');
				retVal=false; }
			else
				ResetError('LivingSinceYears');

		if(theForm.LivingSinceMonths.value=="") {
			ShowError('LivingSinceYears','Please enter value for Months.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.LivingSinceMonths.value)) {
				ShowError('LivingSinceYears','Please enter value for Months.');
				retVal=false; }
			else
				ResetError('LivingSinceYears');

		if(theForm.BorrowerHomePh.value=="") {
			ShowError('BorrowerHomePh','Please Enter a value for the home phone field.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.BorrowerHomePh.value)) {
				ShowError('BorrowerHomePh','Please enter a value for the home phone field.');
				retVal=false; }
			else
				ResetError('BorrowerHomePh');

		if(theForm.BorrowerEmail.value=="") {
			ShowError('BorrowerEmail','Please enter a value for the EMAIL field.');
			retVal=false; }
		else 
			if(checkmail(theForm.BorrowerEmail)==false) {
				ShowError('BorrowerEmail','Please enter a value for the EMAIL field.');
				retVal=false; }
			else 
				ResetError('BorrowerEmail');

		if (theForm.BorrowerMonthofBirth.selectedIndex < 0) {
			ShowError('BorrowerMonthofBirth','Please select one Month from options.');
			retVal=false; }
		else 
			ResetError('BorrowerMonthofBirth');

		if (theForm.BorrowerDateofBirth.selectedIndex < 0) {
			ShowError('BorrowerMonthofBirth','Please select one of the Day from options.');
			retVal=false; }
		else 
			ResetError('BorrowerMonthofBirth');

		if (theForm.BorrowerYearofBirth.selectedIndex < 0) {
			ShowError('BorrowerMonthofBirth','Please select one of the Year from options.');
			retVal=false; }
		else 
			ResetError('BorrowerMonthofBirth');

	  	/*if(theForm.YearsSinceWorking.value=="") {
			ShowError('YearsSinceWorking','Please Enter numeric');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.YearsSinceWorking.value)) {
				ShowError('YearsSinceWorking','Please Enter numeric');
				retVal=false; }
			else
				ResetError('YearsSinceWorking');

		if(theForm.MonthsSinceWorking.value=="") {
			ShowError('MonthsSinceWorking','Please Enter numeric');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.MonthsSinceWorking.value)) {
				ShowError('MonthsSinceWorking','Please Enter numeric');
				retVal=false; }
			else
				ResetError('MonthsSinceWorking');
		  
		if(theForm.GrossAnnualSalary.value=="") {
			ShowError('GrossAnnualSalary','Please Enter numeric');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.GrossAnnualSalary.value)) {
				ShowError('GrossAnnualSalary','Please Enter numeric');
				retVal=false; }
			else
				ResetError('GrossAnnualSalary');
		 
		if(theForm.OtherIncome.value=="") {
			ShowError('OtherIncome','Please Enter numeric.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.OtherIncome.value)) {
				ShowError('OtherIncome','Please Enter numeric.');
				retVal=false; }
			else
				ResetError('OtherIncome');*/

		if(theForm.Reference1Name.value=="") {
			ShowError('Reference1Name','Please enter Name of First Reference.');
			retVal=false; }
		else 
			ResetError('Reference1Name');

		if(theForm.Reference1Add.value=="") {
			ShowError('Reference1Add','Please Provide us Address of First Reference.');
			retVal=false; }
		else 
			ResetError('Reference1Add');

		if(theForm.Reference1HomePh.value=="") {
			ShowError('Reference1HomePh','Please enter a value for the HOME PHONE field.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.Reference1HomePh.value)) {
				ShowError('Reference1HomePh','Please enter a value for the HOME PHONE field.');
				retVal=false; }
			else 
				ResetError('Reference1HomePh');

		if(theForm.Ref1RelationshipWithApplicant.value=="") {
			ShowError('Ref1RelationshipWithApplicant','Please Mention Relationship of Reference with Applicant.');
			retVal=false; }
		else 
			ResetError('Ref1RelationshipWithApplicant');
		  
		if(theForm.Reference2Name.value=="") {
			ShowError('Reference2Name','Please enter Name of Second Reference.');
			retVal=false; }
		else 
			ResetError('Reference2Name');

		if(theForm.Reference2Add.value=="") {
			ShowError('Reference2Add','Please Provide us Address of Second Reference.');
			retVal=false; }
		else 
			ResetError('Reference2Add');

		if(theForm.Reference2HomePh.value=="") {
			ShowError('Reference2HomePh','Please enter a value for the HOME PHONE field.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.Reference2HomePh.value)) {
		  		ShowError('Reference2HomePh','Please enter a value for the HOME PHONE field.');
				retVal=false; }
			else 
				ResetError('Reference2HomePh');

		if(theForm.Ref2RelationshipWithApplicant.value=="") {
			ShowError('Ref2RelationshipWithApplicant','Please Mention Relationship of Reference with Applicant.');
			retVal=false; }
		else 
			ResetError('Ref2RelationshipWithApplicant');

		if(theForm.txtImgCode.value=="") {
			ShowError('ImgCode','Please Verify Image text to proceed.');
			retVal=false; }
		else 
			if (theForm.txtImgCode.value!=theForm.hidImgCode.value) {
				ShowError('ImgCode','The Image verification characters does not match\nPlease write the characters exactly as they appear on image.');
				retVal=false; }
			else 
				ResetError('ImgCode');

			if(retVal==false)
			{
				alert("Please fill the *Required Fields");
			}

			return(retVal);
	}

function ValidateforAppointment(theForm) {
        debugger;
        var retVal=true;
        var retDesc=true;
        
		var Visa = theForm.rgbVisa;
		for (var i=0; i< Visa.length; i++){
		    ResetError('Visa');
		}
	    
		if(theForm.txtFirstName.value==""){
			ShowError('FirstName','First Name field cannot be blank.');
			retVal=false;}
		else {
			ResetError('FirstName');
        }

		if(theForm.txtLastName.value==""){
			ShowError('LastName','Last Name field cannot be blank.');
			retVal=false;}
		else {
            ResetError('LastName');
        }

		if(theForm.txtCity.value==""){
			ShowError('City','Please enter name of the City.');
			retVal=false;}
		else {
			ResetError('City');
        }
        
		if(theForm.cboStates.value==""){
			ShowError('States','Please select state name.');
			retVal=false;}
		else{ 
			if (theForm.cboStates.selectedIndex <= 0) {
				ShowError('States','Please select state name.');
				retVal=false; }
			else { 
				ResetError('States');
			}	
        }

		if(theForm.txtZip.value=="" || theForm.txtZip.value.length>5) {
			ShowError('Zip','Field cannot be blank');
			retVal=false; }
		else{
			if(!IsNumeric(theForm.txtZip.value)) {
			    ShowError('Zip','Invalid ZipCode.');
			    retVal=false; }
		    else {
			    ResetError('Zip');
			}
        }

		if((theForm.txtDayPhone.value=="") && (theForm.txtDayPhone2.value=="") && (theForm.txtDayPhone3.value=="")) {
		    ShowError('DayPhone','Enter the Day Phone');
		    retVal=false; 
		}
		else
		{
		    if((theForm.txtDayPhone.value=="") || (theForm.txtDayPhone2.value=="") || (theForm.txtDayPhone3.value=="")) 
		    {
			    ShowError('DayPhone','');
			    retVal=false; 
		    }
		    else
		    {
			    if(!IsNumeric(theForm.txtDayPhone.value) || (!IsNumeric(theForm.txtDayPhone2.value)) || (!IsNumeric(theForm.txtDayPhone3.value))) {
			        ShowError('DayPhone','');
			        retVal=false; 
			    }
		        else {
			        ResetError('DayPhone');
			    }
		    }
		}    		
		if((theForm.txtNightPhone.value=="") && (theForm.txtNightPhone2.value=="") && (theForm.txtNightPhone3.value=="")) {
			ShowError('NightPhone');
		}
		else
		{
		    if((theForm.txtNightPhone.value=="") || (theForm.txtNightPhone2.value=="") || (theForm.txtNightPhone3.value=="")) {
			    ShowError('NightPhone','');
			    retVal=false; 
		    }
		    else
		    {
			    if(!IsNumeric(theForm.txtNightPhone.value) || (!IsNumeric(theForm.txtNightPhone2.value)) || (!IsNumeric(theForm.txtNightPhone3.value))) {
			        ShowError('NightPhone','');
			        retVal=false; 
			    }
		        else {
			        ResetError('NightPhone');
			    }
		    }
		 }

		if(theForm.txtEmailID.value.length>0) {
		    if(checkmail(theForm.txtEmailID)==false) {
			    ShowError('EmailID','Invalid Email Address');
			    retVal=false; }
		    else{ 
			    ResetError('EmailID');
			}
		}
		else {
			ShowError('EmailID','Invalid Email Address');
			retVal=false;
		}
	
		if (theForm.cboCourses.selectedIndex < 0) {
			ShowError('Courses','Please select Courses name.');
			retVal=false; }
		else {
			ResetError('Courses');
		}

		if (theForm.cboCampusLocation.selectedIndex < 0 ) 
		{
			ShowError('CampusLocation','Please select Campus Location.');
			retVal=false; 
		}
		else{
			ResetError('CampusLocation');
		}

		if (theForm.cboAppMonth.selectedIndex <= 0 ) {
			ShowError('AppMonth','Please Enter Appointment Day.');
			retVal=false; }
		else {
			ResetError('AppMonth');
		}

		if (theForm.cboAppDay.selectedIndex <= 0) {
			ShowError('AppMonth','Please Enter Appointment Day.');
			retVal=false; }
		else {
			ResetError('AppMonth');
		}

		if (theForm.cboAppYear.selectedIndex <= 0) {
			ShowError('AppMonth','Please Enter Appointment Day.');
			retVal=false; }
		else {
			ResetError('AppMonth');
		}
        
        if (theForm.cboAppMonth.value == '2' && theForm.cboAppDay.value > '28' && theForm.cboAppYear.value%4 != '0'){
	        ShowError('AppMonth',"Enter the valid From Date.");
	        retVal=false;
        }
        
        if ((theForm.cboAppMonth.value == '4' || theForm.cboAppMonth.value == '6' || theForm.cboAppMonth.value == '9' || theForm.cboAppMonth.value == '11') && theForm.cboAppDay.value > '30'){
	        ShowError('AppMonth',"Enter the valid From Date.");
	        retVal=false;
        }
        
		if (theForm.cboAppTime.selectedIndex <= 0) {
			ShowError('AppTime','Please select Appointment Time.');
			retVal=false; }
		else {
			ResetError('AppTime');
		}
		
		/*if(retVal==false)
		{
		    //alert(theForm.cboAppMonth.value "\n" theForm.cboAppDay.value>28 "\n" theForm.cboAppYear.value);
		    alert("Please fill the *Required Fields");
		}*/
		
		if(theForm.Describe.value.length>=500)
		{
			var count = theForm.Describe.value.length + 1
			alert('Max 500 chars are allowed. You have entered ' + count + ' Characters.');
			retDesc=false; 
		}	
		else
		{
			ResetError('AppTime');
		}
		
		if(theForm.txtCaptcha.value == "")
		{
			ShowError('Captcha','');
			retVal=false; }
		else 
			ResetError('Captcha');

        if(retVal==false)
		{
		    alert("Please fill the * Required Fields");
		    return(retVal);
		}
		else
		{
			if(retDesc==false)  
			{
			 return(retDesc);
			}		
		}
return(retVal);
}

function ValidateforClassrequest(theForm) {
		var retVal=true;
        var retDesc=true;

		if(theForm.CompanyName.value=="") {
			ShowError('CompanyName','Full Name field cannot be blank.');
			retVal=false; }
		else 
			ResetError('CompanyName');

		if(theForm.CompanyAddress.value=="") {
			ShowError('CompanyAddress','Blank CompanyAddress Not Allowed.');
			retVal=false; }
		else 
			ResetError('CompanyAddress');

		if((theForm.Officephone.value=="") || (theForm.Officephone2.value=="") || (theForm.Officephone3.value==""))
		{
			ShowError('Officephone','');
			retVal=false;
		}
		else
			if(!IsNumeric(theForm.Officephone.value) || (!IsNumeric(theForm.Officephone2.value)) || (!IsNumeric(theForm.Officephone3.value))) 
			{
			    ShowError('Officephone','');
			    retVal=false; }
		    else
			    ResetError('Officephone');
		/*if(theForm.Officephone.value==""){
			ShowError('Officephone','');
			retVal=false; }
		else
			if(!IsNumeric(theForm.Officephone.value)) {
			    ShowError('Officephone','');
			    retVal=false; }
		    else
			    ResetError('Officephone');
				
		if(theForm.Officephone2.value==""){
			ShowError('Officephone','');
			retVal=false; }
		else
			if(!IsNumeric(theForm.Officephone2.value)) {
			    ShowError('Officephone','');
			    retVal=false; }
		    else
			    ResetError('Officephone');
		
		if(theForm.Officephone3.value==""){
			ShowError('Officephone','');
			retVal=false; }
		else
			if(!IsNumeric(theForm.Officephone3.value)) {
			    ShowError('Officephone','');
			    retVal=false; }
		    else
			    ResetError('Officephone');*/
				
		if(theForm.Email.value.length>0)
		{
			if(checkmail(theForm.Email)==false) {
				ShowError('Email','Invalid Email Address');
				retVal=false; }
			else 
				ResetError('Email');
		}
		else
			{
				ShowError('Email','Invalid Email Address');
				retVal=false; }

		/*if(theForm.DaysRequired.value=="") {
			ShowError('DaysRequired','');
			retVal=false; }
		else 
			ResetError('DaysRequired');*/
		if (theForm.cboAppMonth.selectedIndex<=0 ) {
			ShowError('DaysRequired','Please Enter Appointment Day.');
			retVal=false; }
		else 
			ResetError('DaysRequired');

		if (theForm.cboAppDay.selectedIndex <= 0) {
			ShowError('DaysRequired','Please Enter Appointment Day.');
			retVal=false; }
		else 
			ResetError('DaysRequired');

		if (theForm.cboAppYear.selectedIndex <= 0) {
			ShowError('DaysRequired','Please Enter Appointment Day.');
			retVal=false; }
		else 
			ResetError('DaysRequired');
			
		
		if (theForm.cboAppMonthto.selectedIndex<=0 ) {
			ShowError('AppMonthto','Please Enter Appointment Day.');
			retVal=false; }
		else 
			ResetError('AppMonthto');

		if (theForm.cboAppDayto.selectedIndex <= 0) {
			ShowError('AppMonthto','Please Enter Appointment Day.');
			retVal=false; }
		else 
			ResetError('AppMonthto');

		if (theForm.cboAppYearto.selectedIndex <= 0) {
			ShowError('AppMonthto','Please Enter Appointment Day.');
			retVal=false; }
		else 
			ResetError('AppMonthto');
		
		if (theForm.cboAppMonth.value==2 && theForm.cboAppDay.value>28 && theForm.cboAppYear.value%4!=0){
		    ShowError('DaysRequired',"Enter the valid From Date");
		    retVal=false;
	    }
	    if ((theForm.cboAppMonth.value==4 || theForm.cboAppMonth.value==6 || theForm.cboAppMonth.value==9 || theForm.cboAppMonth.value==11) && theForm.cboAppDay.value>30){
		    ShowError('DaysRequired',"Enter the valid From Date");
		    retVal=false;
	    }
	    
		if (theForm.cboAppMonthto.value==2 && theForm.cboAppDayto.value>28 && theForm.cboAppYearto.value%4!=0){
		    ShowError('AppMonthto',"Enter the valid To Date");
		    retVal=false;
	    }
	    if ((theForm.cboAppMonthto.value==4 || theForm.cboAppMonthto.value==6 || theForm.cboAppMonthto.value==9 || theForm.cboAppMonthto.value==11) && theForm.cboAppDayto.value>30){
		    ShowError('AppMonthto',"Enter the valid To Date");
		    retVal=false;
	    }
	    var objFromDate = theForm.cboAppMonth.value + '/' + theForm.cboAppDay.value +'/' + theForm.cboAppYear.value ;
        var objToDate = theForm.cboAppMonthto.value + '/' + theForm.cboAppDayto.value +'/' + theForm.cboAppYearto.value ;

	    var date1 = new Date(objFromDate);
        var date2 = new Date(objToDate);
         
        var date3 = new Date();
        var date4 = date3.getMonth() + "/" + date3.getDay() + "/" + date3.getYear();
        var currentDate = new Date(date4);
         
        if(date1 > date2)
        {
           ShowError('DaysRequired',"From Date should be less than To date");
           retVal=false;
        }
//        else if(date1 < currentDate)
//        {
//            ShowError('DaysRequired',"From Date should be greater than or equal to current date");
//            retVal=false; 
//        }
//        else if(date2 < currentDate) 
//        {
//	        ShowError('AppMonthto',"To Date should be greater than or equal to current date");
//            retVal=false;
//        }
	
		if(theForm.TimeRequired.value=="") {
			ShowError('TimeRequired','');
			retVal=false; }
		else 
			ResetError('TimeRequired');

		if (theForm.cboCamplocation.selectedIndex < 0 ) 
		{
			ShowError('CampusLocation','Please select Campus Location.');
			retVal=false; 
		}
		else
			ResetError('CampusLocation');
			
		if(theForm.Purpose.value.length>=500)
		{
			var count = theForm.Purpose.value.length + 1
			alert('Max 500 chars are allowed. You have entered ' + count + ' Characters.');
			retDesc=false; 
		}	
		else
		{
			ResetError('CampusLocation');
		}

		if(theForm.txtCaptcha.value == "")
		{
			ShowError('Captcha','');
			retVal=false; }
		else 
			ResetError('Captcha');
		
        if(retVal==false)
		{
		    alert("Please fill the *Required Fields");
		    return(retVal);
		}
		else
		{
			if(retDesc==false)  
			{
			 return(retDesc);
			}		
		}
return(retVal);
}

function Validatefor_SUBSCRIBEUS(theForm) {
		var retVal=true;

			if(checkmail(theForm.txtSubscribeus)==false) {
			ShowError('Subscribeus','Invalid Email Address');
			retVal=false; }
		else 
			ResetError('Subscribeus');
	
		if(retVal==false)
		{
		alert("Please fill the *Required Fields");
		}

		return(retVal);
}

function ValidCheckForRegister(theForm) {
		var retVal=true;
		var retDesc=true;
		
		var Visa = theForm.rgbVisa;
		for (var i=0; i< Visa.length; i++) 
		{
		    ResetError('Visa');
		}
		
		if(theForm.FirstName.value=="") {
			ShowError('FirstName','First Name field cannot be blank.');
			retVal=false; }
		else 
			ResetError('FirstName');

		if(theForm.LastName.value=="") {
			ShowError('LastName','Last Name field cannot be blank.');
			retVal=false; }
		else 
			ResetError('LastName');

			/*if(theForm.Address1.value=="") {
			ShowError('Address1','Blank Address Line 1 Not Allowed.');
			retVal=false; }
		else 
			ResetError('Address1');*/

		if(theForm.City.value=="") 
		{
			ShowError('City','Please enter name of the City ');
			retVal=false; 
			}
		else 
			ResetError('City');
			
		if(theForm.States.value=="") {
			ShowError('States','Please select state name.');
			retVal=false; }
		else 
			if (theForm.States.selectedIndex <= 0) {
				ShowError('States','Please select state name.');
				retVal=false; }
			else 
				ResetError('States');

		if(theForm.Zip.value==""|| theForm.Zip.value.length>5) {
			ShowError('Zip','Field cannot be blank');
			retVal=false; }
		else
			if(!IsNumeric(theForm.Zip.value)) {
			    ShowError('Zip','Invalid ZipCode.');
			    retVal=false; }
		    else
			    ResetError('Zip');

		/*if(theForm.HomePhone.value=="") {
			ShowError('HomePhone','Please enter your Home Phone no. ');
			retVal=false; }
		else 
			ResetError('HomePhone');*/
		if((theForm.HomePhone.value=="") && (theForm.HomePhone2.value=="") && (theForm.HomePhone3.value=="")) 
		{
			ShowError('HomePhone','');
			 retVal=false; 
		}
		else
		{
			if((theForm.HomePhone.value=="") || (theForm.HomePhone2.value=="") || (theForm.HomePhone3.value=="")) 
			{
			ShowError('HomePhone','');
			retVal=false; 
			}
			else
			{
				if(!IsNumeric(theForm.HomePhone.value) || (!IsNumeric(theForm.HomePhone2.value)) || (!IsNumeric(theForm.HomePhone3.value))) 
				{
			    	ShowError('HomePhone','');
				    retVal=false; 
					}
			    else
				    ResetError('HomePhone');
			}
		}

		/*
		if((theForm.Officephone.value=="") && (theForm.Officephone2.value=="") && (theForm.Officephone3.value=="")) 
		{
			ResetError('OfficePhone');
		}
		else
		{
		    if((theForm.Officephone.value=="") || (theForm.Officephone2.value=="") || (theForm.Officephone3.value=="")) 
		    {
			    ShowError('OfficePhone','');
			    retVal=false; 
		    }
		    else
			    if(!IsNumeric(theForm.Officephone.value) || (!IsNumeric(theForm.Officephone2.value)) || (!IsNumeric(theForm.Officephone3.value))) 
			    {
			        ShowError('OfficePhone','');
			        retVal=false; }
		        else
			        ResetError('OfficePhone');
		    }
		 }
		*/
		
		if(theForm.Email.value.length>0)
		{
		    if(checkmail(theForm.Email)==false) {
			    ShowError('Email','Invalid Email Address');
			    retVal=false; }
		    else 
			    ResetError('Email');
		}
		else
		{
			ShowError('Email','Invalid Email Address');
			retVal=false; 
		}

		if(theForm.cboCourses.selectedIndex < 0) 
		{
			ShowError('Courses','Please select Courses name.');
			retVal=false; 
		}
		else 
			ResetError('Courses');
			
		if(theForm.Describe1.value.length>=500)
		{
			var count = theForm.Describe1.value.length + 1
			alert('Max 500 chars are allowed. You have entered ' + count + ' Characters.');
			retDesc=false; 
		}	
		else
		{
			ResetError('Camplocation');
		}
		
		if(theForm.txtCaptcha.value == "")
		{
			ShowError('Captcha','');
			retVal=false; }
		else 
			ResetError('Captcha');

		if (theForm.cboCamplocation.selectedIndex < 0 ) 
		{
			ShowError('Camplocation','Please select Campus Location.');
			retVal=false; 
		}
		else
			ResetError('Camplocation');

		/*if(theForm.ExpirationMonth.value=="") {
			ShowError('ExpirationMonth','Please enter value for Months.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.ExpirationMonth.value)) {
				ShowError('ExpirationMonth','Please enter value for Months.');
				retVal=false; }
			else
				ResetError('ExpirationMonth');
				
		if(theForm.CreditcardNumber.value==""){
			ShowError('CreditcardNumber','');
			retVal=false; }
		else
			if((!IsNumeric(theForm.CreditcardNumber.value)) || (theForm.CreditcardNumber.value<12 || theForm.CreditcardNumber.value.length>15)) {
			    ShowError('CreditcardNumber','');
			    retVal=false; }
		    else
			    ResetError('CreditcardNumber');

		if(theForm.ExpirationMonth.value=="") {
			ShowError('ExpirationMonth','Please enter value for Years.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.ExpirationMonth.value)) {
				ShowError('ExpirationMonth','Enter.');
				retVal=false; }
			else
				ResetError('ExpirationMonth');

		if(theForm.ExpirationYear.value=="") {
			ShowError('ExpirationMonth','Please enter value for Years.');
			retVal=false; }
		else 
			if(!IsNumeric(theForm.ExpirationYear.value)) {
				ShowError('ExpirationMonth','Enter.');
				retVal=false; }
			else
				ResetError('ExpirationMonth');*/
				

		if(retVal==false)
		{
		alert("Please fill the *Required Fields");
		return(retVal);
		}
		else
		{
			if(retDesc==false)  
			{
				//alert("Max 150 chars are allowed.");
				return(retDesc);
			}		
		}
return(retVal);
}

var xmlHttp

function showHint(str,str1)
{
if (str.length==0)
  { 
  document.getElementById("txtHint").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
 // alert ("Your browser does not support AJAX!");
  return;
  } 
document.getElementById("txtHint").innerHTML="";
var url=str1;
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
//document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    //xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
