<!------------------------------------------------------------------------->
<!--                       Layers XBObj version 1.0                      -->
<!--     Copyright 2001, 2002 CollegeNET, Inc. All rights reserved.      -->
<!------------------------------------------------------------------------->

/*
*  - v1.0 Initial version
*  - v1.1 04/03/2002 JM Added support for Netscape 6.x (Gecko), and Explorer 5.x 6.x
*/

/****************************************************************************************
*  Usage Notes:
*
*  - All layer <div> tags MUST have a unique id attribute (duh!).
*  - Clip routines REQUIRE the clip rect property to be explicitly defined in the style.
*  - Style properties should be defined when using methods that return those properties.
*  - MakeBox does not set the clip automatically you may need to manually set the clip.
*  - To enable scrollBars the layer must contain an iFrame child and the content area's
*    bounds must exceed the layers visible region (except Nav4 doesn't support iFrames).
*  - Nav4 doesn't support iFrames, getIFrameXX() functions will return null ("") and
*    setIFrameXX() calls just return.
*  - To make an iFrame move with it's parent layer set the iFrame's style property to 
*    "position:relative;" applies to functions makeBox, moveLayer, setTop, and setLeft.
*  - ScrollLayers expects a layers clip rect to be a subset of the layers visible region.
*  - Function loadContent() has been replaced by loadDocument() for loading a new page
*    into an iFrame. LoadContent is supported for backward compatibility see prototypes.
*
*****************************************************************************************/


function LayerRef(windowRef,layerName) {
	this.layer = ""				// pointer to actual layer object
	if (is.ie) this.style = ""	// pointer to style information
	
	if (windowRef && layerName) {
		if (is.nav6up || is.ie5up) {
			var start = layerName.lastIndexOf(".")					// check for nested layerName
			if(start != -1) { layerName = layerName.substr(start+1) }
			this.layer = document.getElementById(layerName)
			this.style = this.layer.style
		}
		else if (is.nav4) {
			this.layer = eval("windowRef.document."+layerName)
		}
		else if (is.ie4) {
			var start = layerName.lastIndexOf(".")					// check for nested layerName
			if(start != -1) { layerName = layerName.substr(start+1) }
			this.layer = eval("windowRef.document.all."+layerName)
			this.style = this.layer.style
		}
	}
	return
}


function hideLayer() {
	if (is.nav6up || is.ie5up)
		this.layer.style.visibility = "hidden"
	else if (is.nav4)
		this.layer.visibility = "hide"
	else if (is.ie4)
		this.layer.style.visibility = "hidden"
}

function showLayer() {
	if (is.nav6up || is.ie5up)
		this.layer.style.visibility = "visible"
	else if (is.nav4)
		this.layer.visibility = "show"
	else if (is.ie4)
		this.layer.style.visibility = "visible"
}


function isVisible() {
	var retVal = false
	if (is.nav6up || is.ie5up) {
		if (this.layer.style.visibility==""){
			this.layer.style.visibility = getStyleById(this.layer.id,'visibility')
		}
		if(this.layer.style.visibility=="visible")
			retVal = true
	}
	else if (is.nav4 && this.layer.visibility=="show")
		retVal = true
	
	else if (is.ie4) {
		if (this.layer.style.visibility==""){
			this.layer.style.visibility = getStyleById(this.layer.id,'visibility')
		}
		if(this.layer.style.visibility=="visible")
			retVal = true
	}
	return (retVal)
}


function moveLayer(x,y) {
	if (is.nav6up || is.ie5up) {
		this.layer.style.left = x+"px"
		this.layer.style.top = y+"px"
	}
	else if (is.nav4)
		this.layer.moveTo(x,y)
		
	else if (is.ie4) {
		this.layer.style.left = x+"px"
		this.layer.style.top = y+"px"
	}
}


function clipLayer(clipLeft, clipTop, clipRight, clipBottom) {
	if(is.nav6up || is.ie5up) {
		this.layer.style.clip = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)'
	}
	else if (is.nav4) {
		this.layer.clip.left = clipLeft
		this.layer.clip.top = clipTop
		this.layer.clip.right = clipRight
		this.layer.clip.bottom = clipBottom
	}
	else if (is.ie4) {
		// Force a screen update if visible
		if (this.isVisible()) {
			this.hideLayer()
			this.layer.style.clip = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)'
			this.showLayer()
		}
		else this.layer.style.clip = 'rect('+clipTop+'px '+clipRight+'px '+clipBottom+'px '+clipLeft+'px)'
	}
}


