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];}
}


//=============================================================================
// FOCUS
function setFocusOnLoad(vstrControlID) {
	var blnSet = false;

	if (vstrControlID != null) {
		var objControl = new getObj(vstrControlID).obj;
		if (objControl != null) {
			objControl.focus();
			blnSet = true;
		}
	}
	
	if (!(blnSet)) {
 		//Step 1. Exit function if there is not any form
		if (document.forms.length ==0)
			return

  		//Step 2. filter out the form element, only allow the following type get through
  		//	text							textarea
		//	checkbox						select
		//	radio							password
		//	Filter out the element which is disabled or readonly
		//	If the client browser is IE, then filter out the visible object only (CSS attribute)
		//	finally, Set focus on the first object then exit the function

		try {
			for (var j=0; j<document.forms.length;j++){
				for (var i=0; i<document.forms[j].elements.length; i++ ){
					var o=document.forms[j].elements[i]
					if (
						(o.type=='checkbox')
						||(o.type=='password')
						||(o.type=='radio')
						||(o.type=='select-multiple')
						||(o.type=='select-one')
						||(o.type=='text')
						||(o.type=='textarea')
					) {
						if ((o.readOnly!=true) && (o.disabled!=true)) {
							if ((o.style.visibility != 'hidden') && (o.style.display != 'none')) {
								o.focus();
								return;
								} //end of ie.hidden 
						} //end of readOnly
					}//detect type
				}//loop throught the element
			}//end of form loop
		}
		catch (exception) {
			return;
		}
	}
}


//=============================================================================
// 
function getObj(vstrControlID) {
	try {
		if (document.getElementById) {
			this.obj = document.getElementById(vstrControlID);
			this.style = document.getElementById(vstrControlID).style;
		}
		else if (document.all) {
			this.obj = document.all[vstrControlID];
			this.style = document.all[vstrControlID].style;
		}
		else if (document.layers) {
			this.obj = document.layers[vstrControlID];
			this.style = document.layers[vstrControlID];
		}
	}
	catch (exception) {
		//alert(exception);
		return;
	}
}

//=============================================================================
//
var objLastStyle;
function showDiv(objDiv) {
	var objStyle;
	try {
		if (objLastStyle) {
			objLastStyle.visibility='hidden';
		}
		if (document.getElementById) {
	  		objStyle = document.getElementById(objDiv).style;
		} else {
			var doc = document.layers;
			var style = '';
			objStyle = eval('doc.' + objDiv + style);
		}
		objLastStyle=objStyle;
		objStyle.zIndex = 1;
		objStyle.visibility = 'visible';
	}
	catch (exception) {
		//alert(exception);
		return;
	}
}
function hideDiv(objDiv) {
	var objStyle;
	try {
		if (objLastStyle) {
			objLastStyle.visibility='hidden';
		}
		if (document.getElementById) {
	  		objStyle = document.getElementById(objDiv).style;
		} else {
			var doc = document.layers;
			var style = '';
			objStyle = eval('doc.' + objDiv + style);
		}
		objStyle.visibility = 'hidden';
	}
	catch (exception) {
		//alert(exception);
		return;
	}
}
function winGlossary() {
aWin = window.open("glossary.htm","thewindow","toolbar=no,width=540,height=600,top=50,left=50,status=no,scrollbars=yes,resize=yes,menubar=no");
}