/*
Author: William La Morte &copy; copyright 2000
Email: wlm@xiio.com
http://www.xiio.com
There are no requirements for using this API. I only ask that you leave this comment intact.
This API was written to assist with my own works as well assist other developers with their work.
If you improve or enhance this script, please place your name and date below this comment. Report bugs or questions/comments to author
*/

/*
Improved by:
Date:
*/

//handle browser resizing problem for navigator 4
if(!window.orig_width) {
  window.onresize = reset_layers;
  window.orig_width = window.innerWidth;
  window.orig_height = window.innerHeight;
}

function reset_layers() {
    if (window.innerWidth != orig_width || window.innerHeight != orig_height) {
      location.reload();
    }
}

//declare globals to build object reference
var whichDom = "", styleObj = ""
var isNav4, isNav6, isIE
var isBrand = navigator.appName
var agt = navigator.userAgent.toLowerCase()
var navVer = parseInt(navigator.appVersion)

//these variables are handy for determining which styles to load
isNav4 = (isBrand == "Netscape" && navVer < 5) ? true : false
isNav6 = (isBrand == "Netscape" && navVer >= 5) ? true : false
isNav46 = ((isBrand == "Netscape") && (parseFloat(navigator.appVersion) >= parseFloat(4.6)) && (parseFloat(navigator.appVersion) < parseFloat(4.7))) ? true : false
isNav47 = ((isBrand == "Netscape") && (parseFloat(navigator.appVersion) >= parseFloat(4.7))) ? true : false
isIE = ((agt.indexOf("msie") != -1) && (parseInt(navVer) >= 4)) ? true : false

if ((navigator.appVersion.indexOf("Mac") != -1)) {
	document.write("<LINK REL=stylesheet HREF=\"surfplus_mac.css\" TYPE=\"text/css\">"); }
else {
	document.write("<LINK REL=stylesheet HREF=\"surfplus.css\" TYPE=\"text/css\">"); 
}


//load a style sheet depending on users browser
/*
if (isNav4)	{
	document.write('<link="stylesheet" href="style.css">')
} else if (isNav6)	{
	document.write('<link="stylesheet" href="style.css">')
} else	{
	document.write('<link="stylesheet" href="style.css">')
}
*/

//construct object reference
if(isNav6)  {
  whichDom = '.getElementById("'
  styleObj = '").style'
} else if (isNav4)  {
  whichDom = '["'
  styleObj = '"]'
} else {
  whichDom = ".all."
  styleObj = ".style"
}


//Set imageStay to nothing
imageStay = ""

// Check to make sure browser is not too old to display Javascript stuff
if (navigator.appVersion.indexOf("2.") != -1){
        check = false;
        }
if ((navigator.appVersion.indexOf("3.") != -1) && (navigator.appName.indexOf("Explorer") != -1)){
        check = false;
        }
else {
        check = true;
        }

//load image when mouseover
function imageon(name){
        if (imageStay != name){
                document[name].src = eval(name + "on.src");
        }
}

//load image when mouseoff
function imageoff(name){
        if (imageStay != name){
                document[name].src = eval(name + ".src");
        }
}

function on(name){
        if (check == true){
        imageon(name);
        }
}
function off(name){
        if (check == true){
        imageoff(name);
        }
}

//keep the image there when clicked even if mousedoff
function stay(name){
        if (check == true){
        document[name].src = eval(name + "stay.src");
        if (imageStay != name){
                if (imageStay != ""){
                        document[imageStay].src = eval(imageStay + ".src");
                }
        }
        imageStay = name
        }
}

//API object reference
function theObject(obj) {
var theObj
	if (typeof obj == "string")
		theObj = eval("document" + whichDom + obj + styleObj)
	else
		theObj = obj
		return theObj
}

function moveObjTo(obj, x, y) {
var theObj = theObject(obj)
	if (isNav4) {
		theObj.moveTo(x,y)
	} else if (isIE) {
		theObj.pixelLeft = x
		theObj.pixelTop = y
	} else	{//nav6
		theObj.left = x +"px"
		theObj.top = y +"px"
	}
}




//nav6 returns string values for positionable elements ie. left "100px"
//must parse string values and convert to number values
function moveObjBy(obj, deltaX, deltaY) {
var theObj = theObject(obj)
  if (isNav4) {
    theObj.moveBy(deltaX, deltaY)
  } else if (document.all) {
    theObj.pixelLeft += deltaX
    theObj.pixelTop += deltaY
  } else  {
    var theLeft = getObjLeft(theObj)
    var theTop = getObjTop(theObj)
    setObjLeft(theObj, parseInt(theLeft)+deltaX)
    setObjTop(theObj, parseInt(theTop)+deltaY)
  }
}


function show(obj) {
var theObj = theObject(obj)
	lastObj = theObject(lastItem)
	lastObj.visibility = "hidden"
	theObj.visibility = "visible"
	
	lastItem = theObject(obj)
}

function hide(obj) {
var theObj = theObject(obj)
	theObj.visibility = "hidden"
	theObj.position = "absolute"
}