/*
   The isEmpty and isWhitespace functions were taken straight from Netscape's JavaScript development site, http://developer.netscape.com.
*/


      // whitespace characters
      var whitespace = " \t\n\r";

      /****************************************************************/

      // Check whether string s is empty.
      function isEmpty(s)
      { return ((s == null) || (s.length == 0)) }

      /****************************************************************/

      function isWhitespace (s)
      {
           var i;

           // Is s empty?
           if (isEmpty(s)) return true;

           // Search through string's characters one by one
           // until we find a non-whitespace character.
           // When we do, return false; if we don't, return true.

           for (i = 0; i < s.length; i++)
           {
                // Check that current character isn't whitespace.
                var c = s.charAt(i);

                if (whitespace.indexOf(c) == -1) return false;
           }

           // All characters are whitespace.
           return true;
      }
     /****************************************************************/

	function isValidEmail(str) {
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	}

      /****************************************************************/

      function ForceEntry(val) {
      	var i = 0;
      	var strInput;
      	var emptyVal = true;
      	while(i<val.length) {
           strInput = new String(val[i].value);
           

           if (isWhitespace(strInput)) {
                alert(val[i+1]);
                i+2;
                emptyVal= false;
           } else
                i+2;
      	}
		return emptyVal;
      }
	/****************************************************************/

      function validateFrm() {
      	
      	var i = 0;
      	var strInput;
      	var emptyVal = true;
      	var tmp;
      	
      	var val = new Array("document.forms[0].FirstName", "Please enter your first name","document.forms[0].LastName", "Please enter your last name","document.forms[0].Email", "Please enter a valid Email","document.forms[0].PropertyAddress", "Please enter the address of your poperty","document.forms[0].City", "Please enter the city of your property","document.forms[0].State", "Please select the state of your property", "document.forms[0].Zip", "Please enter the zip of your property","document.forms[0].SquareFeet", "Please enter the approximate square feet of your property","document.forms[0].propertytype", "Please select your property type","document.forms[0].homeValue", "Please enter your estimated value of your home");
		//alert(val.length);
      	while(i < val.length) {

           strInput = eval(val[i] + ".value");
			
           if (isWhitespace(strInput)) {
                alert(val[i+1]);
                tmp = new String(val[i]);
                eval(val[i] + '.focus()');
                i=i+2;
                emptyVal= false;
                break;
           } else {
           	tmp = new String(val[i]);
           	if(tmp == "document.forms[0].Email") {
           		tmp = eval(val[i] + ".value");
           		if(isValidEmail(tmp) == false) {
           			alert(val[i+1]);
                	eval(val[i] + '.focus()');
           			i=i+2;
           			emptyVal = false;
           			break;
           		}
           	}
           i=i+2;
           }
      	}
		return emptyVal;
    
      }
      