	/* Global variables */
var isNav4, isIE4, isIE5;
var intervalID;
var coll = "";
var styleObj = "";
var appV = navigator.appVersion;
if(parseInt(appV) >= 4) {
	if(navigator.appName == "Netscape") {
		isNav4 = true;
	} else {
		isIE4 = true;
		coll = "all.";
		styleObj = ".style";
	}
}
 
var iePos  = appV.toLowerCase().indexOf('msie');
if (iePos !=-1) {
  	ver = parseFloat(appV.substring(iePos+5,appV.indexOf(';',iePos)));
	isIE5 = (ver>=5)?true:false;
}

var agt=navigator.userAgent.toLowerCase();
var isMac = (agt.indexOf("mac")!=-1);

var agentP = navigator.userAgent;
var macIE=false;
if ((agentP.indexOf("Mac")!=-1) && isIE4) {
  macIE=true;
}

function changeImage(row,s){
	var h = (s==1)?"r":"";
	if(document.images){
		document.images[row].src = eval(h + row + ".src");
	}
}

/*Function to change an image in a layer*/
function changeImageLyr(row,s,lyr){
	var h = (s==1)?"r":"";
	if(document.images&&!isNav4){
		document.images[row].src = eval(h + row + ".src");
	}else if(document.images){
		var h = (s==1)?"r":"";
		document.layers[lyr].document.images[row].src = eval(h + row + ".src");
	}
}

/*Function to convert object name string or object reference into valid object reference */
function getObjectRef(obj){
	var theObj;
	if(typeof obj == "string"){
		theObj = eval("document." + coll + obj + styleObj);
	}else{
		theObj = obj;
	}
	return theObj;
}

function getLayerRef(name) {
	return isNav4 ? getLayerRefNS(name, document.layers) : getObjectRef(name);
}

// NS specific impl that goes through the tree of nested layers to find a layer
function getLayerRefNS(name, arr) {
	var i=0;
	for (i=0; i < arr.length; i++) {
		var theLayer = arr[i];
		if (theLayer.id == name)
			return theLayer;
		if (theLayer.document.layers.length > 0) {
			var theResult = getLayerRefNS(name, theLayer.document.layers[0].document.layers);
			if (theResult != null)
				return theResult;
		}
	}
	return null;
}

function getImageRef(name) {
	var theResult = eval('document.images.' + name);
	if (theResult != null)
		return theResult;
	else if (isNav4)
		return getImageRefNS(name, document.layers);
	else
		return null;

}

function getImageRefNS(name, arr) {
	var i=0;
	for (i=0; i < arr.length; i++) {
		var theLayer = arr[i];
		if (theLayer.document.layers.length > 0) {
			var theRealLyr = theLayer.document.layers[0];
			var theResult = getImageInLyrNS(theRealLyr, name);
			if (theResult != null)
				return theResult;
		
			theResult = getImageRefNS(name, theRealLyr.document.layers);
			if (theResult != null)
				return theResult;
		}
	}
	return null;
}


function getImageInLyrNS(theLayer, name) {
	var i=0;
	var arr = theLayer.document.images;
	for (i=0; i < arr.length; i++) {
		var theImage = arr[i];
		if (name == theImage.name)
			return theImage;
	}

	return null;
}


/* function to position an object at a specified pixel co-ordinate */
function shiftTo(obj,x,y){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.moveTo(x,y);
	}else{
		theObj.pixelLeft = x;
		theObj.pixelTop = y;
	}
}

/* function to move an object by dx and/or dy pixels */
function shiftBy(obj,dx,dy){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.moveBy(dx,dy);
	}else{
		theObj.pixelLeft += dx;
		theObj.pixelTop += dy;
	}
}

/* utility function that moves the specified object by dx pixels to the left;*/
function shiftLeft(obj,dx){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.left -= dx;
	}else{
		theObj.pixelLeft -= dx;
	}	
}

/* utility function that moves the specified object by dy pixels up */
function shiftTop(obj,dy){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.top -= dy;
	}else{
		theObj.pixelTop -= dy;
	}
}

/* function to set the z-Order of an object */
function setZIndex(obj,zOrder){
	var theObj = getObjectRef(obj);
	theObj.zIndex = zOrder;
}

/* function to set the background color of an object */
function setBgColor(obj, color){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.bgColor = color;
	}else{
		theObj.backgroundColor = color;
	}
}
	
