// Function to set up Box 1 Image
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Function to set up Box 1 Image Height and Width
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

// Function to set up Box 2 Text
function MM_setTextOfLayer(objName,x,newText) { //v4.01
	var appName = navigator.appName ;
	if ((appName=="Netscape"))
		{
		  if ((obj=MM_findObj(objName))!=null) with (obj)
			if (document.layers) {document.write(unescape(newText)); document.close();}
			else innerHTML = unescape(newText);
		}
	else
		{
			Box2AreaDiv.innerHTML =unescape(newText);
		}
}

// Function to Preload Images for documents 
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

// Function to Find any element ID on any document 
function MM_findObj(n, d) { //v4.0 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && document.getElementById) x=document.getElementById(n); return x; 
} 

// Function to Submit or Reset any form via an event driven object 
function tmt_formManager(f,c){ 
        if(MM_findObj(f)){eval("MM_findObj('"+f+"')."+c);} 
} 

//Functions for php files
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//start of functions for timer window
function Minutes(data) 
	{
	for (var i = 0; i < data.length; i++)
	if (data.substring(i, i + 1) == ":")
	break;
	return (data.substring(0, i));
	}

function Seconds(data) 
	{
	for (var i = 0; i < data.length; i++)
	if (data.substring(i, i + 1) == ":")
	break;
	return (data.substring(i + 1, data.length));
	}

function Display(min, sec) 
	{
	var disp;
	if (min <= 9) disp = " 0";
	else disp = " ";
	disp += min + ":";
	if (sec <= 9) disp += "0" + sec;
	else disp += sec; 
	return (disp);
	}

function Down() 
	{ 
	sec--;      
	if (sec == -1) { sec = 59; min--; }
	document.timerform.clock.value = Display(min, sec);
	window.status = "You will be redirected in: " + Display(min, sec);
	if (min == 0 && sec == 0) {
	//alert("Your session has timed out.");
	window.location.href = timedouturl;
	}
	else down = setTimeout("Down()", 1000);
	}

function timeIt() 
	{
	min = 1 * Minutes(document.timerform.clock.value);
	sec = 0 + Seconds(document.timerform.clock.value);
	Down(timedouturl);
	}
//end of timer functions
function putFocus(formInst, elementInst) 
	{
		  if (document.forms.length > 0) 
			  {
			   document.forms[formInst].elements[elementInst].value = "";
			   document.forms[formInst].elements[elementInst].focus();
			  }
	}

function tmt_compareField(f1,f2,rule,errorMsg)
	{
		var myErr = "";
		if(eval("MM_findObj('"+f1+"').value"+rule+"MM_findObj('"+f2+"').value"))
			{
				alert(unescape(errorMsg));myErr += 'errorMsg';
				putFocus(0,2);
			}
		document.MM_returnValue = (myErr == "");
	}

