// Sub Nav Script

var currentSubMenu = "";
var currentMenuItem = "";
var menuItemNormal = "";

function setCurrentMenuItem(item, normal) {
  if(currentMenuItem != MM_findObj(item)) {
    currentMenuItem.src = menuItemNormal;
    currentMenuItem = MM_findObj(item);
    menuItemNormal = normal;
  }
}

function toggleList(id) {
  list = document.getElementById(id);
  if (list.style.display == "inline") {
    list.style.display = "none";
  } else {
    if(currentSubMenu != "") {
      prev = document.getElementById(currentSubMenu);
      prev.style.display = "none";
    }
    list.style.display = "inline";
  }
  currentSubMenu = id;
}

function writeDiv(id) {
  if (id == currentMenuItem) {
    document.write("<div id=\"" + id + "\" style=\"display:inline\">");
  } else {
    document.write("<div id=\"" + id + "\" style=\"display:none\">");
  }
}


// Swap Textbox Form Element Contact

function setBgImageContact(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#0A4600";
}

function setBgImageOverContact(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#FFFFFF";
}


// Image Rollover & Preload
if (document.images) {

productsoff = new Image();
productsoff.src = "header_data/btn_productsoff.gif";
productson = new Image();
productson.src = "header_data/btn_productson.gif";
aboutusoff = new Image();
aboutusoff.src = "header_data/btn_aboutusoff.gif";
aboutuson = new Image();
aboutuson.src = "header_data/btn_aboutuson.gif";
contactoff = new Image();
contactoff.src = "header_data/btn_contactoff.gif";
contacton = new Image();
contacton.src = "header_data/btn_contacton.gif";
historyoff = new Image();
historyoff.src = "header_data/btn_historyoff.gif";
historyon = new Image();
historyon.src = "header_data/btn_historyon.gif";
}

function imageon(imgName)
{
	if (document.images)
		document[imgName].src = eval(imgName + 'on.src');
}

function imageoff(imgName)
{
	if (document.images)
		document[imgName].src = eval(imgName + 'off.src');

}

function navBG(id, which)
{
	if (which == "off")
		document.getElementById(id).style.backgroundImage = "url(/images/navsub_bg_off.gif)";
	else
		document.getElementById(id).style.backgroundImage = "url(/images/navsub_bg_on.gif)";
}


//Open Browser Window

function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
