function setStatus(s) {
  window.status = s;
  return true;
}


function getObjScreenPos(obj) {
  var pos = new Object();
  var o = obj;
  var x = 0;
  var y = 0;
  while( o != null ){
    x += o.offsetLeft;
    y += o.offsetTop;
    if(o.scrollLeft)x -= o.scrollLeft;
    if(o.scrollTop)y -= o.scrollTop;
    if(o==o.offsetParent){break;}
    o = o.offsetParent;
  }
  if(window.screenLeft)x += document.body.scrollLeft;
  if(window.screenTop )y += document.body.scrollTop;
  pos.x = x;
  pos.y = y;
  return pos;
}

function changeImage(name, src) {
  if (document.images && preloadFlag) {
    if (document[name] != null) {
      document[name].src = src;
	}
  }
}


function changeImages() {
  if (document.images && preloadFlag) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      if (document[changeImages.arguments[i]].img != changeImages.arguments[i+1]) {
        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
        document[changeImages.arguments[i]].img = changeImages.arguments[i+1];
      }
    }
  }
}

function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}

var preloadFlag = false;
var imgsToPreload = new Array();

function preloadImages() {
  if (document.images) {
    for (var i = 0; i < imgsToPreload.length; i++) {
      newImage(imgsToPreload[i]);
    }
    preloadFlag = true;
  }
}

function addImgToPreload(img) {
  imgsToPreload[imgsToPreload.length] = img;
}

function openWin(exitURL, w, h, resize) {
  if (exitURL == null || exitURL == "null") {
    return;
  }
  if (resize == null) {
    resize = "0";
  }
  var featureStr = "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=" + resize + ",width=" + w + ",height=" + h + ",ScreenX=" + ((window.screen.width-w)/2) + ",ScreenY=" + ((window.screen.height-h)/2) + ",left=" + ((window.screen.width-w)/2) + ",top=" + ((window.screen.height-h)/2);

  self.focus();
  var ExitWindow = window.open(exitURL,'Pop', featureStr);
  ExitWindow.focus();
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);




function miOvr(src,clrOver, status) {
 clearMenuTimeout();
 if (!src.contains(event.fromElement)) {
	 src.style.cursor = 'hand';
   src.bgColor = clrOver;
 }
 if (status != null) {
   setStatus(status);
 }
}
function miOut(src,clrIn) {
  setMenuTimeout();
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
  window.status='';
}
function miClk(src) {
  _hideMenu();
  if(event.srcElement.tagName=='TD'){
	  window.location.href = src.children.tags('A')[0].href;
  }
}

function hideWindowComponenets() {}
function showWindowComponenets() {}

function showMenu(menuId, img_name, status_msg) {
  window.status = status_msg;
  clearMenuTimeout();
  if (curHideId != null && menuId != curHideId) {
    _hideMenu();
  }
  if (window[menuId] != null) {
    var imgPos = getObjScreenPos(document[menuId + "_img"]);
    window[menuId].style.left = imgPos.x-1 + 6;
    window[menuId].style.top = imgPos.y+29;
    window[menuId].style.visibility='visible';
    hideWindowComponenets();
  }
  changeImage(menuId + "_img", img_name);
}

var curHideId=null;
var curHideImage=null;
var curHideTimiOut=null;

function _hideMenu() {
  if (document.body.old_onclick != null) {
  	document.body.old_onclick();
  }

  if (curHideId != null && window[curHideId] != null) {
    window[curHideId].style.visibility='hidden';
    showWindowComponenets();
  }
  changeImage(curHideId + "_img", curHideImage);
}

function hideMenu(menuId, img_name) {
  clearMenuTimeout();
  curHideId=menuId;
  curHideImage=img_name;
  setMenuTimeout();
  return true;
}

function setMenuTimeout() {
  window.curHideTimiOut=setTimeout("_hideMenu();", 300);
}
function clearMenuTimeout() {
  var tmpHideTimiOut = curHideTimiOut;
  if (tmpHideTimiOut != null) {
    clearTimeout(tmpHideTimiOut);
  }
}



var curTip = null;
function showInsideTip(tipId) {
  hideInsideTip();

  curTip = window[tipId];
  if (curTip != null) {
    var width = parseInt(curTip.offsetWidth);
	var height = parseInt(curTip.offsetHeight);

    var intCalFrameH = height;
    var intCalFrameW = width;
    var intScrollTop = document.body.scrollTop;
    var intScrollLeft = document.body.scrollLeft;

    if (intCalFrameH > document.body.clientHeight) {
      intCalFrameH = document.body.clientHeight-20;
      curTip.style.pixelHeight = intCalFrameH;
    }

    if (intCalFrameW > document.body.clientWidth) {
      intCalFrameW = document.body.clientWidth-20;
      curTip.style.pixelWidth = intCalFrameW;
    }

	curTip.style.top = (document.body.clientHeight - intCalFrameH)/2 + intScrollTop;
	curTip.style.left = (document.body.clientWidth - intCalFrameW)/2 + intScrollLeft;
	curTip.style.visibility='visible';
  }
  event.cancelBubble = true;
}

function hideInsideTip() {
  if (curTip != null) {
    curTip.style.visibility='hidden';
  }
}

function _dbg(o){
  window.DBGOBJ = o;
  window.open('/rd/js/_dbg.html?dbg=window.opener.DBGOBJ','_blank','',false);return;
}

function body_onclick() {
  _hideMenu();
  hideInsideTip();
}

function body_onresize() {
  _hideMenu();
  hideInsideTip();
}