var timerID_navi;
var POPUP_TIME = 3000;
var timer_submenu;
var prev_color;

function displayNavi(mode) {
try {
	document.getElementById('if_submenu').style.display = mode;
} catch(e) {
}
}

function popupNavi(e, id) {
try {
var xx = e.x;
var yy = e.y;
var mmElement = document.elementFromPoint(xx, yy);
  var pos_xx = mmElement.offsetLeft;
  var pos_yy = mmElement.offsetTop;
  var tmpElement = mmElement;
  for(;;) {
    tmpElement = tmpElement.offsetParent;
    pos_xx += tmpElement.offsetLeft;
    pos_yy += tmpElement.offsetTop;
    if(tmpElement.tagName.toUpperCase()=='BODY') {
    break;
    }
  }
  pos_xx += mmElement.offsetWidth * 0.8;
	var submenu = document.getElementById('if_submenu');
	var layer;
	layer = "<div id='if_submenu' onmouseover=displayNavi('block'); onmouseout=displayNavi('none');>\n";
  layer += id.innerHTML;
	layer += "</div>\n";
  submenu.style.left = pos_xx;
  submenu.style.top = pos_yy;
	submenu.style.display = 'block';
	submenu.innerHTML = layer;
} catch(e) {
}
}

function MouseOut(obj) {
try {
  var xxx = obj.className + '_x';
  xxx = xxx.substring(0, xxx.indexOf("_x"));
  obj.style.cursor = 'default';
  obj.className = xxx;
} catch(e) {
}
}

function MouseEnter(obj) {
try {
  var xxx = obj.className + '_x';
  obj.style.cursor = 'hand';
  obj.className = xxx;
} catch(e) {
}
}

function MouseClick(str) {
  top.location = str;
}

function displayMenu(mode) {
try {
	top.document.getElementById('if_submenu').style.display = mode;
} catch(e) {
}
}

function popupMenu2(e, id) {
try {
  var xx = e.x;
  var yy = e.y;
  var mmElement = top.fmenu.document.elementFromPoint(xx, yy);
  var pos_xx = mmElement.offsetLeft;
  var pos_yy = mmElement.offsetTop + top.if_navi.offsetHeight;
  var tmpElement = mmElement;
  for(;;) {
    tmpElement = tmpElement.offsetParent;
    pos_xx += tmpElement.offsetLeft;
    pos_yy += tmpElement.offsetTop;
    if(tmpElement.tagName.toUpperCase()=='BODY') {
    break;
    }
  }
  pos_xx += mmElement.offsetWidth;
	var submenu = top.document.getElementById('if_submenu');
	var layer;
	layer = "<span onmouseover=displayMenu('block'); onmouseout=displayMenu('none');>\n";
  layer += id.innerHTML;
	layer += "</span>\n";
  submenu.style.left = pos_xx * 0.8;
  submenu.style.top = pos_yy;
	submenu.style.display = 'block';
	submenu.innerHTML = layer;
} catch(e) {
}
}

function getSubwin(e, id) {
try {
  id = '_' + id;
	var popup = top.fbody.document.getElementById('if_popup');
  var layer = '';
  layer += '<table class="hint" border="1" cellpadding="6"><tr><td>';
  layer += '<table class="hint_top" border="0" cellpadding="" margin-top="-12"><tr><td>';
  layer += top.fbody.document.getElementById(id).innerHTML;
  layer += '</td></tr></table>';
  layer += '</td></tr></table>';
  popup.style.left = Math.min(e.x, top.fbody.document.body.clientWidth - 420) + top.fbody.document.body.scrollLeft;
  popup.style.top = Math.min(e.y, top.fbody.document.body.clientHeight - 100) + top.fbody.document.body.scrollTop;
	popup.style.display = 'block';
	popup.innerHTML = layer;
} catch(e) {
}
}

function hideme() {
try {
	top.fbody.document.getElementById('if_popup').style.display = 'none';
} catch(e) {
}
}

