/**************************************************
  dropImage v2.0 - Dropdown menu using images
  written by Paul Ottley August 2006
**************************************************/

//global variables
var width = 140; // The width of the first menu dropdown
var subWidth = 140; // The width of the sub menu
var verticalOverlap = -20; // Sets the vertical offset of the submenu. Positive numbers move it down, Negative numbers move it up. Must be an Integer. No Decimals.
var side = "left"; // Decides which side the second level menus will appear on. "left" for left-side, "right" for right-side.

/*** No need to edit below this line ***/

// First of all, we need to do a little browser detection to compensate for 
var browser = navigator.appName;
var version = 0;

// fix for IE
if (navigator.appVersion.indexOf("MSIE")!=-1){
  temp = navigator.appVersion.split("MSIE")
  version = parseFloat(temp[1])
}
else{
  var b_version = navigator.appVersion;
  version = parseFloat(b_version);
}

// Set up the containers so that they are relative
var menuDiv = "menu2";
var subMenuDiv = "menu2";
var allDivs = new Array();
var i = 0;

function initContainers(){
  allDivs = document.getElementsByTagName('div');

  for(i=0; i < allDivs.length; i++){
    
    // Find all of the menuContainer elements and all of the mainContainer elements
    if(allDivs[i].className == "mainContainer"){
      allDivs[i].style.position = "relative";
      //allDivs[i].style.height = 0;
      //allDivs[i].style.width = 0;
    }
    else{
      continue;
    }
  }
}

function showMenu(parent, child){
  
  if(parent == "" || child == ""){
    alert("You cannot define a blank parent or child subMenu!");
  }
  else{
    if(child == 'none'){
      // set the menuDiv using the id passed in
      menuDiv = document.getElementById(parent);
      subMenuDiv = "";
      // set the css class name to make it visible
      //menuDiv.className = "showMenu menu";
    }
    else{
      //set the menuDiv using the id passed in
      menuDiv = document.getElementById(parent);
      subMenuDiv = document.getElementById(child);
      // set the css class name to make it visible
      //menuDiv.className = "showMenu menu";
      //subMenuDiv.className = "showMenu subMenu";
    }
    
    // Styling of the menu
    menuDiv.style.position = "absolute";
    menuDiv.style.display = "block";
    menuDiv.style.left = 0;
    menuDiv.style.zIndex = 10;
    menuDiv.style.width = width;
    menuDiv.style.height = "auto";
    
    // Positioning the top according to browsers
    if(browser == "Microsoft Internet Explorer"){
      menuDiv.style.top = -3;
  	}
    else{
      menuDiv.style.top = 0;
    }
    
    if(subMenuDiv != ""){
      // Styling the submenu
      subMenuDiv.style.position = "absolute";
      subMenuDiv.style.display = "block";
      subMenuDiv.style.zIndex = 10;
      subMenuDiv.style.width = subWidth;
      subMenuDiv.style.height = "auto";
      // Decide where to put the sub menus
     
      // Set the top of the submenu
      subMenuDiv.style.marginTop = verticalOverlap;
      
      // Set the left of the submenu
      if(side == "left"){    
        subMenuDiv.style.left = parseInt(subMenuDiv.style.width) * -1;
      }
      else{
        subMenuDiv.style.left = parseInt(subMenuDiv.style.width);
      }
    }
  }
}

function hideMenu(){
  
  // Now we will check to see what is open and hide it if it is
  if(subMenuDiv != ""){
    // set the css class name to make it invisible
    menuDiv.style.display = "none";
    subMenuDiv.style.display = "none";
    subMenuDiv = "";
    menuDiv = "";
  }
  
  if(menuDiv != ""){
    // set the css class name to make it invisible
    menuDiv.style.display = "none";
    menuDiv = "";
    subMenuDiv = "";
  }
}

// The six functions below allow for image rollovers
function changeImagepng(img){
var img_over = "http://abc.eznettools.net/downtowndancewear/images/" + img + "_mOver.png";
document.getElementById(img).src = img_over;
}
function changeImageBackpng(img){
var img_over = "http://abc.eznettools.net/downtowndancewear/images/" + img + ".png";
document.getElementById(img).src = img_over;
}
function changeImagejpg(img){
var img_over = "http://abc.eznettools.net/downtowndancewear/images/" + img + "_mOver.jpg";
document.getElementById(img).src = img_over;
menuDiv.className="showMenu";
}
function changeImageBackjpg(img){
var img_over = "http://abc.eznettools.net/downtowndancewear/images/" + img + ".jpg";
document.getElementById(img).src = img_over;
menuDiv.className="hideMenu";
}
function changeImagegif(img){
var img_over = "http://abc.eznettools.net/downtowndancewear/images/" + img + "_mOver.gif";
document.getElementById(img).src = img_over;
menuDiv.className="showMenu";
}
function changeImageBackgif(img){
var img_over = "http://abc.eznettools.net/downtowndancewear/images/" + img + ".gif";
document.getElementById(img).src = img_over;
menuDiv.className="hideMenu";
}
