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 PrintWindow(){
	window.print();
}
function popGenericHelp(strText){
	window.alert(strText);
}

		var nav4 = window.Event ? true : false;
		var is
		var eventObject
		eventObject = new Object()

		function checkSelectOnce(lBox,e)
		{
			//This function can be attached to the onfocus
			//event of a select box. However, because of a bug
			//in Netscape 4 which refires the onfocus event
			//indefinitely after clearing an alert/confirm box,
			//we have to mark the select box as already having been
			//checked.
			if (is){
				if (!is.mac){
					if (!lBox.doneCheck)
					{
						savePreviousSelections(lBox);
						onClicker(lBox,e);
				
						if (is.nav4up)
							{lBox.doneCheck = true;}
							else
							{lBox.doneCheck = false;}
				
						return true;
					}
				}
			}
		}


		function initModifiers(e) {
			//When passed an event (e.g. the onfocus event)
			//this function tells you what modifier keys are pressed
			if (is.nav4up) { 
				eventObject.alt = e.modifiers & Event.ALT_MASK;
				eventObject.control = e.modifiers & Event.CONTROL_MASK;
				eventObject.shift = e.modifiers & Event.SHIFT_MASK;
				eventObject.meta = e.modifiers & Event.META_MASK;
			} else {
				eventObject.alt = e.altKey;
				eventObject.control = e.ctrlKey;
				eventObject.shift = e.shiftKey;
				eventObject.meta = false;
			}
			return false;
		}


		function savePreviousSelections(lBox){
			//This function saves the selected state of all options
			//in a listbox
			lBox.previousOptions = new Array()
			lBox.previousOptions.length = lBox.options.length
			for (i=0;i<lBox.options.length;i++)
			{
				lBox.previousOptions[i] = lBox.options[i].selected
			}
		}
		
		
		function onClicker(lBox,e){
			//This function checks to see if any modifier keys have
			//been pressed whilst clicking on a listbox. If not,
			//it displays an alert that previous selections will
			//be removed if the user continues. If they cancel,
			//it calls checkAllowedClick
			initModifiers(e)
			lBox.allowChange = true
			if (lBox.selectedIndex > -1)
			{
				if (!eventObject.control && !eventObject.shift)
				{
					lBox.allowChange = window.confirm('You have just selected just one option, and we cannot detect a Ctrl (\'Apple\' on the Mac) or Shift key having been pressed. This will clear all your current selections. Are you sure?')
					
					checkAllowedClick(lBox);
					return lBox.allowChange;
				}
			}
			return true;
		}
		
		
		function checkAllowedClick(lBox){
			//If the listbox is marked as 'not allowed to change'
			//by the onClicker function, this returns the selections
			//to their previous state.
			if (!lBox.allowChange){
				for(i=0;i<lBox.options.length;i++)
				{
					lBox.options[i].selected = lBox.previousOptions[i];
				}
			}
		}
		



		


var objWindow
function openWinFull(strURL, scroll, resizable){
	openWin(strURL, 1, 1, scroll, resizable)
	if (objWindow){
		objWindow.moveTo(0,0);

		if (document.all)
		{
			objWindow.resizeTo(screen.availWidth,screen.availHeight);
		}

		else if (document.layers||document.getElementById)
		{
			if (objWindow.outerHeight < screen.availHeight||objWindow.outerWidth < screen.availWidth)
			{
				objWindow.outerHeight = screen.availHeight;
				objWindow.outerWidth = screen.availWidth;
			}
		}
	}
}
function openWin(strURL, intWidth, intHeight, scroll, resizable) {
	//alert(':' + !objWindow + objWindow)
	intHeight += 30
	intWidth += 5
	//alert(scroll)
	if (scroll==''){scroll=1}
	if (resizable==''){resizable=0}
	var bolWindowClosed
	var _ieErrorCheckingCode = 'try{objWindow.blur();bolWindowClosed = false;}catch(oErr){bolWindowClosed = true;}';
	var _navNonErrorCheckingCode = 'objWindow = null;bolWindowClosed = true;';
	
	if (!nav4){
		eval(_ieErrorCheckingCode);
	}else{
		eval(_navNonErrorCheckingCode);
	}
	
	//alert(scroll)
	
	if (bolWindowClosed) {
		objWindow =	window.open(
							strURL,
							"myWindow",
							"leftmargin=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=" + resizable + ",width=" + intWidth + ",height=" + intHeight
						);
	}
	else {
		objWindow.location.href = strURL
		objWindow.blur()
		objWindow.focus()
	}
	
	if (objWindow.resizeTo) {objWindow.resizeTo(intWidth, intHeight);}
	
	//if (document.all)
	//	{ w = document.body.clientWidth; h = document.body.clientHeight; }
	//else if (document.layers) { w = window.innerWidth; h = window.innerHeight; }
	w = screen.availWidth; h = screen.availHeight
	
	if (objWindow.moveTo) {objWindow.moveTo(w/2-(intWidth/2),h/2-(intHeight/2));}
}

function checkDate(vObject, args){
	//openOutput(vObject);
	//alert(document.all[vObject.controltovalidate]);
	args.IsValid = mmt_GenericFormValidate('mainPageForm',vObject.controltovalidate,vObject.errormessage,"date");
}

var css_browser_selector = function() {
	var 
		ua = navigator.userAgent.toLowerCase(),
		is = function(t){ return ua.indexOf(t) != -1; },
		h = document.getElementsByTagName('html')[0],
		b = (!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ((is('mac') ? 'ieMac ' : '') + 'ie ie' + RegExp.$1)
			: is('gecko/') ? 'gecko' : is('opera') ? 'opera' : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko' : '',
		os = (is('x11') || is('linux')) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win' : '';
	var c = b+os+' js';
	h.className += h.className?' '+c:c;
}();