function scrollLayer(dx, dy, checkBounds) {
	var clipLeft = this.getClipLeft(this.layer)
	var clipTop = this.getClipTop(this.layer)
	var clipRight = this.getClipRight(this.layer)
	var clipBottom = this.getClipBottom(this.layer)
	var left = this.getLeft(this.layer)
	var top = this.getTop(this.layer)
	
	// If scrolling the given amounts would move past the edges of the layer,
	// adjust the values so we stop right at the edge.
	if (checkBounds==true || arguments.length!=3) {
		if (clipLeft+dx < 0)
			dx = (-clipLeft)
		else if (clipRight+dx > this.getWidth())
			dx = this.getWidth() - clipRight
		if (clipTop+dy < 0)
			dy = (-clipTop)
		else if (clipBottom+dy > this.getHeight())
			dy = this.getHeight() - clipBottom
	}
	// Move both the clipping region and the layer so that the contents move
	// but the viewable region of the layer appears fixed relative to the page.
	this.clipLayer(clipLeft+dx, clipTop+dy, clipRight+dx, clipBottom+dy)
	this.moveLayer(left-dx, top-dy)
}


function getBgColor() {
	if (is.nav6up || is.ie5up){
		if (this.layer.style.backgroundColor==""){
			this.layer.style.backgroundColor = getStyleById(this.layer.id,'backgroundColor')
		}
		return this.layer.style.backgroundColor
	}
	else if (is.nav4) {
    	var str = this.layer.bgColor
    	if (isNaN(str)) {
      	return str
    	}
    	else return str.toString(16).toUpperCase()
  	}
  	else if (is.ie4) {
		if (this.layer.style.backgroundColor==""){
			this.layer.style.backgroundColor = getStyleById(this.layer.id,'backgroundColor')
		}
		return this.layer.style.backgroundColor
	}
}


function setBgColor(color) {
	if (is.nav6up || is.ie5up) {
		this.layer.style.backgroundColor = color
	}
	else if (is.nav4) {
		this.layer.bgColor = color
	}
	else if (is.ie4) {
		this.layer.style.backgroundColor = color
	}
}


// Gets the background color of an IFrame's document
function getIFrameColor(color) {
	var retVal = ""
	
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		
		// If an iFrame exists update it's documents background color
		if (iFrame != "") {
			// Gecko (nav6)
			if (iFrame.contentDocument) {
				var bodyElement = iFrame.contentDocument.getElementsByTagName("body")
				if (bodyElement) {
					retVal = bodyElement[0].getAttribute("bgColor")
				}
			}
			// Win (ie5.5 and ie6)
			else if (iFrame.contentWindow) {
				var bodyElement = iFrame.contentWindow.document.getElementsByTagName("body")
				if (bodyElement) {
					retVal = bodyElement[0].getAttribute("bgColor")
				}
			}
			// Mac (ie5)
			else if (document.frames) {
				retVal = this.layer.document.frames[0].document.body.style.backgroundColor
			}
		}
	}
	else if (is.ie4) {
		if (this.isIFrame()==true) {
			retVal = this.layer.document.frames[0].document.body.style.backgroundColor
		}
	}
	return retVal
}


// Sets the background color of an IFrame's document
function setIFrameColor(color) {
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		
		// If an iFrame exists update it's documents background color
		if (iFrame != "") {
			// Gecko (nav6)
			if (iFrame.contentDocument) {
				var bodyElement = iFrame.contentDocument.getElementsByTagName("body")
				if (bodyElement) {
					bodyElement[0].setAttribute("bgColor",color)
				}
			}
			// Win (ie5.5 and ie6)
			else if (iFrame.contentWindow) {
				var bodyElement = iFrame.contentWindow.document.getElementsByTagName("body")
				if (bodyElement) {
					bodyElement[0].setAttribute("bgColor",color)
				}
			}
			// Mac (ie5)
			else if (document.frames) {
				this.layer.document.frames[0].document.body.style.backgroundColor = color
			}
		}
	}
	else if (is.ie4) {
		if (this.isIFrame()==true) {
			this.layer.document.frames[0].document.body.style.backgroundColor = color
		}
	}
}


function setBgImage(imagesrc) {
	if (is.nav6up || is.ie5up) {
		this.layer.style.backgroundImage = 'url('+imagesrc+')'
	}
	else if (is.nav4) {
		this.layer.background.src = imagesrc
	}
	else if (is.ie4) {
		this.layer.style.backgroundImage = 'url('+imagesrc+')'
   }
}


