<!--// JavaScript Document
///////////////////////////////////////////BASIC UTILITY CODE///////////////////////////////////////////
function togNewTown(theSelect)//Makes available form fields for registering a new town/area/country.
{
 var e = document.esign;
 if (theSelect.value == 'other')
 {
  if (theSelect.id == 'townID') {e.otherTown.disabled = false; e.areaID.disabled = false;}
  if (theSelect.id == 'areaID') {e.otherAree.disabled = false; e.countryID.disabled = false;}
  if (theSelect.id == 'countryID') {e.otherCountry.disabled = false;}
 }
 else 
 {
  if (theSelect.id == 'townID') {e.otherTown.disabled = true; e.areaID.disabled = true;}
  if (theSelect.id == 'areaID') {e.otherAree.disabled = true; e.countryID.disabled = true;}
  if (theSelect.id == 'countryID') {e.otherCountry.disabled = true;}
 }
}

function togElement(theTrigger, theElement)//Makes disabled form fields available.
{
 if (theTrigger.value == 'other') {theElement.disabled = false;}
 else {theElement.disabled = true;}
}

function blankIt(theElement, theText)//Clears the contents of the requested element, dependent on value.
{if (theElement.value == theText) {theElement.value = '';}}

///////////////////////////////////////////HTTP REQUEST CODE///////////////////////////////////////////
function setRequester()//Makes the xmlhttp request object.
{
 var xmlHttp;
 try {xmlHttp = new XMLHttpRequest();}//Firefox, Opera 8.0+, IE7, Safari
 catch (e) 
     {try{xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');}//Internet Explorer 6+
      catch (e)
         {try{xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');}//Internet Explorer 5-
          catch (e) {alert('Your browser does not support AJAX!');  return false;}//All others
         }
     }
 return xmlHttp;
}

function getContents(theID, theAsp, part)//Posts the form to the relevant Script.asp via xmlHttp.
{
 var requester;  var e = document.esign;  var formValues = 'theID='+theID+'&ClientID='+theID;
 requester = setRequester();
 requester.onreadystatechange = function () {
	 if(requester.readyState == 4 && requester.status == 200) {
		 document.getElementById(part).innerHTML = requester.responseText; xmlHttp = null;
		 }
	}
 requester.open('POST',theAsp,true);
 requester.setRequestHeader('Content-type','application/x-www-form-urlencoded');
 requester.setRequestHeader("Content-length",formValues.length);
 requester.send(formValues);
}

function updateDB(theID, theAsp, part)//Posts the form for updating DB and reviewing updated record.
{
 var requester;  var e = document.esign;
 //debugging
 //alert(e.authid.value);
 //alert(e.drop.checked);
 //alert(e.pick.checked);
 //alert(e.submitMe.value);
 //alert(theID);
 //end debugging
 var formValues = 'theID='+theID+'&authid='+escape(e.authid.value)+'&drop='+escape(e.drop.checked)+'&pick='+e.pick.checked+'&submitMe='+escape(e.submitMe.value);
 requester = setRequester();
 requester.onreadystatechange = function () {
	 if(requester.readyState == 4 && requester.status == 200) {
		 document.getElementById(part).innerHTML = requester.responseText; xmlHttp = null;
		 }
	}
 requester.open('POST',theAsp,true);
 requester.setRequestHeader('Content-type','application/x-www-form-urlencoded');
 requester.setRequestHeader("Content-length",formValues.length);
 requester.send(formValues);
}

-->