//{{{ 1k DHTML API
d=document;ts=2;ti=60;px='px'
var browser = navigator.appName;var ie = browser.indexOf("Microsoft") > -1 ? true : false;
var op =  browser.indexOf("pera") > -1 ? true : false;
var platform = navigator.platform;var mac = platform.indexOf("ac") > -1 ? true : false;
function gE(e,f){return d.getElementById(e);}
function sE(e){e.style.visibility='visible';}
function hE(e){e.style.visibility='hidden';}
function sZ(e,z){e.style.zIndex=z;}
function sX(e,x){e.style.left=x+'px';}
function sY(e,y){e.style.top=y+'px';}
function sW(e,w){e.style.width=w+'px';}
function sH(e,h){e.style.height=h+'px';}
function sC(e,t,r,b,x){e.style.clip='rect('+t+px+' '+r+px+' '+b+px+' '+x+px+')';}
function gX(e){var x=e.offsetLeft;var op=e.offsetParent;while(op!=null){x+=op.offsetLeft;op=op.offsetParent;}return x;}
function gY(e){var y=e.offsetTop;var op=e.offsetParent;while(op!=null){y+=op.offsetTop;op=op.offsetParent;}return y;}
//function gY(e){return e.offsetTop;}
function wH(e,h){e.innerHTML=h;}
function gW(e){return e.offsetWidth}
//function gW(e){return e.style.width;}
function gH(e){return e.offsetHeight}
function gpX(e){var x=e.offsetLeft;var ep=e.offsetParent;while(ep!=null){x+=ep.offsetLeft;op=ep.offsetParent;}return x;}
function gpY(e){var y=e.offsetTop;var ep=e.offsetParent;while(ep!=null){y+=ep.offsetTop;ep=ep.offsetParent;}return y;}

//{{{ menu dropdown stuff

// holding tank for the last header item turned on
var lastTopItem = null;

// holding tank for the last top menu turned on
var lastTopMenu = null;

// holding tank for the last submenu turned on
var lastSubMenu = null;

// holding tank for the last menu item that had a submenu
lastMenuItem = null;

// the name of the last submenu turned on
var lsman = "";

// holding tank for the last menu itme turned on
var lmi = null;

// the height of the menu bars
var menuHeight = 30;

// the width of a menu item
var menuWidth = 125;

// the background color when a menu header is turned on
var menuOnBackground = "transparent";

// the background color when a menu item is turned off
var menuOffBackground = "transparent";

// a holding tank for the menu timer object
var menuTimer = null;

// the image rollover stuff
var center_on = new Image();
var center_off = new Image();

// do all the dropdown navigation startup stuff
function pageStart() {
  //alert("here");
  var header = gE("siteNav");
  // get all the links in the header uls
  var links = header.getElementsByTagName("a");
  //alert("Links:" + links.length);

  for(var lii = 0; lii < links.length; lii++) {
      var li = links[lii];
      // see if it has a menu and process the menu items if it does
      var menuName = li.getAttribute("menu");
      if(menuName != null) {
        // see if we can find a menu by that name
        var dd = gE(menuName);
        if(dd != null) {
          // attach the display handlers to it
          li.onmouseover = menuOn;
          li.onmouseout = setMenuTimer;
          dd.onmouseover = clearMenuTimer;
          dd.onmouseout = setMenuTimer;
        } // end of check for a valid menu item
      } // end of check for a menu name
    } // end of header ul link processing loop
    // create the image rollover images
    center_off.src = 'images/home_center.jpg';
    center_on.src = 'images/home_center_on.jpg';
}// end of navStart() function

// this function changes the background color of a top-level
//  menu item to the appropriate and turns on the submenu dropdown at
//  the same time. It also turns off any menus that may
//  be on before it does anything else
function menuOn(event)
{
  // turn off the menu timer
  clearMenuTimer();
  // turn off any previously displayed menus
  hideMenus();

  var smn = this.getAttribute("menu");
  //alert(smn);
  //if we've gone to a new menu, do some stuff
  if(smn != null)
  {
    // set the background color of the header and save
    //  the header for turning it off later
    lastTopItem = this;
    lastTopItem.style.background = menuOnBackground;
    lastTopItem.style.color = "#333";
    
    // get the position of the header to position the dropdown
    var mx = gX(this);
    mx = ie ? mx + 2 : mx;
    var my = gY(this);
    var sme = gE(smn);
    
    sX(sme,mx);
    sY(sme,my + menuHeight);
    //alert(":" + mx + ":" + my + ":");
    //alert("here");
    sE(sme);
    lastTopMenu = sme;
    //lastTopMenu = sme;
    //alert("done");
    
  }
} // end of function menuOn()


// clears the menu turn-off timer
function clearMenuTimer(){
  clearInterval(menuTimer);
}

// turn all the navigation menus off
function hideMenus()
{
  if(lastTopItem != null ) {
    lastTopItem.style.background = menuOffBackground;
    //lastTopItem.style.color = "#fff";
    lastTopItem = null;
  }
  if(lastSubMenu != null)
  {
    hE(lastSubMenu);
    lastSubMenu = null;
  }
  if(lastMenuItem != null) {
    lastMenuItem.style.color = "#ddd";
    lastMenuItem.style.background = "rgb(61,27,28)";
  }
  if(lastTopMenu != null)
  {
    hE(lastTopMenu);
    lastTopMenu = null;
  }
  clearMenuTimer();
} // end of hideMenus() function

// sets a timer to turn off the menus
function setMenuTimer(){
  menuTimer = setInterval(hideMenus,250);
}

function productSelected(e) {
  //alert(e.options[e.selectedIndex].value);
  var new_page = e.options[e.selectedIndex].value;
  if(new_page != "none"){
    window.location = new_page;
  }
}
//}}}

