function setVisibility(id, visibility)
{
    document.getElementById(id).style.display = visibility;

}

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){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    return false
		 }
 		 return true
}


	// Makes the listed form fields REQUIERED
	function checkForm(formname){

		var isValid = true;

		// Create an array of all fields that need to be checked.
		var fldArray = new Array();
		fldArray[0] = "first_name";
		fldArray[1] = "last_name";
		fldArray[2] = "email_address";

		// Create an array of what should be displayed
		var nameString = new Array();
		nameString[0] = "first name";
		nameString[1] = "last name";
		nameString[2] = "e-mail address";

		// Loop through the array of required fields and ERROR if empty.
		var errorText = "Please fill in or adjust the following fields:\t\n";
		for (var y = 0; y < fldArray.length; y++){
			var theValue = fldArray[y];

			if (document.forms[formname][theValue].value == ""){
				var errorText = errorText + "\n* Your "+ nameString[y];
				isValid = false;
			}
		}

		// This starts the email validation process
		// If your E-mail textbox is not named "email", change it appropriatly in the line below.
		var emailID=document[formname].email_address

		if ((emailID.value==null)||(emailID.value=="")){
			emailID.focus()
			isValid = false
		}
		if (echeck(emailID.value)==false){
			errorText = errorText + "\n* INVALID E-mail address";
			emailID.focus()
			isValid = false
		}

		if (isValid == false){
			alert (errorText);
		}
		return isValid;
	}