function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
			{alert(alerttxt);return false}
		else {return true}
	}
}

function toggleLayer(whichLayer)
{
	 if (document.getElementById)
	 {
		  // this is the way the standards work
		  var style2 = document.getElementById(whichLayer).style;
		  style2.display = style2.display? "":"block";
	 }
	 else if (document.all)
	 {
		  // this is the way old msie versions work
		  var style2 = document.all[whichLayer].style;
		  style2.display = style2.display? "":"block";
	 }
	 else if (document.layers)
	 {
		  // this is the way nn4 works
		  var style2 = document.layers[whichLayer].style;
		  style2.display = style2.display? "":"block";
	 }
}

	function verifyPW(field1, field2, result_id, match_html, nomatch_html) {
	 this.field1 = field1;
	 this.field2 = field2;
	 this.result_id = result_id;
	 this.match_html = match_html;
	 this.nomatch_html = nomatch_html;
	
	 this.check = function() {
	
	   // Make sure we don't cause an error
	   // for browsers that do not support getElementById
	   if (!this.result_id) { return false; }
	   if (!document.getElementById){ return false; }
	   r = document.getElementById(this.result_id);
	   if (!r){ return false; }
	
	   if (this.field1.value != "" && this.field1.value == this.field2.value) {
		 r.innerHTML = this.match_html;
	   } else {
		 r.innerHTML = this.nomatch_html;
	   }
	 }
	}
	//Gets the browser specific XmlHttpRequest Object
	function getXmlHttpRequestObject() {
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest(); //Not IE
		} else if(window.ActiveXObject) {
			return new ActiveXObject("Microsoft.XMLHTTP"); //IE
		} else {
			//Display your error message here. 
			//and inform the user they might want to upgrade
			//their browser.
			alert("Your browser doesn't support the XmlHttpRequest object.  Better upgrade to Firefox or IE 6+.");
		}
	}			
	//Get our browser specific XmlHttpRequest object.
	var receiveReq = getXmlHttpRequestObject();		
	//Initiate the asyncronous request.
	function displayForm(spanname) {
		//Check to see if the XmlHttpRequests state is finished.
		if (receiveReq.readyState == 4) {
			//Set the contents of our span element to the result of the asyncronous call.
			document.getElementById(spanname).innerHTML = receiveReq.responseText;
		}
	}
	function slinkMenu(fieldName) {
		//If our XmlHttpRequest object is not in the middle of a request, start the new asyncronous call.
		// catName = document.cat_form.catName.value;
		// var smenu = "slink-" + slinkID ;
		catID = document.getElementById(fieldName).value;
		if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
			//Setup the connection as a GET call to SayHello.html.
			//True explicity sets the request to asyncronous (default).
			var spanname = "menu-" + fieldName;
			var file_to_open = "./ajax.php?a=slinkmenu&f=" + fieldName + "&c=" + catID;
			receiveReq.open("GET", file_to_open, true);
			//Set the function that will be called when the XmlHttpRequest objects state changes.
			receiveReq.onreadystatechange = function(){displayForm(spanname)};
			//Make the actual request.
			receiveReq.send(null);
		}			
	}

