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() { //v3.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; }
}

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_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function writeToLayer(name, message) {
    if (document.layers) {
        document.layers[name].document.close();
        document.layers[name].document.write(message);
        document.layers[name].document.close();
    } else {
        if (document.all) {
            document.all[name].innerHTML = message;
        } else {
            document.getElementById(name).innerHTML = message;
        }
    }
}

function setCellColorWithCheckboxes(name) {
	if (document.all) {
		if(document.all[name].style.backgroundColor == 'white') {
			color = '#F9F9F9';
		}else{
			color = 'white'
		}
		document.all[name].style.backgroundColor = color
		name = name + '_checkbox';
		document.all[name].style.backgroundColor = color
	} else {
		if(document.getElementById(name).style.backgroundColor == 'white') {
			color = '#F9F9F9';
		}else{
			color = 'white'
		}
		document.getElementById(name).style.backgroundColor = color;
		name = name + '_checkbox';
		document.getElementById(name).style.backgroundColor = color;
	}
}

// popup window code
var IE = navigator.appVersion.indexOf("MSIE")>0;
var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
var version = parseFloat(navigator.appVersion.substr(msieIndex,3))
var IE4 = IE && version>=4 && version<5;
var IE5 = IE && version>=5;
var Macintosh = navigator.userAgent.indexOf('Mac')>0;

function spawnWithScrollbars(URL,windowName,width,height) {
				// default amounts in case they are running an old browser
				var w = 800;
				var h = 600;
				if (document.all || document.layers || document.getElementById) {
				   w = screen.availWidth;
				   h = screen.availHeight;
				}
				var leftPos = (w-width)/2, topPos = (h-height)/2;
 				if (Macintosh) {
 					if (IE4) { newheight = 17 + height; }
 					else { newheight = height; }
 				}
 				else { newheight = height; }
 				var msgWindow = window.open(URL, windowName, "scrollbars=yes,toolbar=no,location=no,status=yes,menubar=no,top=0,left=0,width="+width+",height="+newheight+",resizable=yes,top="+topPos+",left="+leftPos );
}

function spawn(URL,windowName,width,height) {
				// default amounts in case they are running an old browser
				var w = 800;
				var h = 600;
				if (document.all || document.layers || document.getElementById) {
				   w = screen.availWidth;
				   h = screen.availHeight;
				}
				var leftPos = (w-width)/2, topPos = (h-height)/2;
 				if (Macintosh) {
 					if (IE4) { newheight = 17 + height; }
 					else { newheight = height; }
 				}
 				else { newheight = height; }
 				var msgWindow = window.open(URL, windowName, "scrollbars=auto,toolbar=no,location=no,status=yes,menubar=no,top=0,left=0,width="+width+",height="+newheight+",resizable=yes,top="+topPos+",left="+leftPos );
}

function spawnPhoto(URL,windowName,width,height) {
				// default amounts in case they are running an old browser
				var w = 800;
				var h = 600;
				if (document.all || document.layers || document.getElementById) {
				   w = screen.availWidth;
				   h = screen.availHeight;
				}
				var leftPos = (w-width)/2, topPos = (h-height)/2;
 				if (Macintosh) {
 					if (IE4) { newheight = 17 + height; }
 					else { newheight = height; }
 				}
 				else { newheight = height; }	
 				var msgWindow = window.open('', windowName, "toolbar=no,location=no,status=yes,menubar=no,top=0,left=0,scrollbars=no,width="+width+",height="+newheight+",resizable=no,top="+topPos+",left="+leftPos );
				var body1 = '<html><head><title>Moped Army - Photo</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
				var body2 = '</body></html>';
				var page='<a href="javascript:window.close();"><img src="' + URL + '" width="' + width + '" height="' + height + '" border="0" galleryimg="no"></a>';
				var totalPage = body1 + page + body2;
				msgWindow.document.open();
				msgWindow.document.write(totalPage);
				msgWindow.document.close();
}