

function amtacOnce() {

  for (i=0; i<document.forms.length; i++) {

/* create a new property of the Form that tracks whether the Form has been submitted*/

   document.forms[i].notSubmittedYet = true;
   if (document.forms[i].onsubmit) {
    var oldHandler = new String(document.forms[i].onsubmit)

/*  oldHandler will be something like this, depending on the browser in use,
*   and the name of the Form:
*
*   "function anonymous() { return FrontPage_Form1_Validator(this); }"
*
*   We need to extract just the "FrontPage_Form1_Validator(this)" part
*/

    //find "Validator"
    var validatorIndex = oldHandler.indexOf("Validator");

    //if "Validator" not found, then abort
    if (validatorIndex<0) return;

    //find space before name of validator function
    var startIndex = oldHandler.lastIndexOf(" ",validatorIndex)

    // if space not found, abort
    if (startIndex<0) return;

    // find final parenthesis
    var endIndex = oldHandler.indexOf(")",validatorIndex);

    //if parenthesis not found, abort
    if (endIndex<0) return;

    // create a String for the name of the validator function,
    // and store it as a new property of the Form
    document.forms[i].oldValidator = new String(oldHandler.slice(startIndex,endIndex+1));

    /* oldValidator is something like this:
    * "FrontPage_Form1_Validator(this);"

    */
   }

   else {  //Form did not have an onSubmit handler previously
   	 document.forms[i].oldValidator = new String("true;");
	}

   //substitute our own onSubmit handler for the one FrontPage created
   document.forms[i].onsubmit = enhancedValidator;

  }

} 

function enhancedValidator() {

 /* This is our new validator function.
 * It first calls the FrontPage validator for the Form.
 * If that returns TRUE, it then checks whether the Form
 * has already been submitted.
 * If it has been, we do not submit it again.
 */

 if (eval(this.oldValidator.valueOf())) { // is FrontPage validation successful?

  if (this.notSubmittedYet) {  //did user click Submit already?
   this.notSubmittedYet = false;
   return true; // submit form
  }

  else { // form already submitted; complain to user
   alert("Thanks, you have already clicked once.  Please be patient. \nThe Internet has had a busy day and is a little tired, but as \nsoon as it catches its breath, things will happen as you expected.");
   return false;  // don't submit form
  }

 }

 else { // FrontPage validator found error
  return false;  // don't submit form
 }

}

var sorry="WARNING - These pages are copyright and the underlying code protected by law and international convention. Actions on this site are logged and violations will be prosecuted.";

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(sorry);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(sorry);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

function targetNew(newURL,ID) {
window.open(newURL,ID,'width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
}



function charCounter(field,maxlimit,wn,rn) {
// checked field, max allowed characters, warningname, remainingname 
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
document.getElementById(wn).innerHTML = field.value.length;
document.getElementById(rn).innerHTML = maxlimit - field.value.length;
}



var request = null;
function loadURL(url,targetDIV)
{
	var content = '';
	var value = false;
	if (window.XMLHttpRequest) 
	{
		request = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (request)
	{
		request.open("GET", url, false);
		request.send(null);
		if (request.status == 200)
		{
			content = request.responseText;
			value = true;
		}
		else
		{
			content = 'Error: ' + request.status + ' ' + request.statusText;
		}
	}
	
	// Set the contents of the div
	document.getElementById(targetDIV).innerHTML = content;

	return value;
	
}

var request = null;


