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 chgbg( objName )
{
	getObj(objName).backgroundColor='#FFFFFF';
	objName = objName + "I"
	getObj(objName).visibility='visible';
}

function chgfnt(objName)	{
	tobjName = objName + "IF"
	getObj(tobjName).color='white';
	chgbg(objName);
}

function rstbg( objName )
{
	getObj(objName).backgroundColor='#FFFFCC';
	objName = objName + "I"
	getObj(objName).visibility='hidden';
}

function rstfnt(objName)	{
	tobjName = objName + "IF"
	getObj(tobjName).color='black';
	rstbg(objName);
}

function mVis (objName)
{
	var visNavObj = getObj(objName);
	visNavObj.visibility = "visible"; 
}

function mInv (objName)
{
	var visNavObj = getObj(objName);
	visNavObj.visibility = "hidden"; 
}


function makV(objName,Num)
{
	getObj(objName).visibility = "visible";
	objName = objName + "I"
	for (i=1; i <= Num; i++)	{
		var tobjName = objName + i
		getObj(tobjName).visibility='visible';
	}
}

function clrV(objName,Num)
{
	getObj(objName).visibility = "hidden";
	objName = objName + "I"
	for (i=1; i <= Num; i++)	{
		var tobjName = objName + i
		getObj(tobjName).visibility='hidden';
	}
}

function setEffects()	{
	if 	(IE4) {getObj('oTransContainer0').visibility='visible'}
}

function setServices()	{
	if (NS4||NS6) { 
		avail_width = innerWidth;
		avail_height = innerHeight;}
	else {
		avail_width = document.body.clientWidth;
		avail_height = document.body.clientHeight;}
		
	if (avail_width > 788) {
		incr = 520;
		if (avail_width < 1033) {
			incr = incr + ((avail_width - 788) / 2);}
		else	{
			incr = incr + ((1032 - 788) / 2);
			incr = incr + (avail_width - 1032) / 8;
		}
		getObj('oTransContainer0').left = incr;
		getObj('scu0I1').left = incr;
		getObj('scu0I2').left = incr;
		getObj('scu0I3').left = incr;
		getObj('scu0I4').left = incr;
		getObj('scu0I5').left = incr;
		getObj('scu0I6').left = incr;
		}
	else	{
		incr = 520;
		getObj('oTransContainer0').left = incr;
		getObj('scu0I1').left = incr;
		getObj('scu0I2').left = incr;
		getObj('scu0I3').left = incr;
		getObj('scu0I4').left = incr;
		getObj('scu0I5').left = incr;
		getObj('scu0I6').left = incr;
		}
}

function fadeIn(objName, containerName)
{
	setServices();
	if (IE4) {
		containerName.filters[0].Apply();
		getObj(objName).visibility="visible"; 
		tobjName = objName + "I"
		getObj(tobjName).visibility="hidden";
		containerName.filters[0].Play();}
	else	{
		mVis(objName);
		tobjName = objName + "I"
		mVis(tobjName);}
	makV(objName,3)	
}


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 changeColor(formName,formObjName,LineItem,ParamName) {
	if (document.all){
		var foo = getFormObj(formName,formObjName)
		for (var i=0; i < foo.options.length; i++){
			if (foo.options(i).selected) {
				colorVal = foo.options(i).value;}
		}
	}
	else {	if (document.layers){
				var foo = getFormObj(formName,formObjName)
				for (var i=0; i < foo.length; i++){
					if (foo[i].selected) {
						colorVal = foo[i].value;}
				}
			}
			else{   if (document.getElementById) {
						var fa = getFormObj(formName,formObjName);
						for (var i=0; i < fa.length; i++){
							if (fa[i].selected) {
								colorVal = fa[i].value;}
						}
					}
				}
	}
	temp = ParamName + "='" + colorVal + "'";
	eval(temp);
}

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);

