function checkEmail()
{   
	if ((theForm.txtEmail.value == "") || (theForm.txtEmail.value == " "))
				{ alert("You must enter your Email Address"); return false; }
	else { return true; }	
}

function ifEmpty(s)
{   
	return ((s == null) || (s.length == 0))
}

function isWhitespace (s)
{   
	var i;
	var whitespace = " \t\n\r";
	
    if (ifEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   

	var c = s.charAt(i);

	if (whitespace.indexOf(c) == -1) return false;
    }
    
    return true;
}

function isEmail (s)
{   
	if (ifEmpty(s)) 
       if (isEmail.arguments.length == 1) return alert('Please Enter Email Address');
       else return (isEmail.arguments[1] == true);
   

    if (isWhitespace(s)) return alert('invalid email1');
    
    var i = 1;
    var sLength = s.length;

    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return alert('Invalid Email Address without  "@" ');
    else i += 2;

    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return alert('Invalid Email Address without  "." ');
    else return true;
}		

function Focus()
{
    document.theForm.txtEmail.focus(); 
}
