function RollClass(ListItem)
{
  if (ListItem.className == "Off")
    ListItem.className = "On";
  else
    ListItem.className = "Off";
}

function RollGif(ListItem)
{
  var sGif = document[ListItem].src;
  
  if (sGif.indexOf("Roll") > 0)
    document[ListItem].src = sGif.substring(0, sGif.length - 8) + ".gif";
  else
    document[ListItem].src = sGif.substring(0, sGif.length - 4) + "Roll.gif";
}

function FindObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length){
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document); return x;
}

function SetSelectValue(sItem, sOption)
{
  var oItem = FindObj(sItem);
  var iOpt  = oItem.length;
  for (i=0; i<iOpt-1; i++)
    if (oItem.options[i].value == sOption) oItem.options[i].selected = true;
}


function GetSelectValue(sItem)
{
  var oItem = FindObj(sItem);
  return oItem.options[oItem.selectedIndex].value
}

function ForceUpperCase(sItem)
{
  var oItem = FindObj(sItem);
  oItem.value = oItem.value.toUpperCase();
}


function LeftPad(sValue, sPad, iSize)
{
  var sTemp = sValue;
  
  for (i=0; i<iSize; i++) sTemp = sPad + sTemp;
  sTemp = sTemp.substring(sTemp.length - iSize, sTemp.length)
  return sTemp;
}


function RightPad(sValue, sPad, iSize)
{
  var sTemp = sValue;
  
  for (i=0; i<iSize; i++) sTemp = sTemp + sPad;
  sTemp = sTemp.substring(1, iSize)
  return sTemp;
}


function IsEmpty(s)
{
  return ((s == null) || (s.length == 0))
}


var whitespace = " \t\n\r";
function IsWhitespace (s)
{
  var i;
  // Is string empty ?
  if (IsEmpty(s)) return true;
  // Check for WhiteSpaces Charcters
  for (i = 0; i < s.length; i++)
  {   
    // Check that List character isn't whitespace.
    var c = s.charAt(i);
    if (whitespace.indexOf(c) == -1) return false;
  }
  // All OK
  return true;
}
