<!--
// Constants

//alert("in the /script/");


function ValidateForm(form)
{

 if (form.First_Name.value == "") 
	{
    		alert( "Please enter your First Name" );
    		form.First_Name.focus();
	   	return false ;
	}
 if (form.Last_Name.value == "") 
	{
    		alert( "Please enter your Last Name" );
    		form.Last_Name.focus();
   		 return false ;
	}

 if (form.EMail.value == "") 
	{
    		alert( "Please enter your Email Address" );
    		form.EMail.focus();
   		 return false ;
	}

if (!isEmail(form.EMail.value))
{
    		alert( "Please enter a valid Email Address" );
    		form.EMail.focus();
   		 return false ;
}

return true;

}


var errEmail='Please enter your Email address in the format: EmailId@Isp.Domain.\n';

// whitespace characters
var cWhitespace = " \t\n\r";

// constants
var sNewClient = "NewClient";
var sLogin = "Login";


// Returns true if string sStr is empty or 
// whitespace characters only.

function isWhitespace (sStr){

	var i;
	var cChar;

    if (isEmpty(sStr)) 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 < sStr.length; i++)
    {   
        // Check that current character isn't whitespace.
        cChar = sStr.charAt(i);

        if (cWhitespace.indexOf(cChar) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

// Check whether string sStr is empty.

function isEmpty(sStr){
	return ((sStr == null) || (sStr.length == 0))
}

// Display prompt string sPrompt in status bar.
function Prompt (sPrompt){
   window.status = sPrompt;
}


function isEmail (sStr) {
   
    // is sStr whitespace?
    if (isWhitespace(sStr)) return false;
    
    // there must be >= 1 character before @, so look at character position 1 (i.e. second character)
    var i = 1;
    var iLength = sStr.length;

    // look for @
    while ((i < iLength) && (sStr.charAt(i) != "@")){
		i++;
    }

    if ((i >= iLength) || (sStr.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < iLength) && (sStr.charAt(i) != ".")){
		i++
    }

    // there must be at least one character after the .
    if ((i >= iLength - 1) || (sStr.charAt(i) != "."))
		return false;
    else
		return true;
}

function isPassword (sStr) {
   
    if (isWhitespace(sStr)) return false;
    
	if (sStr.length<3) return false;

	return true;
}

// Returns true if string sStr is empty or 
// whitespace characters only.

function isWhitespace (sStr){

	var i;
	var cChar;

    if (isEmpty(sStr)) 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 < sStr.length; i++)
    {   
        // Check that current character isn't whitespace.
        cChar = sStr.charAt(i);

        if (cWhitespace.indexOf(cChar) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

// Check whether string sStr is empty.

function isEmpty(sStr){
	return ((sStr == null) || (sStr.length == 0))
}

// Display prompt string sPrompt in status bar.
function Prompt (sPrompt){
   window.status = sPrompt;
}

//-->


