// 1k DHTML API
d=document;l=(d.layers)?1:0;op=navigator.userAgent.toLowerCase().indexOf('opera')!=-1;
g=navigator.userAgent.toLowerCase().indexOf('gecko') != -1;

// Get element by name
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];var t;for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}

// Show element
function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}

// Hide element
function hE(e){if(l)e.visibility='hide';else e.style.visibility='hidden';}

// Set Z index
function sZ(e,z){if(l)e.zIndex=z;else e.style.zIndex=z;}

// Set position/dimension
function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x;}
function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y;}
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;}

// Set clipping (top, right, bottom, left)
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+' '+r+' '+b+' '+x+')';}

// Write HTML contents
function wH(e,h){if(l){Y=e.document;Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;}

// Set display style
function sD(e,s){if(l)e.display=s;else e.style.display=s;}

// Set foreground/background colour
function sF(e,s){if(l)e.color=s;else e.style.color=s;}
function sB(e,s){if(l)e.background=s;else e.style.background=s;}

// Find position relative to parent element container
function glX(e){return e.offsetLeft;}
function glY(e){return e.offsetTop;}

// Find absolute position/dimensions
function gX(e){if (!e.offsetParent)return glX(e); else return glX(e) + gX(e.offsetParent);}
function gY(e){if (!e.offsetParent)return glY(e); else return glY(e) + gY(e.offsetParent);}
function gW(e){return e.offsetWidth;}
function gH(e){return e.offsetHeight;}

// Find mouse X and Y given the relevant event
function gMX(e){if (g)return e.pageX; else return event.clientX + document.body.scrollLeft;}
function gMY(e){if (g)return e.pageY; else return event.clientY + document.body.scrollTop;}
