/**** Made by Frank Hoffmann for StockholmBarcelona, www.stockholmbarcelona.com ****/
function Browser(){
	this.IE = false;
	this.IE4 = false;
	this.IE5 = false;
	this.Nav = false;
	this.Moz = false;
	this.Mac = false;
	if(navigator.appName == "Netscape"){
		if(parseInt(navigator.appVersion) >= 5)	this.Moz = true;
		else if(parseInt(navigator.appVersion.charAt(0)) == 4 && parseInt(navigator.appVersion.charAt(2)) >= 5)this.Nav = true; 
	}
	if(navigator.appVersion.indexOf('Mozilla')!=-1) this.Moz=true;
	if(parseInt(navigator.appVersion.charAt(navigator.appVersion.indexOf('MSIE') + 5))>=4) this.IE = true;
	if(parseInt(navigator.appVersion.charAt(navigator.appVersion.indexOf('Explorer') + 9))==5) this.IE = true;
	if(parseInt(navigator.appVersion.charAt(navigator.appVersion.indexOf('Explorer') + 8))==5) this.IE = true;
	this.Mac = (navigator.appVersion.lastIndexOf('Macintosh') != -1);
	if(parseInt(navigator.appVersion.charAt(navigator.appVersion.indexOf('MSIE') + 5)) == 4) this.IE4 = true;
}
is = new Browser();

function pLayer(id, left, top, width, height, nestedID, nestedID2, zIndex, visibility){
	this.id = id;
	this.x = left;
	this.y = top;
	this.w = width;
	this.h = height;
	this.nID = (nestedID) ? "document.layers." + nestedID + "." : "";
	this.nID2 = (nestedID2) ? "document.layers." + nestedID2 + "." : "";
	this.vis = visibility;
	this.zIndex = zIndex;
	this.HTML = "";
	this.cont = "";
	this.style = "";
	this.cTag = (is.Nav) ? "</layer>" : "</div>";
	this.clipped = false;
	this.BGC = false;
	this.BGI = false;
	
	this.setClip = setClipMethod;
	this.setBGC = setBGCMethod;
	this.setBGI = setBGIMethod;
	this.setCont = setContMethod;
	this.setStyle = setStyleMethod;
	this.fixLayer = fixLayerMethod;
	this.place = placeMethod;
	this.move = moveMethod;
	this.clip = clipMethod;
	this.clipBy = clipByMethod;
	this.setVis = setVisibilityMethod;
	this.opacity = opacityMethod;
	this.writeHTML = writeHTMLMethod;
}
function setClipMethod(top, right, bottom, left){
	this.clipped = true;
	this.cT = top;
	this.cR = right;
	this.cB = bottom;
	this.cL = left;
}
function setBGCMethod(background){
	this.BGC = background;
}
function setBGIMethod(background){
	this.BGI = background;
}
function setContMethod(str){
	this.cont = str;
	this.fixLayer();
}
function setVisibilityMethod(visible){
	this.vis = visible;
	if(visible == 2) eval(this.ref).visibility = "inherit";
	else if(visible == 1) eval(this.ref).visibility = "visible";
	else  eval(this.ref).visibility = "hidden";
}
function setStyleMethod(){
	var visTemp = "hidden";
	if(this.vis == 1) visTemp = "visibile";
	else if(this.vis == 2) visTemp = "inherit";
	if(is.Nav){
		this.style = "<layer id='" + this.id + "' name='" + this.id + "' left='" + this.x + "' top='" + this.y + "' width='" + this.w + "' height='" + this.h + "' z-index='" + this.zIndex + "' visibility='" + visTemp + "'";
		this.style += (this.clipped) ? " clip='" + this.cL + "," + this.cT + "," + this.cR + "," + this.cB + "'" : "";
		this.style += (this.BGC) ? " bgcolor='" + this.BGC + "'" : ""; 
		this.style += (this.BGI) ? " background='" + this.BGI + "'" : ""; 
		this.style += ">";
	}
	else{
		this.style = "<div id='" + this.id + "' style='position:absolute; left:" + this.x + "; top:" + this.y + "; width:" + this.w + "; height:" + this.h + "; z-index:" + this.zIndex + "; visibility:" + visTemp;
		this.style += (this.clipped) ? "; clip:rect(" + this.cT + " " + this.cR + " " + this.cB + " " + this.cL + ")" : "";
		this.style += (this.BGC) ? "; background-color:" + this.BGC : "";
		this.style += (this.BGI) ? "; background-image:url(" + this.BGI + ")" : "";
		this.style += "'>";
	}
	this.ref = (is.Nav) ? this.nID + this.nID2 + "document.layers." + this.id : (is.IE) ? "document.all." + this.id + ".style" : "document.getElementById('" + this.id +"').style";
}
function fixLayerMethod(){
	this.setStyle();
	this.HTML = this.style + this.cont + this.cTag;
}
function placeMethod(x, y){
	this.x = x;
	this.y = y;
	if(is.Nav) eval(this.ref).moveTo(x, y);
	else{
		eval(this.ref).left = x;
		eval(this.ref).top = y;
	}
}
function moveMethod(dX, dY){
	this.place(this.x + dX, this.y + dY);
}
function clipMethod(top, right, bottom, left){
	this.clipped = true;
	this.cT = top;
	this.cR = right;
	this.cB = bottom;
	this.cL = left;
	if(is.Nav){
		temp = eval(this.ref)
		temp.clip.bottom = bottom;
		temp.clip.right = right;
		temp.clip.left = left;		
		temp.clip.top = top;
	}
	else eval(this.ref).clip = "rect(" + top + " " + right + " " + bottom + " " + left + ")";	
}
function clipByMethod(dT, dR, dB, dL){
	this.clip(this.cT + dT, this.cR + dR, this.cB + dB, this.cL + dL);
}
function opacityMethod(opacity){
	if(is.IE){
		this.opac = opacity;
		eval(this.ref).filter = "alpha(opacity=" + opacity + ", style=0)";
	}
}
function writeHTMLMethod(str){
	this.cont = str;
	if(is.Nav){
		eval(this.ref).document.open();
		eval(this.ref).document.write(str);
		eval(this.ref).document.close();
	}
	else eval(this.ref2).innerHTML = str;

}