/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var strAlert="Invalid E-mail address."
		
		if (str.indexOf(at)==-1){
		   alert(strAlert)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(strAlert)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(strAlert)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(strAlert)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(strAlert)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(strAlert)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(strAlert)
		    return false
		 }

 		 return true					
	}
	
      // 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 ForceEntry(val, str) {
           var strInput = new String(val.value);

           if (isWhitespace(strInput)) {
                alert(str);
                return false;
           } else
                return true;

      }
      
function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function ForceRadioEntry(btn, str) {
	if (valButton(btn) == null) {
        alert(str);
        return false;
   } else
        return true;

}
