function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;}
}
	if (document.images) {
		n_bh = newImage("images/n_bh.gif");
		}

function sh_item(where) {
	if (document.images) {
		storedLocation=where;
		document.images["n"+where].src="images/n_bh.gif"; 
	}
}
function hd_item() {
	if (document.images) {
		where=storedLocation;
		document.images["n"+where].src="images/n_b.gif"; }
}

function valid_Register(theForm)
{

	var validChar = /[a-zA-Z]/;
	var validPhone = /[0-9]\-/;
	if(theForm.txtName.value.length < 3)
	{
		alert("Please enter the name of the person we should contact.");
		theForm.txtName.focus();
		return false;
	}
	if(!validChar.test(theForm.txtName.value))
	{
		alert("Please enter the name of the person we should contact.");
		theForm.txtName.focus();
		return false;
	}
	
	if(theForm.txtPhone.value == "")
	{
		alert("Please enter a phone number.");
		theForm.txtPhone.focus();
		return false;
	}
	if(validPhone.test(theForm.txtPhone.value))
	{
		alert("The phone number should be in the format xxx-xx-xxxx.");
		theForm.txtPhone.focus();
		return false;
	
	}
	if(theForm.txtEmail.value == "")
	{
		alert("Please enter an Email Address");
		theForm.txtEmail.focus();
		return false;
	}
	if(echeck(theForm.txtEmail.value) == false)
	{
		theForm.txtEmail.focus();
		return false;
	}
	if(theForm.txtPassword.value != theForm.txtConfirm.value)
	{
		alert("Your passwords do not match.");
		theForm.txtConfirm.focus();
		return false;
	}
	return true;
	
	
}
function validEmail(theForm)
{
	if(theForm.txtEmail.value == "")
	{
		alert("Please enter an Email Address");
		theForm.txtEmail.focus();
		return false;
	}
	if(theForm.txtComment.value =="")
	{
		alert("Please enter your question or comments");
		theForm.txtComment.focus();
		return false;
	}
	return true;	
		
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
	
	function notLoggedIn()
	{
		alert('You are not logged in. Please go back to the login page.');
	}