<!-- Begin Country Drop Down
var africaArray =  new Array("('Select Country','',true,true)", "('Ethiopia')", "('Somalia')", "('South Africa')", "('Other')"); 
var middleeastArray =  new Array("('Select Country','',true,true)", "('Egypt')", "('Iran')", "('Israel')", "('Kuwait')", "('Lebanon')", "('Morocco')", "('Saudi Arabia')", "('Syria')", "('Turkey')", "('U. A. Emirates')", "('Other')"); 
var asiaArray =  new Array("('Select Country','',true,true)", "('Armenia')", "('Bangladesh')", "('Cambodia')", "('China')", "('India')", "('Indonesia')", "('Japan')", "('Malaysia')", "('Myanmar')", "('Nepal')", "('Pakistan')", "('Philippines')", "('Singapore')", "('South Korea')", "('Sri Lanka')", "('Taiwan')", "('Thailand')", "('Uzbekistan')", "('Vietnam')", "('Other')"); 
var europeArray =  new Array("('Select Country','',true,true)", "('Albania')", "('Austria')", "('Belarus')", "('Belgium')", "('Bosnia')", "('Bulgaria')", "('Croatia')", "('Cyprus')", "('Czech Rep.')", "('Denmark')", "('Estonia')", "('Finland')", "('France')", "('Germany')", "('Greece')", "('Hungary')", "('Iceland')", "('Ireland')", "('Italy')", "('Latvia')", "('Liechtenstein')", "('Lithuania')", "('Luxembourg')", "('Macedonia')", "('Malta')", "('Monaco')", "('Netherlands')", "('Norway')", "('Poland')", "('Portugal')", "('Romania')", "('Russia')", "('Slovakia')", "('Slovenia')", "('Spain')", "('Sweden')", "('Switzerland')", "('Ukraine')", "('United Kingdom')", "('Other')"); 
var australiaArray =  new Array("('Select Country','',true,true)", "('Australia')", "('New Zealand')", "('Other')"); 
var lamericaArray =  new Array("('Select Country','',true,true)", "('Costa Rica')", "('Cuba')", "('El Salvador')", "('Guatemala')", "('Haiti')", "('Jamaica')", "('Mexico')", "('Panama')", "('Other')"); 
var namericaArray =  new Array("('Select Country','',true,true)", "('Canada')", "('USA')", "('Other')"); 
var samericaArray =  new Array("('Select country','',true,true)", "('Argentina')", "('Bolivia')", "('Brazil')", "('Chile')", "('Colombia')", "('Ecuador')", "('Paraguay')", "('Peru')", "('Suriname')", "('Uruguay')", "('Venezuela')", "('Other')"); 
function populateCountry(inForm,selected) 
	{
 		var selectedArray = eval(selected + "Array"); 
		while (selectedArray.length < inForm.country.options.length) 
			{ 
				inForm.country.options[(inForm.country.options.length - 1)] = null; 
			} 
		for (var i=0; i < selectedArray.length; i++) 
			{ 
				eval("inForm.country.options[i]=" + "new Option" + selectedArray[i]); 
			} 
		if (inForm.region.options[0].value == '') 
			{ 
				inForm.region.options[0]= null; 
				if ( navigator.appName == 'Netscape') 
					{ 
						if (parseInt(navigator.appVersion) < 4) 
							{ 
								window.history.go(0); 
							}
						else 
							{   	
								if (navigator.platform == 'Win32' || navigator.platform == 'Win16') 
									{ 
										window.history.go(0);
           							}
         					}
      				}
   			}
	}

