/*********************************************************************************
Window Resize
*********************************************************************************/
NS4 = document.layers;
 if (NS4) {
    origWidth = innerWidth;
    origHeight = innerHeight;
 }

function reDo() {
   if (innerWidth != origWidth || innerHeight != origHeight) 
      location.reload();
}

if (NS4) onresize = reDo;


/*********************************************************************************
Check for Images
*********************************************************************************/

if (document.images) {
		goodVersion = true;
	} else {
		goodVersion = false;
	}

/*********************************************************************************
Browser Version & Platform Check
*********************************************************************************/ 

DHTMLversion = "Disabled"
	if (navigator.appVersion.substring(0, 1) >= 4) {
		if (navigator.userAgent.indexOf("MSIE", 0) > -1) {
			if (false) { //(navigator.userAgent.indexOf("Mac", 0) > -1) {
				DHTMLversion = "Disabled"
			} else {
				DHTMLversion = "MSIE"
			}
		} else if (navigator.userAgent.indexOf("Mozilla", 0) > -1) {
			DHTMLversion = "NS"
		}
	}	
	
//--- Browser Version & Platform Check	

function imageSwap(which, state) {
        if (goodVersion) {
			//var thisImage = document.images[which];
			var thisImage = getImage(which);
			var thisImageSrc = thisImage.src;
			var imageName = thisImageSrc.substring(0,thisImageSrc.indexOf("_o"));
            if (state == 0) {
                thisImage.src = imageName + "_off.jpg"
            } else {
                thisImage.src = imageName + "_on.jpg"
          	}
        }
    }
		if (goodVersion) {
		var PageImages = new Array();
		var PageAltImages = new Array();
	}
	
//--- Images Preload
		
function LoadActiveImages() {
		if (goodVersion) {
			var num = document.images.length;
			for (var i = 0; i < num; i++) {
				var thisImage = document.images[i];
				var thisImageSrc = thisImage.src;
				var imageName = thisImageSrc.substring(0,thisImageSrc.indexOf("_o"));
				//document.write(imageName + "<BR>");
				if (thisImageSrc.indexOf("_off") != -1) {
					PageImages[i] = new Image(thisImage.width, thisImage.height);
        	     	PageImages[i].src = imageName + "_on.jpg";
				} else if (thisImage.src.indexOf("_on") != -1) {
					PageAltImages[i] = new Image(thisImage.width, thisImage.height);
        	     	PageAltImages[i].src = imageName + "_off.jpg";
					var ImagePtr = getImage(thisImage);
					//document.images[getImage(thisImage)].src = imageName + "_off.gif";
					//document.images[getImage(thisImage)].src = imageName + "_off.gif";
				}
         	}
		}
	}
	
function getImage(inputName) {
		//document.write("About to get Image: " + image_name +"<BR>");
		var myImage = document [inputName];
		browserName = navigator.appName;
       	browserVer = parseInt(navigator.appVersion);
        if (browserName == "Netscape" && browserVer == 3) {
			if (myImage.length) {
				return myImage[myImage.length-1];
			} else return myImage;
		} else {
			return myImage;
		}
	}
	

//--- Netscape doesn't handle imageswaps in divs without 
//--- specifying the div's position in the document hierarchy

function imageSwapDiv(which, state, whatDiv) {
        if (goodVersion) {
			//var thisImage = document.images[which];
			
			if ((DHTMLversion == "NS") && (whatDiv != null)) {
				var thisImage = document.layers[whatDiv].document[which]
			} else {
				var thisImage = getImage(which)
			}
		
			var thisImageSrc = thisImage.src;
			var imageName = thisImageSrc.substring(0,thisImageSrc.indexOf("_o"));
            if (state == 0) {
                var newImagesrc = imageName + "_off.jpg"
            } else {
                var newImagesrc = imageName + "_on.jpg"
          	}
			
			thisImage.src = newImagesrc
        }
    }

		
//--- Window Functions		

function popWindow(URL,name,widgets) {
	popwin = window.open(URL, name, widgets)		
	popwin.opener = self	
	popwin.focus()
	window.name = "MainWin"			
	}
	

function closeWin(){
	window.close()
	}
				function popWindowLocal(URL) {
			popwin = window.open(URL, "PopUpWindow", "width=400,height=400,scrollbars=no,resize=auto")		
			popwin.opener = self	
			popwin.focus()
			window.name = "MainWin"			
			}