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)
{
	var theObj = document.getElementById(objName).style;	
	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)
{
	var theObj = document.getElementById(objName).style;
	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 changeColorBlue (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "#000099";
}

function changeColorRed (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "red";
}

function changeColorBlk (objName) {
	var visNavObj = getObj(objName);
	visNavObj.color = "#000000";
}


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]");
	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]");
	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)
{
		newWindow1 = window.open (url, 'new2', 'resizable,scrollbars=yes,width='+w+',height='+h);
}

function popup3(url)
{
		newWindow2 = window.open (url, 'new3');
}

if (NS4||NS6) { 
	avail_width = innerWidth;
	avail_height = innerHeight;}
else {
	avail_width = document.body.clientWidth;
	avail_height = document.body.clientHeight;}

function popPic(currentDesc,currentUrl) {
	if (avail_width > 640) {
		eval("popwindow1=open('http://www.shadetreecanopies.com/awnings/house-awnings/AlpinePic.asp?PicText=' + currentDesc + '&Photo='+ currentUrl +'','popwindow1','dependent=yes,scrollbars=yes,width=743,height=490,resizable=yes,screenX=20,screenY=20')");}
	else	{
		eval("popwindow1=open('http://www.shadetreecanopies.com/awnings/house-awnings/AlpinePic.asp?PicText=' + currentDesc + '&Photo='+ currentUrl +'','popwindow1','dependent=yes,scrollbars=yes,width=600,height=400,resizable=yes,screenX=20,screenY=20')");}
}