/* !!! BASE API FUNCTIONS NAD PROPETIES !!! */
/* initialize the browser dom identifiers */
var ie=document.all;var dom=!ie&&document.getElementById;var nn=document.layers; 

/* get reference to the layer object for a layer */
function _obj(n,d){if(d==null)d=document;return (ie?d.all[n]:dom?d.getElementById(n):nn?d[n]:null);}

/* get reference to the style object for a layer */
function _style(n){var d=document;var obj=_obj(n,d);return (obj==null?null:(ie||dom)?obj.style:nn?obj:null);}

/* show immediately the layer given */
function _s(v){var o=_obj(v,document);if(o!=null&&o.to!=null)clearTimeout(o.to);((ie||dom)?_style(v).visibility='visible':nn?_style(v).visibility='show':void(0));}

/* hide immediately the layer given */
function _h(v){((ie||dom)?_style(v).visibility='hidden':nn?_style(v).visibility='hide':void(0));}

/* queue hide of layer given in 'n' ms */
function _qh(v,n){var o=_obj(v);if(o!=null){if(o.to)clearTimeout(o.to);o.to=setTimeout("hide('"+v+"')",n);}}

/* get width of layer given */
function _gw(v){var s=_style(v);if(s==null)return 0;else{var w=parseInt(s.width);return(isNaN(w)?0:w);}}

/* get height of layer given */
function _gh(v){var s=_style(v);if(s==null)return 0;else{var h=parseInt(s.height);return(isNaN(h)?0:h);}}


/* !!! MOUSE EVENT HANDLERS !!! */
/* get the horizontal screen position of the given mouse event */
function ex(e){return (nn||dom?e.pageX:ie?event.clientX:0);}

/* get the vertical screen position of the given mouse event */
function ey(e){return (nn||dom?e.pageY:ie?event.clientY:0);}

/* determine whether or not the mouse event given is a right click */
function rclick(e){return (nn&&e&&e.which&&(e.which==2||e.which==3))||(dom&&e&&(e.button==2||e.button==3))||(ie&&event&&(event.button==2||event.button==3))?true:false; }


/* !!! LAYER VISIBILITY FUNCTIONS !!! */
/* hide each of the layers given after 'n' ms - queuehide(100, 'layer1','layer2',...) */
function queuehide(n){for(var i=1;i<queuehide.arguments.length;i++)_qh(queuehide.arguments[i],n);} 

/* show each of the layers given immediately - show('layer1','layer2',...) */
function show(){for(var i=0;i<show.arguments.length;i++)_s(show.arguments[i]);} 

/* hide each of the layers given immediately hide('layer1','layer2',...) */
function hide(){for(var i=0;i<hide.arguments.length;i++)_h(hide.arguments[i]);} 


/* !!! LAYER DIMENSION FUNCTIONS !!! */
/* get width of layer given */
function width(v,nw){if(nw){var s=_style(v);if(s!=null){s.width=nw;}}else{return _gw(v);}}

/* get height of layer given */
function height(v,nh){if(nh){var s=_style(v);if(s!=null){s.height=nh;}}else{return _gh(v);}}

/* hide immediately the layer given */
function size(v,w,h){var s=_style(v);if(s!=null){s.width=w;s.height=h;}}


/* !!! LAYER POSITION FUNCTIONS !!! */
/* get the horizontal screen position of the layer */
function left(v){var s=_style(v);(s!=null?s.left:-1);}

/* get the vertical screen position of the layer */
function top(v){var s=_style(v);(s!=null?s.top:-1);}

/* set the position of the layer given to the screen (x,y) locations */
function pos(v,x,y){var s=_style(v);if(s!=null){s.top=y;s.left=x;}}

/* offset the height of the layer by the increment 'i' given to the max/min given in 'm' */
function setheight(v,m,i){var ch=height(v);if(ch<m&&i>0){height(v,Math.min(ch+i,m));return true;}else if(ch>m&&i<0){height(v,Math.max(ch+i,m));return true;}else return false;}