/* functions to show an object */
function show(obj){
	var theObj = getObjectRef(obj);
	theObj.visibility = "visible";
}

/* utility function to hide an object */
function hide(obj){
	var theObj = getObjectRef(obj);
	if(theObj)theObj.visibility = "hidden";
}


/* function to retrieve the x-coordinate of a positionable object */
function getObjLeft(obj){
	var theObj = getObjectRef(obj);
	if(isNav4){
		return theObj.left;
	}else{
		var opx1 = theObj.pixelLeft;
		return opx1;
	}
}

/* utility fn to set x coordinate of positionable object */
function setObjLeft(obj,x){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.left = x;
	}else{
		theObj.pixelLeft = x;
	}
}

/* function to retrieve the y-coordinate of a positionable object */
function getObjTop(obj){
	var theObj = getObjectRef(obj);
	if(isNav4){
		return theObj.top;
	}else{
		return theObj.pixelTop;
	}
}

/* utility fn to set y coordinate of positionable object */
function setObjTop(obj,y){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.top = y;
	}else{
		theObj.pixelTop = y;
	}
}

/* utility function that returns the height of the object in pixels */
function getObjHeight(obj){
	var theObj = getObjectRef(obj);
	if(isNav4){
		return theObj.clip.height;
	}else{
		return theObj.clientHeight;
	}
}
/* utility function that sets the height of an object */
function setObjHeight(obj,h){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.clip.height = h;
	}else{
		theObj.clientHeight = h;
	}
}
/* utility function that returns the width of an object in pixels */
function getObjWidth(obj){
	var theObj = getObjectRef(obj);
	if(isNav4){
		return theObj.clip.width;
	} else {
		var ox = theObj.clientWidth;
		return ox;
	}
}

/* utility function that sets the width of an object */
function setObjWidth(obj,w){
	var theObj = getObjectRef(obj);
	if(isNav4){
		theObj.clip.width = w;
	}else{
		theObj.clientWidth = w;
	}
}
/* utility function that returns the available content width space in the browser window */
function getInsideWindowWidth(){
	if(isNav4) {
		return window.innerWidth;
	} else {
		var wx = document.body.clientWidth;
		return wx;
	}
}

/* utility function that returns the document width */
function getDocumentWidth(){
	if(isNav4) {
		return document.width;
	} else {
		var wx = document.body.scrollWidth;
		return wx;
	}
}

/* utility function that returns the available content width space in document */
function getInsideDocumentWidth(){
	if(isNav4) {
		return document.width;
	} else {
		var wx = document.body.scrollWidth;
		return wx;
	}
}

/* utility function that returns the available content height space in the browser window */
function getInsideWindowHeight(){
	if(isNav4) {
		return window.innerHeight;
	} else {
		var wx = document.body.clientHeight;
		return wx;
	}
}

/* utility function that sets the border color of an element */
function setBorderColor(obj, color){
	var theObj = getObjectRef(obj);
	theObj.borderColor = color;
}

/* utility function that sets the border style of an element */
function setBorderStyle(obj, style){
	var theObj = getObjectRef(obj);
	theObj.borderStyle = style;
}

/* utility function that sets the border size of an element */
function setBorderWidth(obj, width){
	var theObj = getObjectRef(obj);
	if(isNav4) {
		theObj.border = width;
	}else {
		theObj.border = width;
	}
}

/* utility function that creates a DIV object. Parameters allow user to set ID, left, top, height, width, background image, z-index and contents.
i = element ID;
objX sets left position;
objY sets top position;
objH sets object height;
objW sets object width;
bgImg sets background image;
z = z-index;
content = div contents; */
function makeDiv(i,objX,objY,objH,objW,bgImg,z,content){
	with(document){
		write("<DIV ID='"+i+"' style='position:absolute; left:"+objX+"; top:"+objY+"; width:"+objW+"; height:"+objH+";z-index:"+z+"'>");
		write(content);
		write("</DIV>\n");
	}
}

/* object clipping function */
function clipObj(obj,cTop,cRight,cBottom,cLeft) {
	var theObj = getObjectRef(obj);
	if(isNav4) {
		theObj.clip.top = cTop;
		theObj.clip.right = cRight;
		theObj.clip.bottom = cBottom;
		theObj.clip.left = cLeft;
	}else {
		theObj.clip = 'rect('+cTop+','+cRight+','+cBottom+','+cLeft+')';
	}
}