window.offscreenBuffering = true;
var cssp = (document.getElementById || document.layers || document.all);
function csspObj(id) { 
 if(document.getElementById) {
  var obj = document.getElementById(id);
  }
  else if(document.all) {
  var obj =  eval('document.all.' + id);
  }
  else if(document.layers) {
  var obj = getLayer(id, document);
  obj.style = obj;
  }
if(!obj) return 0;   
obj.getProperty = CSSP_getProperty;
obj.setProperty = CSSP_setProperty;
obj.resizeTo = (obj.resizeTo) ? obj.resizeTo : CSSP_resizeTo;
obj.resizeBy = (obj.resizeBy) ? obj.resizeBy : CSSP_resizeBy;
obj.moveTo = (obj.moveTo) ? obj.moveTo : CSSP_moveTo;
obj.moveBy = (obj.moveBy) ? obj.moveBy : CSSP_moveBy;
obj.getClipValue = CSSP_getClipValue;
obj.clipTo = CSSP_clipTo;
obj.clipBy = CSSP_clipBy;
obj.scrollBy = CSSP_scrollBy;
  if(obj.captureEvents) {
  obj.captureEvents(Event.MOUSEDOWN);
  obj.onmousedown = eventRoute;
  }
return eval(obj);
}
function eventRoute(e){this.routeEvent(e)}
function CSSP_resizeTo(w,h) {
this.style.width = w;
this.style.height = h;
}
function CSSP_resizeBy(w,h) {
this.style.width = parseInt(this.style.width) + w;
this.style.height =  parseInt(this.style.height) + h;
}
function CSSP_moveBy(dx,dy) {
this.style.left = parseInt(this.style.left) + dx;
this.style.top =  parseInt(this.style.top) + dy;
}
function CSSP_moveTo(x,y) {
this.style.left = parseInt(x);
this.style.top =  parseInt(y);
}
function CSSP_getClipValue(which) {
  if(this.clip) {
  return eval('this.clip.' + which)
  }
  else {
  var clip =  this.style.clip.split('(')[1].split(')')[0].split(' ');
  if(which == 'top') return parseInt(clip[0]);
  if(which == 'right') return parseInt(clip[1]);
  if(which == 'bottom') return parseInt(clip[2]);
  if(which == 'left') return parseInt(clip[3]);
  }
}
function CSSP_clipTo(t,r,b,l) {
if(this.clip) { this.clip.top = t; this.clip.right = r; this.clip.bottom = b; this.clip.left = l; }
else this.style.clip = 'rect(' +t+ ' ' +r+ ' ' +b+ ' ' +l+ ')';
}
function CSSP_clipBy(t,r,b,l) {
var ct = (this.currenStyle) ? parseInt(this.currentStyle.clipTop) : this.getClipValue('top');
var cr = (this.currenStyle) ? parseInt(this.currentStyle.clipRight) : this.getClipValue('right');
var cb = (this.currenStyle) ? parseInt(this.currentStyle.clipBottom) : this.getClipValue('bottom');
var cl = (this.currenStyle) ? parseInt(this.currentStyle.clipLeft) : this.getClipValue('left');  
this.clipTo((ct + t),(cr + r),(cb + b),(cl + l)); 
}
function CSSP_scrollBy(dx,dy) {
this.moveBy(-dx,-dy);
this.clipBy(dy,dx,dy,dx);
}
function CSSP_getProperty(property) {
if(property == 'top') var top = parseInt(this.style.top);
if(property == 'left') var left = parseInt(this.style.left);
if(property == 'width') var width = (this.style.width) ? parseInt(this.style.width)  : parseInt(this.style.clip.width);
if(property == 'height') var height = (this.style.height) ? parseInt(this.style.height)  : parseInt(this.style.clip.height);
if(property == 'offsetWidth') var offsetWidth = (this.offsetWidth) ? this.offsetWidth  : parseInt(this.style.clip.width);
if(property == 'offsetHeight') var offsetHeight = (this.offsetHeight) ?  this.offsetHeight  : this.document.height;
if(property == 'zIndex') var zIndex = this.style.zIndex;
if(property == 'visibility') var visibility = (this.style.visibility == 'show' || this.style.visibility == 'visible') ? 'visible' : 'hidden'; 
if(property == 'bgColor') var bgColor = (this.bgColor) ? rgbToHex(this.bgColor) : (this.style.backgroundColor.indexOf('rgb') != -1) ? rgbToHex(this.style.backgroundColor.split('rgb(')[1].split(')')[0]) : this.style.backgroundColor.toUpperCase(); 
if(property == 'bgImage') var bgImage = (typeof(this.style.background) == 'object') ? this.style.background.src : (this.style.backgroundImage) ? this.style.backgroundImage.split('url(')[1].split(')')[0] : 'undefined';
return eval(property);
}
function CSSP_setProperty(property,value) {
 if(property == 'bgImage') {
 if(document.layers) return this.style.background.src = value;
 else return this.style.backgroundImage =  'url(' +value+ ')';
 }
 if(property == 'bgColor') {
 property =  (document.layers) ? 'document.bgColor' : 'backgroundColor';
 if(value == 'transparent' && document.layers) return this.document.bgColor = null;
 value = (value.indexOf('rgb(') != -1) ? rgbToHex(value.split('rgb(')[1].split(')')[0]) : value;
 }
 if(property == 'innerHTML') {
   if(this.innerHTML != null) {
   this.innerHTML = '';
   return this.innerHTML = value;
   }
   else {
   this.document.open();
   this.document.write(value);
   this.document.close();
   return true; 
   } 
 }
return eval('this.style.' + property + '= value');
}
function getLayer(name,doc) {
var i, layer;
if(!doc) doc = document;
  for(var i=0;i < doc.layers.length;i++) {
  layer = doc.layers[i];
  if(layer.name == name) return layer;
    if(layer.document.layers.length > 0) {
    layer = getLayer(name, layer.document);
    if(layer.name == name) return layer;
    }
  }
return 0;
}
function rgbToHex() {
var hexChar = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
var hexVal = '';
var rgb = (arguments.length > 1) ? arguments : arguments[0].toString().split(',');
  for(var i = 0; i < rgb.length; i++) {
  var decVal = parseInt(rgb[i],10);
  var Hex1 = Math.floor(decVal / 16);
  var Hex2 = Math.floor(decVal - (Hex1 * 16));
    if(Hex1 >= 16) return hexVal = rgbToHex(Hex1) + hexChar[Hex2]; 
    else {
    var h1 = (rgb.length == 1 && Hex1 <= 9) ? (hexChar[0] + hexChar[Hex1]) : hexChar[Hex1];
    hexVal += h1 + hexChar[Hex2]; 
    }
  }
return '#' + hexVal;
}
function SHLayer(layername,state) {
 	csspObj(layername).setProperty('visibility',state);
}
function cgLColor(lname,color) {
	csspObj(lname).setProperty('bgColor',color);
}

function setTop(layername,toppos) {
	csspObj(layername).setProperty('top',toppos);
}

function getTop(layername) {
	csspObj(layername).getProperty('top');
}