function setIFrameImage(imagesrc) {
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		
		// If an iFrame exists update it's documents background image
		if (iFrame != "") {
			// Gecko (nav6)
			if (iFrame.contentDocument) {
				var bodyElement = iFrame.contentDocument.getElementsByTagName("body")
				if (bodyElement) { bodyElement[0].setAttribute("background",imagesrc) }
			}
			// Win (ie5.5 and ie6)
			else if (iFrame.contentWindow) {
				var bodyElement = iFrame.contentWindow.document.getElementsByTagName("body")
				if (bodyElement) { bodyElement[0].setAttribute("background",imagesrc) }
			}
			// Mac (ie5)
			else if (document.frames) {
				this.layer.document.frames[0].document.body.style.backgroundImage = 'url('+imagesrc+')'
			}
		}
	}
	else if (is.ie4) {
		if (this.isIFrame()==true)
			this.layer.document.frames[0].document.body.style.backgroundImage = 'url('+imagesrc+')'
		else
			this.layer.style.backgroundImage = 'url('+imagesrc+')'
    }
}


// NOTE: For newer browsers replaceContent() expects a layer <DIV> element 
function replaceContent(content) {
	if (is.nav6up || is.ie5up && this.layer.tagName=="DIV") {
		this.layer.innerHTML = content
	}
	else if (is.nav4) {
		this.layer.document.open()
		this.layer.document.write(content)
		this.layer.document.close()
	}
	else if (is.ie4) {
		// Because we are using an IFRAME to load new contents into a layer we should 
		// check to see if this layer has a IFRAME child before replacing its contents.
		if (this.isIFrame(content)==true) {
			// Replace the contents of the IFRAME child rather than the parent layer
			this.layer.document.frames[0].document.body.innerHTML = content
		}else{
			// No IFRAME child exists, or contents are themselves an IFRAME, so replace layer
			this.layer.innerHTML = content
		}
	}
}


// Formerly loadContent() which is still supported see prototypes.
// NOTE: For newer browsers loadDocument() expects the layer <DIV> to contain an iFrame child.
// In ie4 an iFrame element will be created if it does not already exist
function loadDocument(content) {
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		
		// If an iFrame was found update it's src attribute
		if (iFrame != "") {
			iFrame.setAttribute("src",content)
		}
	}
	else if (is.nav4) {
		this.layer.load(content,this.getClipWidth())
	}
	else if (is.ie4) {
		if (this.isIFrame(content)==true) {
			// In MSIE it is better to change the source of an IFRAME than a layer.
			// So when loading content we first create an IFRAME whose SRC attribute
			// points to the new content, and then use replaceContent to replace the
			// inner HTML of the layer with the new IFRAME and its contents.
			var width = this.getWidth()
			var height = this.getHeight()
	
			var obj = '<iframe id="Iframe" src="'+content+'" width="'+width+'" height="'+height+'"'
			obj += ' marginWidth="0" marginHeight="0" frameborder="0" scrolling="auto"></iframe>'
			this.replaceContent(obj)
		}
	}
}


function getLeft() {
	if (is.nav6up || is.ie5up) {
		if (this.layer.style.left=="") {
			this.layer.style.left = this.layer.offsetLeft
		}
		return (parseInt(this.layer.style.left))
	}
	else if (is.nav4)
		return(this.layer.left)
		
	else if (is.ie4) {
		if (this.layer.style.left=="") {
			this.layer.style.left = this.layer.offsetLeft
		}
		return (parseInt(this.layer.style.left))
	}
	else
		return (null)
}

function setLeft(left) {
	if (is.nav6up || is.ie5up)
		this.layer.style.left = left+"px"
	else if (is.nav4)
		this.layer.left = left
	else if (is.ie4)
		this.layer.style.left = left+"px"
}


function getTop() {
	if (is.nav6up || is.ie5up){
		if (this.layer.style.top=="") {
			this.layer.style.top = this.layer.offsetTop
		}
		return (parseInt(this.layer.style.top))
	}
	else if (is.nav4)
		return (this.layer.top)
	
	else if (is.ie4) {
		if (this.layer.style.top=="") {
			this.layer.style.top = this.layer.offsetTop
		}
		return (parseInt(this.layer.style.top))
	}
	else
		return (null)
}

