/* */
/* Global variables */
var isNav4, isIE4;
var intervalID;
var coll = "";
var styleObj = "";
if(parseInt(navigator.appVersion) >= 4) {
	if(navigator.appName == "Netscape") {
		isNav4 = true;
	} else {
		isIE4 = true;
		coll = "all.";
		styleObj = ".style";
	}
}

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 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 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";
}

/* utility function tha sets the visibility of an object */
function showHide(obj,v){
	var theObj = getObjectRef(obj);
	if(v == 1){
		theObj.visibility = "visible";
	}else{
		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 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 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+')';
	}
}

function getLyrHeight(obj){
	var theObj = getObjectRef(obj);
	if(isNav4){
		return theObj.clip.height;
	}else{
		return eval('document.all.' + obj + '.scrollHeight');
	}
}