// Browser capability detection
var d=document;
var l=(d.layers)?1:0;
var ie=(d.all)?1:0;
var dom=(d.getElementById)?1:0;
var ua=navigator.userAgent.toLowerCase();
var mac=ua.indexOf('mac')!=-1;
var op=ua.indexOf('opera')!=-1;
var ll=ua.indexOf('4.08')!=-1;
var n6=ua.indexOf('netscape6')!=-1;
if(ua.indexOf("4.")!=-1) v=4;
if(ua.indexOf("5.")!=-1) v=5;
if(ua.indexOf("5.5")!=-1) v=5.5;
if(ua.indexOf("6.0")!=-1) v=6;

// Common functions
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)var t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}
function hE(e){if(l)e.visibility='hide';else e.style.visibility='hidden';}
function sD(e,s){s=s?'block':'none';if(l)e.display=s; else e.style.display=s;}
function sZ(e,z){if(l)e.zIndex=z;else e.style.zIndex=z;}
function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x+'px';}
function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y+'px';}
function sW(e,w){if(l)e.clip.width=w;else if(op)e.style.pixelWidth=w;else e.style.width=w;}
function sH(e,h){if(l)e.clip.height=h;else if(op)e.style.pixelHeight=h;else e.style.height=h;}
function sC(e,t,r,b,x){if(l){X=e.clip;X.top=t;X.right=r;X.bottom=b;X.left=x;}else e.style.clip='rect('+t+'px '+r+'px '+b+'px '+x+'px)';}
function sP(e,x,y){sX(e,x);sY(e,y)}
function sS(e,w,h){sW(e,w);sH(e,h)}
function iE(e,x,y){sX(e,x);sY(e,y);sE(e)}
function iV(e,w,h){sS(e,w,h);sC(e,0,w,h,0)}
function wH(e,h){if(l){D=e.document;D.open();D.write(h);D.close()}if(e.innerHTML)e.innerHTML=h;}
function gH(e){if(l)return e.clip.height;else if(op)return e.style.pixelHeight;else if(ie)return e.clientHeight; else return e.offsetHeight}
function gT(e){if(l)return e.top;else return parseInt(e.style.top)}
function gX(e){if(l)return e.left;else return parseInt(e.offsetLeft)}
function gY(e){if(l)return e.pageY;else return parseInt(e.offsetTop)}
function gW(e){if(l)return e.clip.width;else return (e.offsetWidth)}
function gV(e){if(l)return e.visibility;else return e.style.visibility; }
function docW(){return ie&&d.body.clientWidth||innerWidth||0}
function docH(){return ie&&d.body.clientHeight||innerHeight||0}
function docMaxH(){return ie&&d.body.clientHeight||innerHeight||0}

// Attach event
// e: Element
// v: Event e.g. "mouseover"
// f: Function
// c: Capture mouse events
function aE(e,v,f,c){
	
	if(e.addEventListener){
		
		e.addEventListener(v,f,c);
		
	}else if(e.attachEvent){
		
		e.attachEvent("on"+v,f);
		
	}else{
		
		eval("e.on"+v+"="+f);
		
	}
}													

// Get/set background colour
// e: Element
// c: Colour
function gK(e){ 

	if(l){
	
		return e.backgroundColor; 
		
	}else{
		
		return e.style.backgroundColor; 
		
	}
	
}		
function sK(e,c){ 
	
	if(l){
		
		e.backgroundColor=c; 
		
	}else{
		
		e.style.backgroundColor=c;
		
	}
	
}