//Custom API for cross-platform object positioning
//Adapted from "Dynamic HTML: The Definitive Guide" by Danny Goodman

//--------------------------------------------------------------
//Global variables

var isNav
var isIE
var coll=""
var styleObj = ""
var z=0
if (parseInt(navigator.appVersion) >=4) {
	if (navigator.appName=="Netscape") {
		isNav=true
		isIE=false
	} else {
		isNav = false
		isIE  = true
		coll = "all."
		styleObj = ".style"
	}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
// Convert object name string or object reference
// into a valid object reference
function getObject(obj) {
	var theObj 
	if (typeof obj == "string") {
		theObj = eval("document." + coll + obj + styleObj)
	} else {
		theObj = obj
	}
	return theObj
}
//--------------------------------------------------------------


//--------------------------------------------------------------
//Positioning an object at a specific pixel coordinate
function shiftTo(obj, x ,y) {
	var theObj = getObject(obj)
	if (isNav) {
		theObj.moveTo(x,y)
	} else {
		theObj.pixelLeft = x
		theObj.pixelTop = y
	}
}
//--------------------------------------------------------------


//--------------------------------------------------------------
//Moving an object by x and/or y pixels
function shiftBy(obj, deltaX ,deltaY) {
	var theObj = getObject(obj)
	if (isNav) {
		theObj.moveBy(deltaX,deltaY)
	} else {
		theObj.pixelLeft += deltaX
		theObj.pixelTop += deltaY
	}
}
//--------------------------------------------------------------


//--------------------------------------------------------------
//Setting the z-order of an object
function setZIndex(obj, zOrder) {
	var theObj = getObject(obj)
	theObj.zIndex = zOrder
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//Setting the background color of an object
function setBGColor(obj, color) {
	var theObj = getObject(obj)
		if (isNav) {
		theObj.bgColor = color
	} else {
		theObj.backgroundColor = color
	}
}
//--------------------------------------------------------------

//--------------------------------------------------------------
//Setting the font color of an object
function setColor(obj, color) {
	var theObj = getObject(obj)
		theObj.Color = color
}
//--------------------------------------------------------------



//--------------------------------------------------------------	
//Set element background color (dynamic in IE only)
function setBorderColor(obj, color) {
	var theObj = getObject(obj)
	theObj.borderColor = color
}
//--------------------------------------------------------------


	
//--------------------------------------------------------------		
//Show an object		
function show(obj) {
	var theObj = getObject(obj)
	theObj.visibility="visible"
	if (isIE) {
	theObj.display="block"
	}  else {
	theObj.height=""
	}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//Hide an object
function hide(obj) {
//alert(obj);
	var theObj = getObject(obj)
	theObj.visibility = "hidden"
	if (isIE) {
	theObj.display="none"
	} else {
	theObj.height=0
	}
}
//--------------------------------------------------------------


//--------------------------------------------------------------
//Retrieve the x coordinate of a positionable object
function getObjectLeft(obj) {
	var theObj = getObject(obj)
		if (isNav) {
		return theObj.left
	} else {
		return theObj.pixelLeft
	}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//Retrieve the y coordinate of a positionable object
function getObjectTop(obj) {
	var theObj = getObject(obj)
		if (isNav) {
		return theObj.top
	} else {
		return theObj.pixelTop
	}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//Determine whether to hide or show an object
function HideOrSeek(obj){
	//alert('in HideOrSeek! for obj=\n' + obj);
	var theObj = getObject(obj)
	if (theObj.visibility=="visible" || theObj.visibility=="show") {
		hide(obj)
	} else {
		show(obj)
	}
	//alert(theObj.visibility);
}
//--------------------------------------------------------------




//--------------------------------------------------------------
//Set a given image to "on"
function imageOn(name,i) {
	if (document.images) {
		document.images[name].src = onImgArray[i].src
		}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//Set a given image to "off"
function imageOff(name,i) {
	if (document.images) {
		document.images[name].src = offImgArray[i].src
		}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//Set a given image to "clicked"
function imageClick(name,i) {
	if (document.images) {
		document.images[name].src = clickImgArray[i].src
		}
}
//--------------------------------------------------------------



//--------------------------------------------------------------
//determine which image to show
function imageSwitch(name,i) {
	if (document.images) {
		if (document.images[name].src == offImgArray[i].src) {
		imageOn(name, i)
		} else {
		imageOff(name, i)
		}
	}
}

//--------------------------------------------------------------
function action(modevalue) {
	document.LoginFrm.theaction.value=modevalue
	document.LoginFrm.submit()
}

function submitbadlogin(modevalue) {
	document.badpass.theaction.value=modevalue
	document.badpass.submit()
}


//--------------------------------------------------------------
//emails user password
function sendpass() {
	document.LoginFrm.theaction.value="sendpassword"
    document.LoginFrm.submit()
}

//this function will hide an obj if flag is 1
function invi(flag, obj){
	var x = new getObj(obj);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}
function getObj(name){
  if (document.getElementById){
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all){
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers){
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
//---------------

	