function setTop(top) {
	if (is.nav6up || is.ie5up)
		this.layer.style.top = top+"px"
	else if (is.nav4)
		this.layer.top = top
	else if (is.ie4)
		this.layer.style.top = top+"px"
}


function getRight() {
	if (is.nav6up || is.ie5up) {
		if (this.layer.style.left=="") { this.layer.style.left = this.layer.offsetLeft }
		if (this.layer.style.width=="") { this.layer.style.width = this.layer.offsetWidth }
		return (parseInt(this.layer.style.left) + parseInt(this.layer.style.width))
	}
	else if (is.nav4)
		return (this.layer.left + this.layer.clip.width)
	
	else if (is.ie4) {
		if (this.layer.style.left=="") { this.layer.style.left = this.layer.offsetLeft }
		if (this.layer.style.width=="") { this.layer.style.width = this.layer.offsetWidth }
		return (parseInt(this.layer.style.left) + parseInt(this.layer.style.width))
	}
	else
		return (null)
}


function getBottom() {
	if (is.nav6up || is.ie5up) {
		if (this.layer.style.top=="") { this.layer.style.top = this.layer.offsetTop }
		if (this.layer.style.height=="") { this.layer.style.height = this.layer.offsetHeight }
		return (parseInt(this.layer.style.top) + parseInt(this.layer.style.height))
	}
	else if (is.nav4)
		return (this.layer.top + this.layer.clip.bottom)
	
	else if (is.ie4) {
		if (this.layer.style.top=="") { this.layer.style.top = this.layer.offsetTop }
		if (this.layer.style.height=="") { this.layer.style.height = this.layer.offsetHeight }
		return (parseInt(this.layer.style.top) + parseInt(this.layer.style.height))
	}
	else return (null)
}


function getWidth() {
	if (is.nav6up || is.ie5up) {
		if (this.layer.style.width=="") {
			this.layer.style.width = this.layer.offsetWidth
		}
		return (parseInt(this.layer.style.width))
	}
	else if (is.nav4) {
		return (this.layer.clip.right)
	}
	else if (is.ie4) {
		if (this.layer.style.width=="") {
			this.layer.style.width = this.layer.offsetWidth
		}
		return (parseInt(this.layer.style.width))
	}
	else return (null)
}

// For version 4.x browsers setWidth also sets the clipWidth
function setWidth(newWidth) {
	if (is.nav6up || is.ie5up) {
		this.layer.style.width = newWidth+"px"
	}
	else if (is.nav4) {
		this.setClipWidth(newWidth)
	}
	else if (is.ie4) {
		this.setClipWidth(newWidth)
		this.layer.style.width = newWidth+"px"
	}
}


// Applies to 5.x and 6.x browsers only
function getIFrameWidth() {
	var retVal = ""
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		if (iFrame != "") {
			retVal = iFrame.getAttribute("width")
		}
	}
	return retVal
}

// Applies to 5.x and 6.x browsers only
function setIFrameWidth(newWidth) {
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		if (iFrame != "") {
			iFrame.setAttribute("width",newWidth)
		}
	}
}


function getHeight() {
	if (is.nav6up || is.ie5up) {
		if (this.layer.style.height=="") {
			this.layer.style.height = this.layer.offsetHeight
		}
		return (parseInt(this.layer.style.height))
	}
	else if (is.nav4) {
		return (this.layer.clip.bottom)
	}
	else if (is.ie4) {
		if (this.layer.style.height=="") {
			this.layer.style.height = this.layer.offsetHeight
		}
		return (parseInt(this.layer.style.height))
	}
	else return (null)
}


// For version 4.x browsers setHeight also sets the clipHeight
function setHeight(newHeight) {
	if (is.nav6up || is.ie5up) {
		this.layer.style.height = newHeight+"px"
	}
	else if (is.nav4) {
		this.setClipHeight(newHeight)
	}
	else if (is.ie4) {
		this.setClipHeight(newHeight)
		this.layer.style.height = newHeight+"px"
	}
}


// Applies to 5.x and 6.x browsers only
function getIFrameHeight() {
	var retVal = ""
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		if (iFrame != "") {
			retVal = iFrame.getAttribute("height")
		}
	}
	return retVal
}

// Applies to 5.x and 6.x browsers only
function setIFrameHeight(newHeight) {
	if (is.nav6up || is.ie5up) {
		var iFrame = getIFrameChild(this.layer.id)
		if (iFrame != "") {
			iFrame.setAttribute("height",newHeight)
		}
	}
}