function populateUSstate(inForm,selected) 
	{  
	var stateArray =  new Array("('Select State','',true,true)", "('Alabama')", "('Alaska')", "('Arizona')", "('Arkansas')", "('California')", "('Colorado')", "('Connecticut')", "('Delaware')", "('Columbia')", "('Florida')", "('Georgia')", "('Hawaii')", "('Idaho')", "('Illinois')", "('Indiana')", "('Iowa')", "('Kansas')", "('Kentucky')", "('Louisiana')", "('Maine')", "('Maryland')", "('Massachusetts')", "('Michigan')", "('Minnesota')", "('Mississippi')", "('Missouri')", "('Montana')", "('Nebraska')", "('Nevada')", "('New Hampshire')", "('New Jersey')", "('New Mexico')", "('New York')", "('North Carolina')", "('North Dakota')", "('Ohio')", "('Oklahoma')", "('Oregon')", "('Pennsylvania')", "('Rhode Island')", "('South Carolina')", "('South Dakota')", "('Tennessee')", "('Texas')", "('Utah')", "('Vermont')", "('Virginia')", "('Washington')", "('West Virginia')", "('Wisconsin')", "('Wyoming')"); 
	if (selected == 'USA') 
		{ 
		for (var i=0; i < stateArray.length; i++) 
			{ 
				eval("inForm.country.options[i]=" + "new Option" + stateArray[i]); 
			} 
			if ( navigator.appName == 'Netscape') 
				{ 
					if (parseInt(navigator.appVersion) < 4) 
						{
							window.history.go(0)
						}
					else 
						{    	
							if (navigator.platform == 'Win32' || navigator.platform == 'Win16') 
								{
									window.history.go(0)
								}
						}
				}
		}
	else 
		{
			if (selected == 'United Kingdom')
				{ 
				var countyArray = new Array("('Select County','',true,true)", "('Aberdeenshire','Aberdeenshire. UK')","('Anglesey/Sir Fon','Anglesey/Sir Fon. UK')","('Angus/Forfarshire','Angus/Forfarshire. UK')","('Argyllshire','Argyllshire. UK')","('Ayrshire','Ayrshire. UK')","('Banffshire','Banffshire. UK')","('Bedfordshire','Bedfordshire. UK')","('Berkshire','Berkshire. UK')","('Berwickshire','Berwickshire. UK')","('Brecknockshire/Sir Frycheiniog','Brecknockshire/Sir Frycheiniog. UK')","('Buckinghamshire','Buckinghamshire. UK')","('Buteshire','Buteshire. UK')","('Caernarfonshire/Sir Gaernarfon','Caernarfonshire/Sir Gaernarfon. UK')","('Caithness','Caithness. UK')","('Cambridgeshire','Cambridgeshire. UK')","('Cardiganshire/Ceredigion','Cardiganshire/Ceredigion. UK')","('Carmarthenshire/Sir Gaerfyrddin','Carmarthenshire/Sir Gaerfyrddin. UK')","('Cheshire','Cheshire. UK')","('Clackmannanshire','Clackmannanshire. UK')","('Cornwall','Cornwall. UK')","('Cromartyshire','Cromartyshire. UK')","('Cumberland','Cumberland. UK')","('Denbighshire/Sir Ddinbych','Denbighshire/Sir Ddinbych. UK')","('Derbyshire','Derbyshire. UK')","('Devon','Devon. UK')","('Dorset','Dorset. UK')","('Dumfriesshire','Dumfriesshire. UK')","('Dunbartonshire/Dumbartonshire','Dunbartonshire/Dumbartonshire. UK')","('Durham','Durham. UK')","('East Lothian/Haddingtonshire','East Lothian/Haddingtonshire. UK')","('Essex','Essex. UK')","('Fife','Fife. UK')","('Flintshire/Sir Fflint','Flintshire/Sir Fflint. UK')","('Glamorgan/Morgannwg','Glamorgan/Morgannwg. UK')","('Gloucestershire','Gloucestershire. UK')","('Hampshire','Hampshire. UK')","('Herefordshire','Herefordshire. UK')","('Hertfordshire','Hertfordshire. UK')","('Huntingdonshire','Huntingdonshire. UK')","('Inverness-shire','Inverness-shire. UK')","('Isle of Arran','Isle of Arran. UK')", "('Isle of Barra','Isle of Barra. UK')", "('Isle of Benbecula','Isle of Benbecula. UK')", "('Isle of Bute','Isle of Bute. UK')", "('Isle of Canna','Isle of Canna. UK')", "('Isle of Coll','Isle of Coll. UK')", "('Isle of Colonsay','Isle of Colonsay. UK')", "('Isle of Cumbrae','Isle of Cumbrae. UK')", "('Isle of Eigg','Isle of Eigg. UK')", "('Isle of Gigha','Isle of Gigha. UK')", "('Isle of Harris','Isle of Harris. UK')", "('Isle of Iona','Isle of Iona. UK')", "('Isle of Jura','Isle of Jura. UK')", "('Isle of Lewis','Isle of Lewis. UK')", "('Isle of Mull','Isle of Mull. UK')", "('Isle of North Uist','Isle of North Uist. UK')","('Kent','Kent. UK')","('Kincardineshire','Kincardineshire. UK')","('Kinross-shire','Kinross-shire. UK')","('Kirkcudbrightshire','Kirkcudbrightshire. UK')","('Lanarkshire','Lanarkshire. UK')","('Lancashire','Lancashire. UK')","('Leicestershire','Leicestershire. UK')","('Lincolnshire','Lincolnshire. UK')","('Merioneth/Meirionnydd','Merioneth/Meirionnydd. UK')","('Merseyside','Merseyside. UK')","('Middlesex','Middlesex. UK')","('Midlothian/Edinburghshire','Midlothian/Edinburghshire. UK')","('Monmouthshire/Sir Fynwy','Monmouthshire/Sir Fynwy. UK')","('Montgomeryshire/Sir Drefaldwyn','Montgomeryshire/Sir Drefaldwyn. UK')","('Morayshire','Morayshire. UK')","('Nairnshire','Nairnshire. UK')","('Norfolk','Norfolk. UK')","('Northamptonshire','Northamptonshire. UK')","('Northumberland','Northumberland. UK')","('Nottinghamshire','Nottinghamshire. UK')","('Orkney','Orkney. UK')","('Oxfordshire','Oxfordshire. UK')","('Peeblesshire','Peeblesshire. UK')","('Pembrokeshire/Sir Benfro','Pembrokeshire/Sir Benfro. UK')","('Perthshire','Perthshire. UK')","('Radnorshire/Sir Faesyfed','Radnorshire/Sir Faesyfed. UK')","('Renfrewshire','Renfrewshire. UK')","('Ross-shire','Ross-shire. UK')","('Roxburghshire','Roxburghshire. UK')","('Rutland','Rutland. UK')","('Selkirkshire','Selkirkshire. UK')","('Shetland','Shetland. UK')","('Shropshire','Shropshire. UK')","('Somerset','Somerset. UK')","('Staffordshire','Staffordshire. UK')","('Stirlingshire','Stirlingshire. UK')","('Suffolk','Suffolk. UK')","('Surrey','Surrey. UK')","('Sussex','Sussex. UK')","('Sutherland','Sutherland. UK')","('Warwickshire','Warwickshire. UK')","('West Lothian/Linlithgowshire','West Lothian/Linlithgowshire. UK')","('Westmorland','Westmorland. UK')","('Wigtownshire','Wigtownshire. UK')","('Wiltshire','Wiltshire. UK')","('Worcestershire','Worcestershire. UK')","('Yorkshire','Yorkshire. UK')");
					for (var i=0; i < countyArray.length; i++) 
						{ 
							eval("inForm.country.options[i]=" + "new Option" + countyArray[i]); 
						} 
				}
		}  
	if (selected == 'Other') 
		{
			newCountry = "";
			while (newCountry == "")
			{
				newCountry=prompt ("Please enter the name of your country.", ""); 
			} 
			if (newCountry != null) 
				{ 
					inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
					inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
   				}
			}
			if(inForm.country.options[0].text == 'Select country') 
				{ 
					inForm.country.options[0]= null;
   				}
   
			}
