/*  $Header: mbcssplib.js, 2, 9/27/04 10:10:46 AM MDT, StarTeam Server Administrator$ : $Name: ST_migration_20040513 $  */

window.offscreenBuffering = true;
var cssp = (document.getElementById || document.layers || document.all);
function csspObj(obj) {
var o = (typeof obj == 'string') ? document.getElementById(obj) : eval(obj);
if(!o) return 0;
if(o.getProperty) return o;
if(document.layers) o.style = o;
if(!o.getElementsByTagName) o.getElementsByTagName = getElementsArray;
o.getProperty = CSSP_getProperty;
o.setProperty = CSSP_setProperty;
o.resizeTo = (o.resizeTo) ? o.resizeTo : CSSP_resizeTo;
o.resizeBy = (o.resizeBy) ? o.resizeBy : CSSP_resizeBy;
o.moveTo = (o.moveTo) ? o.moveTo : CSSP_moveTo;
o.moveBy = (o.moveBy) ? o.moveBy : CSSP_moveBy;
o.getClipValue = CSSP_getClipValue;
o.clipTo = CSSP_clipTo;
o.clipBy = CSSP_clipBy;
o.scrollBy = CSSP_scrollBy;
if(!o.parentNode) o.parentNode = getParent(o);
return eval(o);
}
function getParent(o) {
if(o.parentLayer) return o.parentLayer;
if(o.parentElement) return o.parentElement;
return 0;
}
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  : parseInt(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 = (document.layers) ? this.document.bgColor.toUpperCase() : (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 {
   var cl = (this.className) ? 'class = ' + this.className : '';
   this.document.open();
   this.document.write('<span '+cl+'>'+value+'</span>');
   this.document.close();
   return true;
   }
 }
return eval('this.style.'+property+'= value');
}
function rgbToHex(rgb) {
var a = rgb.match(/\d+/gi);
var s = '#';
  for(var i=0;i<a.length;i++) {
  var n = (a[i] == '0') ? '0' : '';
  var h = parseInt(a[i],10).toString(16).toUpperCase();
  s += n + '' + h;
  }
return s;
}
function createDiv(width,parent,className) {
var o = 0, d = window.document;
var b = (d.body) ? d.body : window;
var p = (parent) ? d.getElementById(parent) : b;
var obj = (parent) ? p : d; 
  if(d.createElement) p.appendChild(d.createElement('div'));
  else if(d.layers) o = new Layer(width,p);
  else if(d.all) p.innerHTML += '\n<div>&nbsp;</div>';
var a = obj.getElementsByTagName('div');  
o = a[a.length-1]; 
if(o.style) o.style.visibility = 'hidden';
o.className = className;
return o;
}