
function Validate(step) {
  
      var readyToGo = checkStep(step); 
      if(!readyToGo) {
         return false; 
         }
      
   return true;   
  
   }

function checkStep(step) {
   
    
     if (step==1)
     {
    
        //Fields should be validated with Or Operator
        //Add,city,State,Zip should be all together filled if phone or email is not filled
      
      var Add = GetFieldValue(textFieldValid("hostfamily", "addr1", "text")); 
      var City = GetFieldValue(textFieldValid("hostfamily", "city", "text")); 
      var State = GetFieldValue( textFieldValid("hostfamily", "state", "text")); 
      var Zip = GetFieldValue( textFieldValid("hostfamily", "zip", "text")); 
      var Phone = GetFieldValue( textFieldValid("hostfamily", "phone", "text")); 
      var email = GetFieldValue( textFieldValid("hostfamily", "email", "text"));
      var FirstName = GetFieldValue( textFieldValid("hostfamily", "firstname", "text")); 
      var LastName = GetFieldValue( textFieldValid("hostfamily", "lastname", "text")); 
      var faxValid = GetFieldValue(textFieldValid("hostfamily", "fax", "text")); 
      var addDataBoolean= Add && City && State && Zip 
      var isvalidAdd =true;
      
      
      var NameValid =FirstName || LastName
      if (! (NameValid && (Phone|| email||faxValid)))
      {
          var FirstNameValid = highlightLabel("fname", textFieldValid("hostfamily", "firstname", "text")); 
          var LastNameValid = highlightLabel("lname", textFieldValid("hostfamily", "lastname", "text"));
      }
      else
      {
        setNormalState("fname");
        setNormalState("lname");
      }
     
       if ( !(Phone|| email || faxValid))
       { 
       
       
       if (!addDataBoolean)
       {
   
       var AddValid = highlightLabel("address", textFieldValid("hostfamily", "addr1", "text")); 
       var CityValid = highlightLabel("city", textFieldValid("hostfamily", "city", "text")); 
       var StateValid = highlightLabel("state", textFieldValid("hostfamily", "state", "text")); 
       var ZipValid = highlightLabel("zip", textFieldValid("hostfamily", "zip", "text"));
       var PhoneValid = highlightLabel("homephone", textFieldValid("hostfamily", "phone", "text"));  
       var emailValid = highlightLabel("email", textFieldValid("hostfamily", "email", "text"));
        var faxCodeValid = highlightLabel("fax", textFieldValid("hostfamily", "fax", "text"));
        isvalidAdd= false;
       } 
       else
       { 
       setNormalState("address");
       setNormalState("city");
       setNormalState("state");
       setNormalState("zip");
       setNormalState("email");
       setNormalState("homephone");
       setNormalState("fax");
       }
       
       } 
     else 
     {
   
       setNormalState("address");
       setNormalState("city");
       setNormalState("state");
       setNormalState("zip");
       setNormalState("email");
       setNormalState("homephone");
        setNormalState("fax");
        
     }
     
     // var faxValid = highlightLabel("fax", textFieldValid("hostfamily", "fax", "number")); 
     //var chkBox= highlightLabel("EHP", IfNotChecked()); 
      
      if(NameValid   && isvalidAdd) {
         return true; 
         }
      else {
      alert("Please fill out the required information as indicated by the red text.");
         return false; 
         }
        }
        
        else if (step==2)
        
        {
        
      var Add = GetFieldValue(textFieldValid("hostfamily", "addr1", "text")); 
      var City = GetFieldValue(textFieldValid("hostfamily", "city", "text")); 
      var State = GetFieldValue( textFieldValid("hostfamily", "state", "text")); 
      var Zip = GetFieldValue( textFieldValid("hostfamily", "zip", "text")); 
      var Phone = GetFieldValue( textFieldValid("hostfamily", "phone", "text")); 
      var email = GetFieldValue( textFieldValid("hostfamily", "email", "text")); 
        var FirstName = GetFieldValue( textFieldValid("hostfamily", "firstname", "text")); 
      var LastName = GetFieldValue( textFieldValid("hostfamily", "lastname", "text")); 
        var faxValid = GetFieldValue( textFieldValid("hostfamily", "fax", "text")); 
      var addDataBoolean= Add && City && State && Zip 
      var isvalidAdd =true;
        
      var NameValid =FirstName || LastName
      
      if (! (NameValid && (Phone|| email || faxValid)))
      {
          var FirstNameValid = highlightLabel("fname", textFieldValid("hostfamily", "firstname", "text")); 
          var LastNameValid = highlightLabel("lname", textFieldValid("hostfamily", "lastname", "text"));
      }
      else
      {
        setNormalState("fname");
        setNormalState("lname");
      }
       
           if ( !(Phone|| email || faxValid))
       { 
       if (!addDataBoolean)
       {
       var AddValid = highlightLabel("address", textFieldValid("hostfamily", "addr1", "text")); 
       var CityValid = highlightLabel("city", textFieldValid("hostfamily", "city", "text")); 
       var StateValid = highlightLabel("state", textFieldValid("hostfamily", "state", "text")); 
       var ZipValid = highlightLabel("zip", textFieldValid("hostfamily", "zip", "text"));
       var PhoneValid = highlightLabel("homephone", textFieldValid("hostfamily", "phone", "text"));  
       var emailValid = highlightLabel("email", textFieldValid("hostfamily", "email", "text"));
       var faxCodeValid = highlightLabel("fax", textFieldValid("hostfamily", "fax", "text"));

        isvalidAdd= false;
       } 
       else
       { 
       setNormalState("address");
       setNormalState("city");
       setNormalState("state");
       setNormalState("zip");
       setNormalState("email");
       setNormalState("homephone");
        setNormalState("fax");
       }
       } 
     else 
     {
   
       setNormalState("address");
       setNormalState("city");
       setNormalState("state");
       setNormalState("zip");
       setNormalState("email");
       setNormalState("homephone");
        setNormalState("fax");
        
     }
        //var faxValid = highlightLabel("fax", textFieldValid("hostfamily", "fax", "text")); 
      //var chkBox= highlightLabel("EHP", IfNotChecked()); 
      if(NameValid  && isvalidAdd) {
         return true; 
         }
      else {
      alert("Please fill out the required information as indicated by the red text.");
         return false; 
         }
        }
        else if(step==3)
        {
        
              var Add = GetFieldValue(textFieldValid("hostfamily", "addr1", "text")); 
              var City = GetFieldValue(textFieldValid("hostfamily", "city", "text")); 
              var State = GetFieldValue( textFieldValid("hostfamily", "state", "text")); 
              var Zip = GetFieldValue( textFieldValid("hostfamily", "zip", "text")); 
              var Phone = GetFieldValue( textFieldValid("hostfamily", "phone", "text")); 
              var email = GetFieldValue( textFieldValid("hostfamily", "email", "text")); 
              var FirstName = GetFieldValue( textFieldValid("hostfamily", "firstname", "text")); 
              var LastName = GetFieldValue( textFieldValid("hostfamily", "lastname", "text")); 
              var faxValid = GetFieldValue( textFieldValid("hostfamily", "fax", "text")); 
              var addDataBoolean= Add && City && State && Zip 
               var isvalidAdd =true;
      
                var NameValid =FirstName || LastName
      if (! (NameValid && (Phone|| email || faxValid)))
      {
          var FirstNameValid = highlightLabel("fname", textFieldValid("hostfamily", "firstname", "text")); 
          var LastNameValid = highlightLabel("lname", textFieldValid("hostfamily", "lastname", "text"));
      }
      else
      {
        setNormalState("fname");
        setNormalState("lname");
      }
      
             if ( !(Phone|| email || faxValid))
       { 
       if (!addDataBoolean)
       {
       var AddValid = highlightLabel("address", textFieldValid("hostfamily", "addr1", "text")); 
       var CityValid = highlightLabel("city", textFieldValid("hostfamily", "city", "text")); 
       var StateValid = highlightLabel("state", textFieldValid("hostfamily", "state", "text")); 
       var ZipValid = highlightLabel("zip", textFieldValid("hostfamily", "zip", "text"));
       var PhoneValid = highlightLabel("homephone", textFieldValid("hostfamily", "phone", "text"));  
       var emailValid = highlightLabel("email", textFieldValid("hostfamily", "email", "text"));
       var faxCodeValid = highlightLabel("fax", textFieldValid("hostfamily", "fax", "text"));

        isvalidAdd= false;
       } 
       else
       { 
       setNormalState("address");
       setNormalState("city");
       setNormalState("state");
       setNormalState("zip");
       setNormalState("email");
       setNormalState("homephone");
        setNormalState("fax");
       }
       } 
     else 
     {
   
       setNormalState("address");
       setNormalState("city");
       setNormalState("state");
       setNormalState("zip");
       setNormalState("email");
       setNormalState("homephone");
        setNormalState("fax");
        
     }
           
           
      // var faxValid = highlightLabel("fax", textFieldValid("hostfamily", "fax", "number")); 
       //var otherValid =highlightLabel("other", textFieldValid("hostfamily", "txtOther", "text"));
      
//        if(!otherValid)
//        {
//        alert("Please fill out the required information as indicated by the red highlighted fields on the form");
//        return false;}
       
       if(NameValid  && isvalidAdd) {
         return true; 
         }
      else {
            alert("Please fill out the required information as indicated by the red text.");
         return false; 
         
         }}
  }
  
    function setNormalState(labelName)
    {
      var labelTags = document.getElementsByTagName("label");
       for(curLabel in labelTags) {
        if(labelTags[curLabel].attributes) {
            if(labelTags[curLabel].attributes["for"].value == labelName) {
               labelTags[curLabel].style.color = "#663d00";  
               labelTags[curLabel].style.fontWeight="normal";
               return true; 
               }
              
            }
         }
    
    }  
function highlightLabel(labelName, boolFlag) {
 var labelTags = document.getElementsByTagName("label");
   if(!boolFlag) {
   
      
      for(curLabel in labelTags) {
         if(labelTags[curLabel].attributes) {
            if(labelTags[curLabel].attributes["for"].value == labelName) {
               labelTags[curLabel].style.color = "Red";  
               labelTags[curLabel].style.fontWeight="Bold";
               return false; 
               }
              
            }
         else {
            if(labelTags[curLabel].htmlFor == labelName) {
               labelTags[curLabel].className = "invalidHighlight"; 
               return false; 
               }
            }
         }
      }
    
      
   for(curLabel in labelTags) {
         if(labelTags[curLabel].attributes) {
            if(labelTags[curLabel].attributes["for"].value == labelName) {
               labelTags[curLabel].style.color = "#663d00";  
               labelTags[curLabel].style.fontWeight="normal";
               
               }
              
            }}
   return true; 
   
   }
   
/*IE hover incompatibily solution*/
<!--//--><![CDATA[//><!--
sfHover = function() {
	var sfEls = document.getElementById("menudiv").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//--><!]]>


function GetFieldValue( boolFlag) {

   return boolFlag; 
   
   }