function makeBox(newWidth, newHeight, x, y) {
	if (is.nav6up || is.ie5up) {
		this.layer.style.left = x+"px"
		this.layer.style.top = y+"px"
		this.layer.style.width = newWidth+"px"
		this.layer.style.height = newHeight+"px"
	}
	else if (is.nav4) {
		this.layer.clip.left = 0
		this.layer.clip.top = 0
		this.layer.clip.right = newWidth
		this.layer.clip.bottom = newHeight
		this.layer.moveTo(x,y)
	}
	else if (is.ie4) {
		this.layer.style.left = x+"px"
		this.layer.style.top = y+"px"
		this.layer.style.width = newWidth+"px"
		this.layer.style.height = newHeight+"px"
	}
}


function getClipTop() {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[0])
	}
	else if (is.nav4)
		return (this.layer.clip.top)
		
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[0])
	}
	else return (null)
}


function getClipLeft() {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[3])
	}
	else if (is.nav4)
		return (this.layer.clip.left)
	
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[3])
	}
	else return (null)
}


function getClipRight() {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[1])
	}
	else if (is.nav4)
		return (this.layer.clip.right)
		
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[1])
	}
	else return (null)
}


function getClipBottom() {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[2])
	}
	else if (is.nav4)
		return (this.layer.clip.bottom)
		
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[2])
	}
	else return (null)
}


function getClipWidth() {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[1]-clip[3])
	}
	else if (is.nav4)
		return (this.layer.clip.width)
		
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[1]-clip[3])
	}
	else return (null)
}


function setClipWidth(newWidth) {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		this.clipLayer(clip[3],clip[0],newWidth,clip[2])
	}
	else if (is.nav4)
		this.layer.clip.width = newWidth
		
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		this.clipLayer(clip[3],clip[0],newWidth,clip[2])
	}
}


function getClipHeight() {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[2]-clip[0])
	}
	else if (is.nav4)
		return(this.layer.clip.height)
		
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		return (clip[2]-clip[0])
	}
	else return (null)
}


function setClipHeight(newHeight) {
	if (is.nav6up || is.ie5up) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		this.clipLayer(clip[3],clip[0],clip[1],newHeight)
	}
	else if (is.nav4)
		this.layer.clip.height = newHeight
	else if (is.ie4) {
		var clipStr = this.layer.style.clip
		if (clipStr=="auto" || clipStr=="") {
			clipStr = getStyleById(this.layer.id,'clip')
		}
		var clip = getClipValues(clipStr)
		this.clipLayer(clip[3],clip[0],clip[1],newHeight)
	}
}


function getzIndex() {
	if(is.nav6up || is.ie5up){
		if(this.layer.style.zIndex=="") {
			this.layer.style.zIndex = getStyleById(this.layer.id,'zIndex')
		}
		return (this.layer.style.zIndex)
	}
	else if (is.nav4)
		return (this.layer.zIndex)
	else if (is.ie4) {
		if(this.layer.style.zIndex=="") {
			this.layer.style.zIndex = getStyleById(this.layer.id,'zIndex')
		}
		return (this.layer.style.zIndex)
	}
	else return (null)
}


function setzIndex(z) {
	if(is.nav6up || is.ie5up)
		this.layer.style.zIndex = z
	else if (is.nav4)
    	this.layer.zIndex = z
	else if (is.ie4)
    	this.style.zIndex = z
}


function getClipValues(str) {
  var clip = new Array()
  var i

  // Parse out the clipping values from a clip property string ie "rect(10px 10px 10px 10px)"
  i = str.indexOf("(")
  clip[0] = parseInt(str.substring(i+1,str.length),10)
  i = str.indexOf(" ",i+1)
  clip[1] = parseInt(str.substring(i+1,str.length),10)
  i = str.indexOf(" ",i+1)
  clip[2] = parseInt(str.substring(i+1,str.length),10)
  i = str.indexOf(" ",i+1)
  clip[3] = parseInt(str.substring(i+1,str.length),10)
  
  return (clip)
}


function isIFrame(content) {
	var iFColl = this.layer.children.tags("IFRAME")
	if (iFColl.length>0) {
		if (content) {
			if (content.search(/\<IFRAME/gi)==-1) {
				return true
			}
		}else{
			return true
		}
	}
	return false
}

