



// Real Browser Detect Script
IF_NS4 = (document.layers) ? true:false;         // netscape 4
IF_IE4 = (document.all) ? true:false;            // ie4+
IF_DOM = (document.getElementById) ? true:false; // ns6 etc.



// Change browser status.
// Usage: onMouseEvent="IF_changeStatus('your message');return true;" onMouseOut="IF_unChangeStatus();return true;" 
var oldMsg;
function IF_changeStatus(msg){
	oldMsg = self.status;
	self.status=msg;
};
function IF_unChangeStatus(){self.status=oldMsg;};



// Swap this object's background color
// Usage: onMouseOver="IF_swapThisBGColor(this,'Hex color value');return true;" onMouseOut="IF_unSwapThisBGColor(this);return true;" 
var ifUnSwapColor;
function IF_swapThisBGColor(whatItIs,swapColor){
	ifUnSwapColor=whatItIs.style.backgroundColor;
	if(IF_DOM){whatItIs.style.backgroundColor=swapColor;
	}else if(IF_IE4&&whatItIsem==this){whatItIs.style.backgroundColor=swapColor;
	};
};
function IF_unSwapThisBGColor(whatItIs){
	if(IF_DOM){whatItIs.style.backgroundColor=ifUnSwapColor;
	}else if(IF_IE4&&whatItIs==this){whatItIs.style.backgroundColor=ifUnSwapColor;
	};
};



// Title: Clear values of all form elements except buttons for all forms.
// Desc: Loops through all document.forms[] and clears all cheks and values if !submit || !button || !reset.
// Usage: onEvent="clearAllForms();"
function clearAllForms () {
	// find how many forms there are in the doument
	var f = document.forms.length;
	// if there is a form...
	if (f >= 1) {
		//loop through all the forms in the document
		for (var i = 0; i < f; i++) {
			// find out how many elements there are in the form
			var el = document.forms[i].elements.length;
			// if there are elements in this form...
			if (el >= 1){
				//loop through all the elements in the form
				for (var n = 0; n < el; n++) {
					// clear all checks and values
					var e = document.forms[i].elements[n];
					if ((e.type != 'submit') && (e.type != 'button') && (e.type != 'reset')) e.value = "";
					if ((e.type == 'checkbox') || (e.type == ('radio'))) {
						if (e.checked) e.checked = false;
					};
				};
			};
		};
	};
};



// Title: Hide all form buttons.
// Desc: Loops through all document.forms[] and hides all bypes that == button || submit || reset.
// Usage: onEvent="clearAllForms();"
function disableAllFormButtons() {
	if (IF_DOM) {
		var f = document.forms.length;
		if (f >= 1) {
			for (var i = 0; i < f; i++) {
				var el = document.forms[i].elements.length;
				if (el >= 1){
					for (var n = 0; n < el; n++) {
						var e = document.forms[i].elements[n];
						if (e.type == 'button') if (IF_DOM) e.style.display = 'none';
						if (e.type == 'submit') if (IF_DOM) e.style.display = 'none';
						if (e.type == 'reset') if (IF_DOM) e.style.display = 'none';
					};
				};
			};
		};
	};
};



// Title: Form Lock/Unlock
// Desc: makes it necessarry to manually activate the form submit button to submit a form. Enter key will not work on first press. Note: Enter key will work on 2nd press.
/* Usage:
			<form name="" method="" action="" onSubmit="return formSubmit();">
			<input type="submit" value="" class="" onMouseOver="formUnlock();" onMouseOut="formLock();" onFocus="formUnlock();" onBlur="formLock();">
*/
var isFormLocked = 1; //1 == locked, 0 == unlocked
function formUnlock () {
	isFormLocked = 0;
};

function formLock () {
	isFormLocked = 1;
};

function formSubmit (whichForm) {
	if (isFormLocked == 0) {
		return true;
	} else {
		return false;
	};
};


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 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_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 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);