function NaviOut(obj,id) {
  obj.style.cursor = 'default';
  obj.style.color = prev_color;
	document.getElementById(id).style.display = 'none';
}

function NaviEnter(obj,id) {
  prev_color = obj.style.color;
  obj.style.cursor = 'hand';
  obj.style.color = '#CC0000';
	xx = document.getElementById(id);
  xx.style.left = obj.offsetLeft;
  xx.style.top = obj.offsetTop + Math.min(obj.offsetHeight, 48);
  xx.style.display = 'block';
}

function NaviClick(str) {
  top.location = str;
}

function displayQuick(mode) {
try {
	document.getElementById('if_popup').style.display = mode;
} catch(e) {
}
}

function popupQuick(e, id) {
try {
var xx = e.x;
var yy = e.y;
var mmElement = document.elementFromPoint(xx, yy);
  var pos_xx = mmElement.offsetLeft;
  var pos_yy = mmElement.offsetTop;
  if(mmElement.tagName.toUpperCase()!='TD') {
    pos_xx = 0;
    pos_yy = 0;
  }
  var tmpElement = mmElement;
  for(;;) {
    tmpElement = tmpElement.offsetParent;
    pos_xx += tmpElement.offsetLeft;
    pos_yy += tmpElement.offsetTop;
    if(tmpElement.tagName.toUpperCase()=='BODY') {
    break;
    }
  }
	var submenu = document.getElementById('if_popup');
	var layer;
  layer = id.innerHTML;
  submenu.style.left = pos_xx + 150;
  submenu.style.top = pos_yy + 10;
	submenu.style.display = 'block';
	submenu.innerHTML = layer;
} catch(e) {
}
}

function CursorOut(obj) {
  obj.style.cursor = 'default';
}

function CursorIn(obj) {
  obj.style.cursor = 'hand';
}

function MSOut() {
try {
  document.body.style.cursor = 'default';
  var mmElement = top.document.getElementById('if_view');
  mmElement.style.display = 'none';
} catch(e) {
}
}

function MSEnter(obj,e,fil) {
try {
  clearInterval(timer_submenu);
  var xx = e.x;
  var yy = e.y;
  var bbElement = top.fmenu.document.elementFromPoint(xx, yy);
  var pos_xx = bbElement.offsetLeft;
  var pos_yy = bbElement.offsetTop + top.if_navi.offsetHeight;
  var tmpElement = bbElement;
  for(;;) {
    if(tmpElement.tagName.toUpperCase()=='BODY') {
    break;
    }
    tmpElement = tmpElement.offsetParent;
    pos_xx += tmpElement.offsetLeft;
    pos_yy += tmpElement.offsetTop;
  }
	var mmElement = top.document.getElementById('if_view');
  var layer = '<div id="if_view" onclick="javascript:MSClick(\'' + fil + '\')" onmouseout="javascript:MSOut();">';
  layer += '<table border=0 width=100%><tr><td class=h1>';
  layer += obj.innerHTML;
  layer += '</td></tr></table>';
  layer += '</div>';
  mmElement.innerHTML = layer;
  mmElement.style.top = pos_yy - 1;
  mmElement.style.left = pos_xx;
  mmElement.style.width = bbElement.offsetWidth;
  mmElement.style.display = 'block';
  mmElement.style.cursor = 'hand';

  timer_submenu = setInterval('MSOut()', POPUP_TIME);
} catch(e) {
}
}

function MSClick(str) {
  top.location = str;
}

function MM_resize_navi2() {
  if (obj.offsetHeight > 48) {
    document.getElementById('navi_table').style.fontSize = 9;
  }
}

function MM_resize_navi() {
  timerID_navi = setInterval('NaviResize()', 50);
}

function NaviResize() {
  try {
    if(document.readyState == 'complete') {
      if (document.getElementById('navi_table').offsetHeight > 48) {
	        sss = document.getElementById('navi_table').style.fontSize;
          sss = 11;
	        document.getElementById('navi_table').style.fontSize = sss;
      } else {
        clearInterval(timerID_navi);
      }
    }
  } catch(e) {
  }
}


