function noop() {
}

function goBack() {
  window.history.go(-1);
}

// dynamic HTML utility method
function changeElem(id, innerHTML, top, left, bottom, right, width, height, color, bgColor, bdrTop, bdrLeft, bdrBottom, bdrRight, visibility, zIdx, fontWeight) {
  var obj = document.getElementById(id);
  if (obj) {
    if (innerHTML) obj.innerHTML = innerHTML;

    if (top != null) obj.style.top = top + "px";
    if (left != null) obj.style.left = left + "px";
    if (bottom != null) obj.style.bottom = bottom + "px";
    if (right != null) obj.style.right = right + "px";
    if (width != null) obj.style.width = width + "px";
    if (height != null) obj.style.height = height + "px";
    if (color != null) obj.style.color = color;
    if (bgColor != null) obj.style.backgroundColor = bgColor;
    if (bdrTop != null) obj.style.borderTop = bdrTop;
    if (bdrLeft != null) obj.style.borderLeft = bdrLeft;
    if (bdrBottom != null) obj.style.borderBottom = bdrBottom;
    if (bdrRight != null) obj.style.borderRight = bdrRight;
    if (visibility != null) obj.style.visibility = visibility;
    if (zIdx != null) obj.style.zIndex = zIdx;
    if (fontWeight != null) obj.style.fontWeight = fontWeight;
  }
}

var currButtonId = 'Home';
var selectButtonTimer = null;
var backColor = "#2683AE";
var btnActiveColor = "#FFFFFF";
var btnActiveBgcolor = "#2683AE";
var btnInactiveColor = "#CEE1EF";
var btnInactiveBgcolor = "#464646";

function scheduleSelectButton() {
  if (selectButtonTimer != null) {
    window.clearTimeout(selectButtonTimer);
  }
  selectButtonTimer = window.setTimeout("selectButton();", 150);  
}

function selectButton() {
  var myIFrame = top.frames[0];
  var loc = currButtonId.toLowerCase();
  myIFrame.window.location.href = loc + ".html";
  changeElem(currButtonId,null,null,null,null,null,null,null,btnActiveColor,btnActiveBgcolor,btnActiveBgcolor+" 2px solid",null,btnActiveBgcolor+" 2px solid",null,null,null,null);
}

function unselectButton(id) {
  changeElem(id,null,null,null,null,null,null,null,btnInactiveColor,btnInactiveBgcolor,btnInactiveBgcolor+" 2px solid",null,btnInactiveBgcolor+" 2px solid",null,null,null,null);
}

function btnMouseOver(id) {
  if (id == currButtonId)
    return;
  changeElem(id,null,null,null,null,null,null,null,null,null,btnActiveBgcolor,null,btnActiveBgcolor+" 4px solid",null,null,null,null);
}

function btnMouseOut(id) {
  if (id == currButtonId)
    return;
  changeElem(id,null,null,null,null,null,null,null,null,null,btnInactiveBgcolor+" 2px solid",null,btnInactiveBgcolor+" 2px solid",null,null,null,null);
}

function btnMouseClick(id) {
  if (id == currButtonId)
    return;
  var tmpId = currButtonId;
  currButtonId = id;
  var loc = tmpId.toLowerCase();
  if (loc == 'location') {
    changeElem("IFrameDiv", '<iframe name="ContentArea" id="ContentArea" width="100%" height="650px" scrolling="auto" noresize frameborder="0"></iframe>');
  }
  scheduleSelectButton();
  unselectButton(tmpId);  
}

var currMenuId = 'Search';
var selectMenuTimer = null;

function scheduleSelectMenu() {
  if (selectMenuTimer != null) {
    window.clearTimeout(selectMenuTimer);
  }
  selectMenuTimer = window.setTimeout("selectMenu();", 10);
}

function selectMenu() {
  changeElem(currMenuId+"Div",null,null,null,null,null,null,null,null,null,null,null,null,null,'visible','10',null);
  changeElem(currMenuId,null,null,null,null,null,'175',null,null,'#ffffff',null,null,"#ffffff 1px solid",null,null,null,'bold');
}

function unselectMenu(id) {
  changeElem(id+"Div",null,null,null,null,null,null,null,null,null,null,null,null,null,'hidden','-1',null);
  changeElem(id,null,null,null,null,null,'160',null,null,backColor,null,null,backColor+" 1px solid",null,null,null,'normal');
}

function menuMouseOver(id) {
  if (id == currMenuId)
    return;
  changeElem(id,null,null,null,null,null,null,null,null,null,null,null,btnActiveBgcolor+" 1px solid",null,null,null,'bold');
}

function menuMouseOut(id) {
  if (id == currMenuId)
    return;
  changeElem(id,null,null,null,null,null,null,null,null,null,null,null,backColor+" 1px solid",null,null,null,'normal');
}

function menuMouseClick(id) {
  if (id == currMenuId)
    return;
  var tmpId = currMenuId;
  currMenuId = id;
  scheduleSelectMenu();
  unselectMenu(tmpId);  
}
