// JavaScript Document

// 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;
      }


/****************************************************************/

// Checks to see if a required field is blank.  If it is, a warning
// message is displayed...

function ForceEntry(objField, FieldName)
{
	var strField = new String(objField.value);
	if (isWhitespace(strField)) {
		alert("Please enter " + FieldName);
		objField.focus();
		objField.select();
		return false;
	}

	return true;
}
		
/****************************************************************/
// -----------------------------------------------------------------
// Function    : IsEmailValid
// Language    : JavaScript
// Description : Checks if given email address is of valid syntax
// Copyright   : (c) 1998 Shawn Dorman
// http://www.goodnet.com/~sdorman/web/IsEmailValid.html
// -----------------------------------------------------------------
// Ver    Date    Description of modification
// --- ---------- --------------------------------------------------
// 1.0 09/04/1996 Original write
// 1.1 09/30/1998 CHG: Use standard header format
// -----------------------------------------------------------------
// Source: Webmonkey Code Library
// (http://www.hotwired.com/webmonkey/javascript/code_library/)
// -----------------------------------------------------------------

function IsEmailValid(FormName,ElemName)
{
var EmailOk  = true
var Temp     = document.forms[FormName].elements[ElemName]
var AtSym    = Temp.value.indexOf('@')
var Period   = Temp.value.lastIndexOf('.')
var Space    = Temp.value.indexOf(' ')
var Length   = Temp.value.length - 1   // Array is from 0 to length-1

if ((AtSym < 1) ||                     // '@' cannot be in first position
    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
    (Period == Length ) ||             // Must be atleast one valid char after '.'
    (Space  != -1))                    // No empty spaces permitted
   {  
      EmailOk = false
      alert('Please enter a valid E-mail address!')
      Temp.focus()
   }
return EmailOk
}


function ValidateDataC() {
           var CanSubmit = false;
           var CheckOk = true;

           // Check to make sure that the first name field is not empty.
           CanSubmit = ForceEntry(document.forms[0].name,"Your Name.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
						
           	  CanSubmit = ForceEntry(document.forms[0].company,"Organisation.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
			CanSubmit = IsEmailValid("form1","email");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
           	 	  CanSubmit = ForceEntry(document.forms[0].tel,"You Telephone.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
					 CanSubmit = ForceEntry(document.forms[0].message,"Your comments.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
						   
           	              
           return CanSubmit;
      }
//
function ValidateData() {
           var CanSubmit = false;
           var CheckOk = true;

           // Check to make sure that the first name field is not empty.
           CanSubmit = ForceEntry(document.forms[0].name,"Your Name.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
           	  CanSubmit = ForceEntry(document.forms[0].surname,"Your Surname.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
			CanSubmit = IsEmailValid("form1","email");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
           	    
           	              
           return CanSubmit;
      }

function ValidateDataN() {
           var CanSubmit = false;
           var CheckOk = true;

           // Check to make sure that the first name field is not empty.
           CanSubmit = ForceEntry(document.forms[0].name,"Your Name.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
						
           	  CanSubmit = ForceEntry(document.forms[0].company,"Organisation.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
			CanSubmit = IsEmailValid("form1","email");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
           	 	  CanSubmit = ForceEntry(document.forms[0].site,"site you are nominating.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
					 CanSubmit = ForceEntry(document.forms[0].message,"Your reasons to nominate this website.");
           if (CanSubmit) {
           	CheckOk = CheckOk;
           	}else{
           	return false;
           	}
						   
           	              
           return CanSubmit;
      }
			