// End Country Populate-->
//Login page functions
function explain(name, output, msg) 
 {
 newwin = window.open('','','top=100,left=100,width=350,height=350');
 if (!newwin.opener) newwin.opener = self;
   {
    txtType = "text";
   }
  with (newwin.document)
  {
  open();
  write('<html><title>Login Help</title><link href="CSSstyles/Instro.css" rel="stylesheet" type="text/css"></head>');
  write('<body onLoad="document.form.box.focus()" ><span class="medium"><form name=form>' + msg + '<br>'); 
  write('<p>You may enter your ' + name + ' here and it will be copied into the form for you.');
  write('<p><center>' + name + ':  <input type= ' + txtType + ' name=box size=30 onKeyUp=' + output + '=this.value>'); 
  write('<p><input type=button value="Close" onClick=window.close()>'); 
  write('</center></form></span></body></html>');
  close();
     }
 }

//start of Confirm page functions
function copy()
	{
	//document.write("<B>Thanks for visiting us from ");
	var docRef = document.referrer;
	document.download.FileUrl.value = docRef;
	//document.write(docRef+"</B>");
	}
	
function textCounter(field, countfield, maxlimit)
	{
	if (field.value.length > maxlimit) 
	// if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	else 
	// otherwise, update 'characters left' counter
	countfield.value = maxlimit - field.value.length;
	}

function MM_goToURL()
	{ //v3.0
  	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}
