// ---------------------------------------------------------------------
// layers.js :: version 2.0.2


var LL_NN,LL_N6,LL_IE;
var LR_hide,LR_show,LR_originX,LR_originY,LR_origWidth,LR_origHeight,LR_initZ;
var LR_resizeHandler = '';



function LL_init() {
	LL_NN = (document.layers ? true : false );
	LL_IE = (document.all ? true : false);
	LL_N6 = (!LL_IE && (document.getElementById ? true : false));
	LR_hide = (LL_NN ? 'hide' : 'hidden');
	LR_show = (LL_NN ? 'show' : 'visible');

	LR_originX = 0;
	LR_originY = 0;
	//LR_initZ = -100;
	
	LL_setOrigDims();
}

function LL_layerExists(layerName) {
	return ((layerName) && (LR_getLayer(layerName) != null));
}

function LL_shiftTo(layer,x,y) {
	var theLayer = LR_getLayer(layer);
	if (LL_NN) {
		theLayer.moveTo(x + LR_originX, y + LR_originY);
	} else if (LL_IE) {
		theLayer.pixelLeft = x + LR_originX;
		theLayer.pixelTop = y + LR_originY;
	} else {	// N6
		theLayer.left = x + LR_originX + "px";
		theLayer.top = y + LR_originY + "px";
	}
}

function LL_shiftBy(layer,deltaX,deltaY) {
	var theLayer = LR_getLayer(layer);
	if (LL_NN) {
		theLayer.moveBy(deltaX,deltaY);
	} else if (LL_IE) {
		theLayer.pixelLeft += deltaX;
		theLayer.pixelTop += deltaY;
	} else {	// N6
		theLayer.left = parseInt(theLayer.left) + deltaX + "px";
		theLayer.top = parseInt(theLayer.top) + deltaY + "px";
	}
}

function LL_setLayerClip(layer,left,top,right,bottom) {
	var theLayer = LR_getLayer(layer);
	if (LL_NN) {
		theLayer.clip.left = left;
		theLayer.clip.top = top;
		theLayer.clip.right = right;
		theLayer.clip.bottom = bottom;
	} else if (LL_IE) {
		theLayer.clip = 'rect(' + top + ' ' + right + ' ' + bottom + ' ' +
			left + ')';
	} else {	// N6
		theLayer.clip = 'rect(' + top + 'px, ' + right + 'px, ' + bottom +
			'px, ' + left + 'px)';
	}
}

function LL_showLayer(layer) {
	var theLayer = LR_getLayer(layer);
	if (theLayer) {
		theLayer.visibility = LR_show;
	}
}

function LL_hideLayer(layer) {
	var theLayer = LR_getLayer(layer);
	if (theLayer) {
		theLayer.visibility = LR_hide;
	}
}

function LL_setZIndex(num) {
	LR_initZ = num;
}

function LL_makeLayer(aName, left, top, width, height, vis, copy, clss) {
	left += LR_originX;
	top += LR_originY;
	if (LL_NN) {
		document.writeln('<LAYER NAME="' + aName + '" LEFT="' + left +
			'" TOP="' + top + '" WIDTH="' + width + '" HEIGHT="' + height +
			'" VISIBILITY="' + (vis ? LR_show : LR_hide) + '" Z-INDEX="' + 
			LR_initZ + '"' + (! clss ? '' : ' CLASS="' + clss + '"') + 
			'>' + copy + '\</LAYER>');			
	} else {	// IE or N6
		document.writeln('<DIV ID="' + aName +
			'" STYLE="position: absolute; overflow: none; left:' + left +
			'px; top:' + top + 'px; width:' + width + 'px; height:' + height +
			'px; ' + 'visibility:' + (vis ? LR_show : LR_hide) + '; z-index:' +
			LR_initZ + ';"' + (! clss ? '' : ' CLASS="' + clss + '"') + '>'
			+ copy + '\</DIV>');
	}
	LR_initZ++;
}

function LL_catchResize(userHandler) {
	onresize = LR_handleResize;
	if (LL_N6) {
		document.addEventListener("resize",LR_handleResize,true);
	}
	LR_resizeHandler = userHandler;
}


function LL_setOrigDims() {
	if (LL_NN || LL_N6) {
		LR_origWidth = innerWidth;
		LR_origHeight = innerHeight;
	} else {
		LR_origWidth = document.body.clientWidth;
		LR_origHeight = document.body.clientHeight;
	}
}

function LL_getOrigWidth() {
	return LR_origWidth;
}

function LL_getOrigHeight() {
	return LR_origHeight;
}

function LR_getLayer(layer) {

	var theLayer = null;
	if (typeof layer == 'string' ) {

		if (LL_NN) {
			theLayer = eval("document." + layer);
		} else {
			if (LL_IE) { 
				theLayer = eval("document.all." + layer);
			} else {	// N6
				theLayer = document.getElementById(layer);
			}
			
			if (theLayer != null) {
				theLayer = theLayer.style;
			}
		}
	} else {
		theLayer = layer;
	}
	return theLayer;
}

function LR_handleResize(evt) {
	if (LL_NN) {
		if (innerWidth != LR_origWidth || innerHeight != LR_origHeight) {
			location.reload();
		}
	} else if (LR_resizeHandler != '') {
		eval(LR_resizeHandler + '();');
	}
}

