//<script type="text/javascript"> - fool text editor

    // 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) || strInput == "http://") {
		    alert(str);
		    if (val.focus)val.focus()
		    return false;
		} else
		    return true;
    }	
    
    function MatchEntry(val, val2, str) 
    {
		if (val.value != val2.value) {
			alert(str);
			if (val2.focus)val2.focus()
		    return false;
		} else
			return true;
	}	

    function ValidEmail(val, str) 
    {
		var val = new String(val.value);
		if (val.indexOf("@") < 0) {
			alert(str);
			if (val.focus)val.focus()
		    return false;
		} else if (val.indexOf(".") < 0) {
			alert(str);
			if (val.focus)val.focus()
		    return false;
		} else if (val.indexOf("@") > val.lastIndexOf(".") ) {
			alert(str);
			if (val.focus)val.focus()
		    return false;
		} else 
			return true;
	}	

    function ValidateData(obj) {//obj holds form
		var CanSubmit = false;

        CanSubmit = ForceEntry(obj.url,"You must supply a website for us to link to.");
					  
        if (!CanSubmit) return false
		else
		{	
			CanSubmit = ForceEntry(obj.anchor,"You must supply anchor text. \nWARNING: This is for the search engines.");
        }
        
        if (!CanSubmit) return false
		else
		{	
			CanSubmit = ForceEntry(obj.description,"You should supply a description for your website.");
        }
		
        if (!CanSubmit) return false
		else
		{	
			CanSubmit = ForceEntry(obj.reppage,"Please select which page you want your link to appear.");
        }
       
        if (!CanSubmit) return false
		else
		{	
				CanSubmit = ForceEntry(obj.linkpage,"You must supply the page where our link is present. \nThis will be cheked now.");
        }
       
	    if (!CanSubmit) return false
		else
		{	
				CanSubmit = ForceEntry(obj.email,"You must supply an email address.");
        }
	
		if (!CanSubmit) return false
		else
		{	
				CanSubmit = ForceEntry(obj.n,"Please supply your name for our records.");
        }
		
		if (!CanSubmit) return false
		else
		{	
				CanSubmit = ValidEmail(obj.email,"You must supply a valid email address.");
        }
		

        

        return CanSubmit;
    }