// Utiltiy function returns a reference to a layers iFrame child or null
function getIFrameChild(parentID) {
	var node = document.getElementById(parentID)
	var iFrame = ""
	
	// See if the node <div> has an iFrame child
	for(var i = 0; i<node.childNodes.length; i++) {
		if (node.childNodes.item(i).nodeName=="IFRAME") {
			iFrame = node.childNodes.item(i)
			break
		}
	}
	return iFrame
}

// Utiltiy function returns a style property from the styleSheets collection
// SelectorText is broken in Netscape 6.0
function getStyleById(id, property) {
	var retVal = ""
	
	// SelectorText format is (.id) mac ie5 format is (*.id or *#id) so truncate 1 or 2 leading chars
	var size = (is.mac && is.ie5) ? 2 : 1
		
	for (var i=0; i<document.styleSheets.length; i++) {
		// nav6 & mac ie5
		if (document.styleSheets[0].cssRules) {
			for (var j=0; j<document.styleSheets[i].cssRules.length; j++) {
				if (document.styleSheets[i].cssRules[j].selectorText.slice(size)==id) {	
					retVal = document.styleSheets[i].cssRules[j].style[property]
					break
				}
			}
		}
		// win ie5 & ie6, mac ie4
		else if (document.styleSheets[0].rules) {
			for (var j=0; j<document.styleSheets[i].rules.length; j++) {
				if (document.styleSheets[i].rules[j].selectorText.slice(size)==id) {
					retVal = document.styleSheets[i].rules[j].style[property]
					break
				}
			}
		}
		if(retVal != "") break
	}
	return retVal
}


// Layer Prototypes
LayerRef.prototype.hideLayer = hideLayer
LayerRef.prototype.showLayer = showLayer
LayerRef.prototype.isVisible = isVisible
LayerRef.prototype.moveLayer = moveLayer
LayerRef.prototype.scrollLayer = scrollLayer
LayerRef.prototype.clipLayer = clipLayer
LayerRef.prototype.getBgColor = getBgColor
LayerRef.prototype.setBgColor = setBgColor
LayerRef.prototype.getIFrameColor = getIFrameColor
LayerRef.prototype.setIFrameColor = setIFrameColor
LayerRef.prototype.setBgImage = setBgImage
LayerRef.prototype.setIFrameImage = setIFrameImage
LayerRef.prototype.replaceContent = replaceContent
LayerRef.prototype.loadContent = loadDocument
LayerRef.prototype.loadDocument = loadDocument
LayerRef.prototype.getLeft = getLeft
LayerRef.prototype.setLeft = setLeft
LayerRef.prototype.getTop = getTop
LayerRef.prototype.setTop = setTop
LayerRef.prototype.getRight = getRight
LayerRef.prototype.getBottom = getBottom
LayerRef.prototype.getWidth = getWidth
LayerRef.prototype.setWidth = setWidth
LayerRef.prototype.getIFrameWidth = getIFrameWidth
LayerRef.prototype.setIFrameWidth = setIFrameWidth
LayerRef.prototype.getHeight = getHeight
LayerRef.prototype.setHeight = setHeight
LayerRef.prototype.getIFrameHeight = getIFrameHeight
LayerRef.prototype.setIFrameHeight = setIFrameHeight
LayerRef.prototype.makeBox = makeBox
LayerRef.prototype.getClipLeft = getClipLeft
LayerRef.prototype.getClipTop = getClipTop
LayerRef.prototype.getClipRight = getClipRight
LayerRef.prototype.getClipBottom = getClipBottom
LayerRef.prototype.getClipWidth = getClipWidth
LayerRef.prototype.setClipWidth = setClipWidth
LayerRef.prototype.getClipHeight = getClipHeight
LayerRef.prototype.setClipHeight = setClipHeight
LayerRef.prototype.getzIndex = getzIndex
LayerRef.prototype.setzIndex = setzIndex
LayerRef.prototype.getClipValues = getClipValues
LayerRef.prototype.isIFrame = isIFrame
LayerRef.prototype.getStyleById = getStyleById

<!------------------------------------------------------------------->
<!-- These functions are usually needed whenever layers are used.  -->
<!------------------------------------------------------------------->

window.onresize = layers_resize
window.oldInnerWidth = window.innerWidth
window.oldInnerHeight = window.innerHeight

function layers_resize() {
	if (!is.nav4) return
	if (window.innerWidth != window.oldInnerWidth || window.innerHeight != window.oldInnerHeight) { window.location.reload() }
}
