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 repeat(n, c) {
	if (n > 0 && c.length > 0 ) {
		s = "";
		for ( i = 0; i < n; i++ ) {
			s = s + c;
		}
	} else {
		s = "";
	}
	return s;
}

//********************************************************************

function lpad(s, ml, p) {
	if (s.length == 0) {
		return string(ml, p);
	} else if (ml == 0) {
		return "";
	} else if (ml < s.length) {
		return s;
	} else {
		return repeat(ml - s.length, p)+s;
	}
}

//********************************************************************

function today() {
	now = new Date();
	m = now.getMonth()+1;
	mm = lpad(m.toString(),2,"0");
	d = now.getDate();
	dd = lpad(d.toString(),2,"0");
	return now.getFullYear()+"-"+mm+"-"+dd;
}

//********************************************************************

function GetScriptName (url) {
	if (url.length > 0) {
		sidx = url.lastIndexOf("/")+1;
		eidx = url.length;
		script = url.substring(sidx, eidx);
	} else {
		script = "";
	}
	return script;
}

//********************************************************************

function imgOn(imgName) {
  document[imgName].src=eval(imgName + "on.src");
}

//********************************************************************

function imgOff(imgName) {
  document[imgName].src=eval(imgName + "off.src");
}

//********************************************************************

function nubOn(nubName) {
  document[nubName].src=B1on.src;
}

//********************************************************************

function nubOff(nubName) {
  document[nubName].src=B1off.src;
}

//********************************************************************

function DoLink (page, subj, lnk) {
  if (lnk == '') {
    lnk = subj
  }
  document.write('&nbsp;<A href="./index.asp?page=' + page + '" onmouseover="window.status=\'' + siteTitle_2 + ': ' + subj + '\'; return true" onmouseout="window.status=\'\'; return true">' + lnk + '</A>');
}

//********************************************************************

function DoButton(frm, page, subj, lnk) {

  if (lnk == '') {
    lnk = subj
  }

  img = page.substring(0,page.length-4);

  document.write('<A HREF="./index.asp?page=' + page + '" ' +
    'onMouseOver="btnRoll(\'' + frm + img + '\', \'bDon_' + img + '\'); window.status=\'' + siteTitle_2 + ': ' + subj + '\'; return true" ' +
    'onMouseOut="btnRoll(\'' + frm + img + '\', \'bDoff_' + img + '\'); window.status=\'\'; return true" onclick="sliderRandom()">' +
    '<IMG SRC="./images/bDoff_' + img + '.gif" name="' + frm + img + '" border=0 alt="' + subj + '"></A>');
}

/*
  <A HREF="./index.asp?page=gallery.asp"
    onMouseOver="btnRoll('bmgallery', 'bDon_gallery'); window.status='CCox Website: Gallery'; return true"
    onMouseOut="btnRoll('bmgallery', 'bDoff_gallery'); window.status=\'\'; return true">
    <IMG SRC="./images/bDoff_gallery.gif" name="bmgallery" border=0 alt="Gallery"></A>
*/

function openPictureWindow(img, imgW, imgH) {

	// First, grab the size of the client screen
	// if the img is bigger than the screen, adjust the window size accordingly
	ht = Math.min(Math.floor(screen.availHeight * .75), imgH);
	wd = Math.min(Math.floor(screen.availWidth * .75), imgW);
	doScroll =((wd < imgW || ht < imgH) ? '1' : '0');

	//var winOptions = "location=no,menubar=no,status=no,titlebar=yes,toolbar=no,scrollbars=no,resizable=no";
	var winOptions = "location=0,menubar=0,status=0,statusbar=0,titlebar=1,toolbar=0,scrollbars="
		+doScroll+",resizable=0,directories=0,height="+ht+",width="+wd;

	bwsr = ((typeof bwsr == 'undefined') ? new Browser() : top.bwsr);
	winOptions += ((bwsr.ie) ? ",left=33,top=33" : ",screenX=33,screenY=33,dependent=1");

	window.open("gallery_viewer.php?img="+img+"&w="+wd+"&h="+ht, "jvImg", winOptions);
	//window.open("./gallery_viewer.php?img="+img,"jv_img", winOptions, true);
}


function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
if(!x) alert("findObj can't find " + n);
  if (typeof x == "undefined") x=null;
  //if (!is_defined("x")) x=null;
  return x;
}

function HideShowLayers() { //v6.1
  var i,p,v,obj,args=HideShowLayers.arguments;
  for (i=0; i<(args.length-1); i+=2)
  	if ((obj=MM_findObj(args[i]))!=null) {
	  	v=args[i+1];
    	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    	obj.visibility=v;
    }
}


function ShowContent(id, content)
{
	wrapper = '<table cellpadding="0" cellspacing="0" width="100%"class=details>'+content+'</table>\n';

	if(bwsr.nav4)
	{
		obj = eval("document."+id);
		if (obj.visibility="show") wrapper = "&nbsp;";

		obj.document.write(wrapper);
		obj.document.close();

	} else {
		/*
		if(bwsr.ie) {
			obj=eval("document.all."+id);
		} else {
			obj=document.getElementById(id);
		}
		*/
		obj = findObj(id);
//alert(id + " == " + obj.style.visibility);
		if (obj.style.visibility!="visible") {
			obj.style.visibility="visible";
		} else {
			obj.style.visibility="hidden";
			wrapper = "";
		}
//alert(id + " == " + obj.style.visibility);

		obj.innerHTML=wrapper;
	}
}
