﻿/* Images Preload */

var PageImages = new Array();
var PageAltImages = new Array();

function LoadActiveImages() {
	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.lastIndexOf("-o"));
		//document.write(imageName + "<BR>");
		if (thisImageSrc.lastIndexOf("-off") != -1) {
			PageImages[i] = new Image(thisImage.width, thisImage.height);
      	    PageImages[i].src = imageName + "-on.gif";
		} else if (thisImage.src.lastIndexOf("-on") != -1) {
			PageAltImages[i] = new Image(thisImage.width, thisImage.height);
      	    PageAltImages[i].src = imageName + "-off.gif";
		}
    }
}

window.onload = LoadActiveImages;
	
/* Image Swap */
function imageSwap(which, state) {
     	
	//which - required input of image name
	//state - required input of image rollover state (1 for on, 0 for off)
	
	//get the element obj reference
 	thisImage=document.getElementById(which);
	
	//find the image src name
	var imageName = thisImage.src.substring(0,thisImage.src.lastIndexOf("-o"));
	//toggle the src name based on state
	state == 0?endString = "-off.gif":endString = "-on.gif";
	//alert(layerOver);
	//set the image src to the new src
	
	thisImage.setAttribute("src",imageName + endString);
}

function selectAll(selectBox,selectAll) {
	// have we been passed an ID
	if (typeof selectBox == "string") {
		selectBox = document.getElementById(selectBox);
	}
	// is the select box a multiple select box?
	if (selectBox.type == "select-multiple") {
		for (var i = 0; i < selectBox.options.length; i++) {
			selectBox.options[i].selected = selectAll;
		}
	}
}
/**************************************************************************************
show and hide a div
**************************************************************************************/
function getStyleObject(strId) {
	//alert(strId);
	if (document.getElementById && document.getElementById(strId)) {
		return document.getElementById(strId).style;
	} else if (document.all && document.all(strId)) {
		return document.all(strId).style;
	} else {
		return false;
	}
}
	
function fnShow(strDivId) {
	//alert(strDivId);
	var objStyle = document.getElementById(strDivId);
	//alert(objStyle);
	objStyle.style.display = "block"; 
}

function fnHide(strDivId) {
	var objStyle = document.getElementById(strDivId);
	objStyle.style.display = "none"
}