var isNetscape = (navigator.appName == "Netscape");
var bVer=parseInt(navigator.appVersion);

NS4 = (document.layers) ? true : false;
IE4 = ((document.all) && (bVer>=4)) ? true : false;
NS6 = ((isNetscape==true) && (bVer>=5)) ? true : false;


collectObj = (IE4) ? "all." : "";
styleObj = (IE4)||(NS6) ? ".style" : "";

function getObj( objName )
{
	if (NS6) { var theObj = document.getElementById(objName).style;}
	else { var theObj = eval( "document." + collectObj + objName + styleObj )}

	return theObj;
}

function mVis (objName)
{
	var visNavObj = getObj(objName);
	visNavObj.visibility = "visible"; 
}

function mInv (objName)
{
	var visNavObj = getObj(objName);
	visNavObj.visibility = "hidden"; 
}

function tgetObj(tabName,objName)
{
	if (NS6) { var theObj = document.getElementById(objName).style;}
	else { 
		if (NS4) {
				var theObj = eval( "document." + tabName + ".document." + collectObj + objName + styleObj )}
		else {
				var theObj = eval( "document." + collectObj + objName + styleObj )}
		}
	return theObj;
}

function mtVis (tabName,objName)
{
	var visNavObj = tgetObj(tabName,objName);
	visNavObj.visibility = "visible"; 
}

function mtInv (tabName,objName)
{
	var visNavObj = tgetObj(tabName,objName);
	visNavObj.visibility = "hidden"; 
}

function chgBlue (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "#000099";
}

function chgGrn (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "#006600";
}

function chgBlk (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "#000000";
}

function chgGry (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "#666666";
}


function img_act(imgID,imgName,src_code) {

	if (NS6) { var XImg = document[imgName];}
	else {
		if (NS4) {
			if (imgID == "") {
				var XImg = eval("document.images[imgName]") }
			else {
				var XImg = eval( "document." + imgID + ".document.images[imgName]"); }
		}
		else {
			var XImg = eval( "document.all." + imgName );
		}
	}
	XImg.src=src_code;
}

function changePic(catName,catNum) {
	Incr(catNum);
	idName = "photo1";
	srcName = eval(catName + "Pic[shotNum]");
	currentUrl = eval(catName + "Url[shotNum]");
	
	currentDesc = eval(catName + "Desc[shotNum]");
	if (currentDesc == '') { mInv("textOverImage1");}
	else { mVis("textOverImage1");}
	
	img_act(idName,"imag1",srcName);
	lastShot = shotNum
}

function changePicBack(catName,catNum) {
	Decr(catNum);
	idName = "photo1";
	srcName = eval(catName + "Pic[shotNum]");
	currentUrl = eval(catName + "Url[shotNum]");
	
	currentDesc = eval(catName + "Desc[shotNum]");
	if (currentDesc == '') { mInv("textOverImage1");}
	else { mVis("textOverImage1");}
	
	img_act(idName,"imag1",srcName);
	lastShot = shotNum
}

function orphan() {
	textName = "catName" + "text" + shotNum;
	lasttext = textName;
	alert(textName);
	makeVisible(textName);
}

function Incr(catVar) {
	var maxPics = maxCat[catVar];
	var nextShot = nextCat[catVar];
	if (nextShot >= maxPics) {nextShot = 1}
	else { nextShot = nextShot + 1}
	nextCat[catVar] = nextShot;
	shotNum = nextShot;
}

function Decr(catVar) {
	var maxPics = maxCat[catVar];
	var nextShot = nextCat[catVar];
	if (nextShot == 1) {nextShot = maxPics}
	else { nextShot = nextShot - 1}
	nextCat[catVar] = nextShot;
	shotNum = nextShot;
}

function popImage()  {
	eval(popup2(currentUrl,640,480));
}

function popup(url,w,h)
{
        newWindow = window.open (url, 'new', 'resizable,scrollbars=0,width='+w+',height='+h);
}

function popup2(url,w,h)
{
		newWindow = window.open (url, 'new2', 'resizable,scrollbars=yes,width='+w+',height='+h);
}

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);

