/* Good E Javascripts Source
  Netscape resize fix
  Preload Images
  Find Object
  Swap Image
  Show Hide Layers
  Print Page
  Enter Menu
  Leave Menu
  Clear Menu
*/

var printWin;
var currentmenu = "";
var mouseoutdelay = 250;
var mmenuselbgcolor = "#FFFFFFF";
var mmenubgcolor = "#CCCCCC";

// NETSCAPE RESIZE FIX - bluefish
function GE_reloadPage(init) {
  if (init==true) with (navigator) {
    if ((appName=="Netscape") && (parseInt(appVersion)==4)) {
      document.pgW = innerWidth; document.pgH = innerHeight; onresize = GE_reloadpage; }
  } else if (innerWidth!=document.pgW || innerHeight!=document.pgH)
      location.reload();
}
GE_reloadPage(true);

// PRELOAD IMAGES - bluefish
function GE_preloadImages() {
  var d=document; if (d.images) { if (!d.ge_p) d.ge_p = new Array();
    var i, j=d.ge_p.length, a=GE_preloadImages.arguments;
    for (i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) {
      d.ge_p[j] = new Image; d.ge_p[j++].src = a[i]; } }
}

// FIND OBJECT (layer recursive)
function GE_findObj(obj, d) {
  var i, x; if (!d) d=document;
  x = d[obj]; for (i=0; !x && d.layers && i < d.layers.length; i++) x = GE_findObj(obj, d.layers[i].document);
  if (!x && d.getElementById) x = d.getElementById(obj); return x;
}

// SWAP IMAGES
function GE_swapImage() {
  var d=document, i, a=GE_swapImage.arguments;
  for (i=0; i<(a.length-1); i+=2) if ((x=GE_findObj(a[i])) != null) x.src = a[i+1];
}

// SHOW / HIDE LAYERS
function GE_showHideLayers() {
  var i, x, v, a=GE_showHideLayers.arguments;
  for (i=0; i<(a.length-1); i+=2) if ((x=GE_findObj(a[i])) != null) {
      v = a[i+1]; if (x.style) { x = x.style; v = (v == 'show') ? 'visible' : ((v == 'hide') ? 'hidden' : v); }
      x.visibility = v; }
}

// PRINT PAGE
// printPage() opens a window with content formatted such that it will fit on a legal size 8.5x11 paper
function printPage(url) {
	printWin = window.open(url, 'printableWin','width=570,height=400,menubar=yes,toolbar=yes,scrollbars=yes');
	printWin.focus();
}

// MENU RELATED FUNCTIONS
function GE_enterMenu(menu) {
  currentmenu = menu;
}

function GE_leaveMenu(menu) {
  currentmenu = '';
  setTimeout("GE_clearMenu('" + menu + "')", mouseoutdelay);
}

function GE_clearMenu(menu) {
  if (currentmenu != menu) {
    GE_showHideLayers(menu, 'hide');
  }
}

/* Prototype code
function GE_enterSubMenu(menu, obj, c) {
  enterMenu(menu);
  obj.bgColor = c;
}

function GE_leaveSubMenu(menu, obj, c) {
  leaveMenu(menu);
  obj.bgColor = c;
}
*/

//

function enterMenu(menu) {
  currentmenu = menu;
  GE_showHideLayers('menuProducts', 'hide', 'menuSpecial', 'hide', 'menuApplications', 'hide', 'menuAbout', 'hide');
  GE_showHideLayers('menu' + menu, 'show');
}

function leaveMenu(menu) {
  currentmenu = '';
  setTimeout("clearMenu('" + menu + "')", mouseoutdelay);
}

function clearMenu(menu) {
  if (currentmenu != menu) {
    GE_showHideLayers('menu' + menu, 'hide');
  }
}

function enterSubMenu(menu, obj) {
  currentmenu = menu;
  obj.bgColor = mmenuselbgcolor;
}

function leaveSubMenu(menu, obj) {
  currentmenu = '';
  setTimeout("clearSubMenu('" + menu + "')", mouseoutdelay);
  obj.bgColor = mmenubgcolor;
}

function clearSubMenu(menu) {
  if (currentmenu != menu) {
    GE_showHideLayers('menu' + menu, 'hide');
  }
}

// Special Show Picture

function openPicture (f, d) {
  var url = "showpic.php?f=" + f + "&d=" + escape(d);
  var name = "Picture";
  param = "toolbar=no,location=no,status=no,scrollbars=no,resizable=no,width=450,height=510,left=0,top=0";
  eval ("name = window.open(url, name, param)");
  if (!eval("name.opener"))
    eval("name.opener = self");
}
