var ismc = (navigator.appVersion.indexOf("Mac") != -1);
var issafari = (navigator.appVersion.indexOf("Safari") != -1);
var nscp = ( (navigator.appName == "Netscape") && ( ! issafari ) );
var vers = parseFloat(navigator.appVersion.substring(22,25));
var isNS6 = (!document.all && document.getElementById) ? true : false;

function pageXY(obj)
{
  var x,y;

  for( x=0,y=0; obj; obj = obj.offsetParent)
  { x +=  obj.offsetLeft;
    y +=  obj.offsetTop;
  }
  return {x: x, y: y};

}

function getTop(obj)
{
	var topVal;
	if (isNS6)
	{
		topVal = getLayer(obj).offsetTop;
	}
	else
	 if (nscp)
	{	topVal = getLayer(obj).top;
	}
	else
	{	topVal = getLayer(obj).offsetTop;
	}
	return topVal;
}

function getBottom(obj)
{
	var bottVal;
	if (isNS6)
	{
		bottVal = getLayer(obj).offsetTop;
	}
	else
	 if (nscp)
	{	bottVal = getLayer(obj).top;
	}
	else
	{	bottVal = (getLayer(obj).style.posTop?getLayer(obj).style.posTop:getLayer(obj).offsetTop);
	}
	bottVal += layerHeight(obj);
	return bottVal;
}

function getLayer(obj)
{
	if (isNS6)
	{
		compLayr = document.getElementById(obj);
	}
	else
	 if (nscp)
	{	compLayr = document.layers[obj];
	}
	else
	{	compLayr = eval("document.all." + obj);
	}
	return compLayr
}

function getObj(obj)
{	
	if (isNS6)
	{
		compLayr = document.getElementById(obj).style;
	}
	else
	 if (nscp)
	{	compLayr = document.layers[obj];
	}
	else
	{	compLayr = eval("document.all." + obj + ".style");
	}
	return compLayr
}


var macTimeout1;
var macTimeout2;

function setTop(layr,num)
{	obj = getObj(layr)
    obj.position = 'absolute';
	if (isNS6)
	{	obj.top = num + "px";
	}
	else
	if (nscp)
	{	obj.top = num;
	}
	else
	{	obj.posTop = num;
	}
	    // IF its a Mac and its IE (NOT NETSCAPE)
        if ( ( ismc ) && ( document.all || issafari ) )
        {
            clearTimeout(macTimeout1);
            clearTimeout(macTimeout2);            
            macTimeout1 = setTimeout("window.resizeBy(1,1);",100);
            macTimeout2 = setTimeout("window.resizeBy(-1,-1);",200);
        }
}

function setWidth(layr,num)
{	obj = getObj(layr)
	if (isNS6)
	{	obj.width = num + "px";
	}
	else
	if (nscp)
	{	obj.clip.width = num;
	}
	else
	{	obj.width = num;
	}
	    // IF its a Mac and its IE (NOT NETSCAPE)
        if ( ( ismc ) && ( document.all ) )
        {
            clearTimeout(macTimeout1);
            clearTimeout(macTimeout2);            
            macTimeout1 = setTimeout("window.resizeBy(0,1);",100);
            macTimeout2 = setTimeout("window.resizeBy(0,-1);",200);
        }
}

function setHeight(layr,num)
{	obj = getObj(layr)
	if (isNS6)
	{	obj.height = num + "px";
	}
	else
	if (nscp)
	{	obj.clip.height = num;
	}
	else
	{	obj.height = num;
	}
	    // IF its a Mac and its IE (NOT NETSCAPE)
        if ( ( ismc ) && ( document.all ) )
        {
            clearTimeout(macTimeout1);
            clearTimeout(macTimeout2);            
            macTimeout1 = setTimeout("window.resizeBy(0,1);",100);
            macTimeout2 = setTimeout("window.resizeBy(0,-1);",200);
        }
}


function setLeft(layr,num)
{	obj = getObj(layr)
    obj.position = 'absolute';
	if (isNS6)
	{	obj.left = num + "px";
	}
	else
	if (nscp)
	{	obj.left = num;
	}
	else
	{	obj.posLeft = num;
	}
	    // IF its a Mac and its IE (NOT NETSCAPE)
        if ( ( ismc ) && ( document.all ) )
        {
            clearTimeout(macTimeout1);
            clearTimeout(macTimeout2);            
            macTimeout1 = setTimeout("window.resizeBy(0,1);",100);
            macTimeout2 = setTimeout("window.resizeBy(0,-1);",200);
        }
}


// function to show later

function show(layr)
{	obj = getObj(layr);
	obj.visibility = "visible";
}

// function to hide later

function hide(layr)
{	obj = getObj(layr);
	obj.visibility = "hidden";
}

// this is used to get the the height of the page (used with the global nav 

function layerHeight(layr)
{	
	if (isNS6)
	{
		return (parseInt(document.getElementById(layr).offsetHeight));
	}
	else
	if (nscp)
	{	return eval("document.layers['" + layr + "'].clip.height");
	}
	else
	{	return eval("document.all." + layr + ".offsetHeight");
	}
}

function getWidth(layr)
{
	return layerWidth(layr);
}

function getHeight(layr)
{
	return layerHeight(layr);
}
// this is for the rollovers 

function imgOn(layerName,imgName)
{
	if (isNS6)
	{
		document[imgName].src = eval(imgName + "on.src");
	}
	else
	if (nscp)
	{	
		eval("document.layers['" + layerName + "'].document[imgName].src = " + imgName + "on.src");
	}
	else
	{	
		document[imgName].src = eval(imgName + "on.src");
	}
}

function imgOff(layerName,imgName)
{
	if (isNS6)
	{
		document[imgName].src = eval(imgName + "off.src");
	}
	else
	if (nscp)
	{	
		eval("document.layers['" + layerName + "'].document[imgName].src = " + imgName + "off.src");
	}
	else
	{	
		document[imgName].src = eval(imgName + "off.src");
	}
}
   


// this is to document the width

function layerWidth(layr)
{
	if (isNS6)
	{
		return (parseInt(document.getElementById(layr).style.width));
	}
	else
	if (nscp)
	{	return eval("document.layers['" + layr + "'].clip.width");
	}
	else
	{	return eval("document.all." + layr + ".scrollWidth");
	}
}


// this is to document the left coordiate


function getLeft(layr)
{	obj = getObj(layr)
	if (isNS6)
	{	return (parseInt(obj.left));
	}
	else
	if (nscp)
	{	return (obj.left);
	}
	else
	{	x = eval(layr + ".offsetLeft")
		return (x);
	}
}



function incTop(layr,num)
{	obj = getObj(layr)
	if (isNS6)
	{	obj.top = (parseInt(obj.top) + num + "px")
	}
	else
	if (nscp)
	{	obj.top = obj.top + num
	}
	else
	{	a = eval(layr + ".offsetTop")
		obj.top = a + num
	}
}
