function NewWindow(mypage, myname, w, h, scrollbars) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var scrollbars = scrollbars ? 'yes' : 'no';
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl + ',scrollbars=' + scrollbars + ' ,resizable=no'
	var win = window.open(mypage, myname, winprops);
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus();
	}
}

function NewImageWindow(mypage, myimage, myname) {
  function getWidthAndHeight() {
    alert("'" + this.name + "' is " + this.width + " by " + this.height + " pixels in size.");
    return true;
  }
  function loadFailure() {
    alert("'" + this.name + "' failed to load.");
    return true;
  }  
  function openWindow() {
	var padding = 16;
	var imgh = this.height + padding;
	var imgw = this.width + padding;
    var winl = (screen.availWidth - imgw) / 2;
    var wint = (screen.availHeight - imgh) / 2;    
    winprops = 'height='+imgh+',width='+imgw+',top='+wint+',left='+winl+',scrollbars=no,resizable=no'    
    win = window.open(mypage, '', winprops);
    if (parseInt(navigator.appVersion) >= 4) {win.window.focus();}
    return true;
  }

  var myImage = new Image();
  myImage.name = myname;
  myImage.onload = openWindow;
  myImage.onerror = loadFailure;
  myImage.src = myimage;
}
function __(id) {return document.getElementById(id);}

function displayMenu3(id) {   
  if (__('current_menu_3').value != 0) {
    var cur_menu2 = "menu_2_" + __('current_menu_3').value + "_active";
    var cur_menu2_i = "menu_2_" + __('current_menu_3').value + "_inactive";
    var cur_menu = "menu_3_" + __('current_menu_3').value;

    __(cur_menu).style.display='none';
  
  __(cur_menu2).style.display='none';
  __(cur_menu2_i).style.display='';
  }
  if (parseInt(__('current_menu_3').value) < 1) {
    if (__('empty_3')) {
      __('empty_3').style.display = 'none';
    }
  }
  
  var menu2 = "menu_2_" + id + "_active";
  var menu2_i = "menu_2_" + id + "_inactive";
  var menu = "menu_3_" + id;
  
  __(menu2).style.display='';
  __(menu2_i).style.display='none';
  
  if (__(menu)) {
    __(menu).style.display='';
    __('current_menu_3').value = id;
  }
}

function getPosition() {
  var scrollPosition = 0;
  if (window.pageYOffset) {
    scrollPosition = window.pageYOffset;    
  } else if (document.documentElement.scrollTop) {
    scrollPosition = document.documentElement.scrollTop;  
  } else {
    scrollPosition = document.body.scrollTop;
  }
  return scrollPosition;
}
function saveScroll() {
  document.cookie = "scp" + "=" + getPosition() + "; path=/";
}
function resetScrollPosition(Y) {
  if (Y != 0) {
    window.scrollTo(0, Y);
  }
}
function showHideImg(oid) {
  var obj = document.getElementById(oid);
  if( obj.style.display == 'none' )
    obj.style.display = 'block';
  else
    obj.style.display = 'none';
}
function HideImg(oid) {
  __(oid).style.display = 'none';
}