//Style
//Background
function setBackgroundColor(id, x) {if ((x!=null)&&(x.length>0)) document.getElementById(id).style.backgroundColor = x;}
function getBackgroundColor(id) {return document.getElementById(id).style.backgroundColor;}

//Border
function setBorder(id, x) {document.getElementById(id).style.border = x;}
function getBorder(id) {return document.getElementById(id).style.border;}

function setBorderColor(id, x) {document.getElementById(id).style.borderColor = x;}
function getBorderColor(id) {return document.getElementById(id).style.borderColor;}

function setBorderStyle(id, x) {document.getElementById(id).style.borderStyle = x;}
function getBorderStyle(id) {return document.getElementById(id).style.borderStyle;}

function setBorderWidth(id, x) {document.getElementById(id).style.borderWidth = x;}
function getBorderWidth(id) {return document.getElementById(id).style.borderWidth;}

//Classification
function setCursor(id, x) {document.getElementById(id).style.cursor = x;}
function getCursor(id) {return document.getElementById(id).style.cursor;}

function setPosition(id, x) {document.getElementById(id).style.position = x;}
function getPosition(id) {return document.getElementById(id).style.position;}

function setVisibility(id, x) {document.getElementById(id).style.visibility = x;}
function getVisibility(id) {return document.getElementById(id).style.visibility;}

//Dimension
function setHeight(id, x) {if ((x!=null)) document.getElementById(id).style.height = x;}
function getHeight(id) {return document.getElementById(id).style.height;}

function setWidth(id, x) {if ((x!=null)) document.getElementById(id).style.width = x;}
function getWidth(id) {return document.getElementById(id).style.width;}

//Font
function setFont(id, x) {document.getElementById(id).style.fontFamily = x;}
function getFont(id) {return document.getElementById(id).style.fontFamily;}

function setFontSize(id, x) {document.getElementById(id).style.fontSize = x;}
function getFontSize(id) {return document.getElementById(id).style.fontSize;}

function setFontStyle(id, x) {document.getElementById(id).style.fontStyle = x;}
function getFontStyle(id) {return document.getElementById(id).style.fontStyle;}

function setFontVariant(id, x) {document.getElementById(id).style.fontVariant = x;}
function getFontVariant(id) {return document.getElementById(id).style.fontVariant;}

function setFontWeight(id, x) {document.getElementById(id).style.fontWeight = x;}
function getFontWeight(id) {return document.getElementById(id).style.fontWeight;}

//Padding
function setPadding(id, x) {document.getElementById(id).style.padding = x;}
function getPadding(id) {return document.getElementById(id).style.padding;}

//Positioning
function setLeft(id, x) {document.getElementById(id).style.left = x;}
function getLeft(id) {return document.getElementById(id).style.left;}

function setTop(id, x) {document.getElementById(id).style.top = x;}
function getTop(id) {return document.getElementById(id).style.top;}

function setZ(id, x) {document.getElementById(id).style.zIndex = x;}
function getZ(id) {return document.getElementById(id).style.zIndex;}

//Text
function setColor(id, x) {document.getElementById(id).style.color = x;}
function getColor(id) {return document.getElementById(id).style.color;}

function setAlign(id, x) {document.getElementById(id).style.textAlign = x;}
function getAlign(id) {return document.getElementById(id).style.textAlign;}

function setWhiteSpace(id, x) {document.getElementById(id).style.whiteSpace = x;}
function getWhiteSpace(id) {return document.getElementById(id).style.whiteSpace;}

//Opacity
function setOpacity(id, x)
{
  if ((x != null) && (x > -1))
  {
    var s = document.getElementById(id).style;
    s.opacity      = (x / 100);
    s.MozOpacity   = (x / 100);
    s.KhtmlOpacity = (x / 100);
    s.filter       = 'alpha(opacity=' + x + ')';
  }
}



function setChecked(id, x) {if ((x==true)||(x==false)) document.getElementById(id).checked = x;}
function getChecked(id) {return document.getElementById(id).checked;}

function setDisabled(id, x) {if ((x==true)||(x==false)) document.getElementById(id).disabled = x;}
function getDisabled(id) {return document.getElementById(id).disabled;}

function setReadOnly(id, x) {if ((x==true)||(x==false)) document.getElementById(id).readOnly = x;}
function getReadOnly(id) {return document.getElementById(id).readOnly;}

function setTitle(id, x) {if ((x!=null)&&(x.length>0)) document.getElementById(id).title = x;}
function getTitle(id) {return document.getElementById(id).title;}

function setValue(id, x) {document.getElementById(id).value = x;}
function getValue(id) {return document.getElementById(id).value;}

function addCaption(id, x) {document.getElementById(id).appendChild(document.createTextNode(x));}
function setCaption(id, x) {document.getElementById(id).firstChild.data = x;}
function getCaption(id) {return document.getElementById(id).firstChild.data;}


// Table
function setCellPadding(id, x) {if (x!=null) document.getElementById(id).cellPadding = x;}
function getCellPadding(id) {return document.getElementById(id).cellPadding;}

function setCellSpacing(id, x) {if (x!=null) document.getElementById(id).cellSpacing = x;}
function getCellSpacing(id) {return document.getElementById(id).cellSpacing;}

//Cell
function setColSpan(id, x) {if ((x!=null)&&(x>0)) document.getElementById(id).colSpan = x;}
function getColSpan(id) {return document.getElementById(id).colSpan;}

function setRowSpan(id, x) {if ((x!=null)&&(x>0)) document.getElementById(id).rowSpan = x;}
function getRowSpan(id) {return document.getElementById(id).rowSpan;}


// Window
function getWinWidth()
{
  if (document.body.offsetWidth) return document.body.offsetWidth;
  else if (window.innerWidth) return window.innerWidth;
}
function getWinHeight()
{
  if (document.body.offsetHeight) return document.body.offsetHeight;
  else if (window.innerHeight) return window.innerHeight;
}

function getMouseX(e)
{
  var x = 0;

  if (!e) e = window.event;
  if (e.pageX) x = e.pageX; 
  else if (e.clientX) x = e.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);

  return (x * 1.0);
}
function getMouseY(e)
{
  var y = 0;

  if (!e) e = window.event;
  if (e.pageY) y = e.pageY;
  else if (e.clientY) y = e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);

  return (y * 1.0);
}

function getToolTip(x)
{
  var omOver  = '';
  var omOut   = '';

  if ((x!=null)&&(x.length>0))
  {
    omOver  = 'onmouseover="' + x + '.show(event);"';
    omOut   = 'onmouseout ="' + x + '.hide();"';
  }
  return (omOver + omOut);
}

function fade(id, OStart, OEnd, Millisec)
{
  var FPS = 40;                                   // Frames per Second
  var F   = Math.round((Millisec / 1000) * FPS);  // Frames
  var MPF = Math.round(Millisec / F);             // Milliseconds per Frame
  var OPF = Math.abs(OStart - OEnd) / F;          // Opacity per Frame
  var O = 0;
  var t = 0;
  var i = 0;

  for(i=1; i<=F; i++)
  {
    if (OStart < OEnd) O = OStart + (i * OPF);
    if (OStart > OEnd) O = OStart - (i * OPF);
    t = i * MPF
    setTimeout('setOpacity("' + id + '",' + O + ')', t);
  }
}

function clearSelect(id)
{
  var o = document.getElementById(id);
  o.options.length = 0;
}