//Establish Browser Version
var n = (navigator.appName == "Netscape")
var n4 = (document.layers) ? 1:0
var ie = (navigator.appName == "Microsoft Internet Explorer")
var ie4 = (document.all) ? 1:0
var browserName = navigator.appName;
var rolloversOK = 0;
browserVer = parseInt(navigator.appVersion);
if (n && browserVer >= 3) rolloversOK = 1;
else if (ie && browserVer >= 4) rolloversOK = 1;

if (n4) {
// Test for Unix NS4 version and don't allow DHTML elements in it
        if (navigator.appVersion.indexOf("X11") >= 0) {
                n4 = 0;
        }
}
else if (ie4) {
 // Test for Mac IE4 version and don't allow DHTML elements in it
        if ((navigator.appVersion.indexOf("Macintosh") >= 0) || (navigator.appVersion.indexOf("Mac_") >= 0)) {
                ie4 = 0;
        }
}

//More Variables
var theTimeout = setTimeout("","1");
var subTheTimeout = setTimeout("","1");
var version = "no";
var top_adjust = 0;
//var subtop_adjust = 0;
var offset;
var browserWidth;
var browserOffset;
var pageWidth = 800;

//if (n4) {
        version = "ok";
        top_adjust = 2;
//}

//else if (ie4) {
 //       version = "ok";
 //       top_adjust = 2;
//}


// The Popup Menu Variables
var totalMenus = 1;
var menuPosX = 1;
var menuPosY = new Array(totalMenus);
var itemsOnMenu = new Array(totalMenus);
var menuItems = new Array(totalMenus);
var urlLinks = new Array(totalMenus);
var lastMenu = -99;
var lastHotItem = -99;
var moveOver = 3;

//tr that changes
var bgHot = "#000099";
var bgNormal = "#FFFFFF";
//BRANDS NAVmenuPosY[1] = 79  + top_adjust;
itemsOnMenu[1] = 12;

menuItems[1] = new Array(itemsOnMenu[1]);
urlLinks[1] = new Array(itemsOnMenu[1]);

menuItems[1][0] = "&nbsp;&nbsp;&nbsp;Wigpro";           
menuItems[1][1] = "&nbsp;&nbsp;&nbsp;African American"; 
menuItems[1][2] = "&nbsp;&nbsp;&nbsp;Raquel Welch";                             
menuItems[1][3] = "&nbsp;&nbsp;&nbsp;Apsen";
menuItems[1][4] = "&nbsp;&nbsp;&nbsp;Adolfo";menuItems[1][5] = "&nbsp;&nbsp;&nbsp;Dream USA";menuItems[1][6] = "&nbsp;&nbsp;&nbsp;European Naturals";menuItems[1][7] = "&nbsp;&nbsp;&nbsp;Eva Gabor";menuItems[1][8] = "&nbsp;&nbsp;&nbsp;Henry Margu";menuItems[1][9] = "&nbsp;&nbsp;&nbsp;John Renau";menuItems[1][10] = "&nbsp;&nbsp;&nbsp;Revlon";menuItems[1][11] = "&nbsp;&nbsp;&nbsp;Tony of Beverly";

urlLinks[1][0] = "wigpro.htm";
urlLinks[1][1] = "africanamerican.htm";
urlLinks[1][2] = "raquelwelch.htm";
urlLinks[1][3] = "aspen.htm";
urlLinks[1][4] = "adolfo.htm";urlLinks[1][5] = "dreamusa.htm";
urlLinks[1][6] = "europeannaturals.htm";
urlLinks[1][7] = "evagabor.htm";
urlLinks[1][8] = "henrymargu.htm";
urlLinks[1][9] = "jonrenau.htm";
urlLinks[1][10] = "revlon.htm";
urlLinks[1][11] = "tonyofbeverly.htm";

//LENGTH NAV
menuPosY[2] =  79 + top_adjust;
itemsOnMenu[2] = 3;

menuItems[2] = new Array(itemsOnMenu[2])
urlLinks[2] = new Array(itemsOnMenu[2])

menuItems[2][0] = "&nbsp;&nbsp;&nbsp;&nbsp;Long";             
menuItems[2][1] = "&nbsp;&nbsp;&nbsp;&nbsp;Medium";                 
menuItems[2][2] = "&nbsp;&nbsp;&nbsp;&nbsp;Short";                       

urlLinks[2][0] = "long.htm";
urlLinks[2][1] = "medium.htm";
urlLinks[2][2] = "short.htm";


//HUMAN HAIR NAV
menuPosY[3] = 79 + top_adjust
itemsOnMenu[3] = 2
menuItems[3] = new Array(itemsOnMenu[3])
urlLinks[3] = new Array(itemsOnMenu[3])

menuItems[3][0] = "&nbsp;&nbsp;&nbsp;&nbsp;Remy Human Hair";  
menuItems[3][1] = "&nbsp;&nbsp;&nbsp;&nbsp;Standard Human Hair";   


urlLinks[3][0] = "remyhumanhair.htm";
urlLinks[3][1] = "standardhumanhair.htm";

//SYNTHETIC HAIR NAV
menuPosY[4] = 79 + top_adjust
itemsOnMenu[4] = 2

menuItems[4] = new Array(itemsOnMenu[4])
urlLinks[4] = new Array(itemsOnMenu[4])


menuItems[4][0] = "&nbsp;&nbsp;&nbsp;&nbsp;Standard Synthetic Hair";                 
menuItems[4][1] = "&nbsp;&nbsp;&nbsp;&nbsp;Blended with Human Hair";                       

urlLinks[4][0] = "standardsynthatichair.htm";
urlLinks[4][1] = "blendedsynthatichair.htm";

//SIZE NAV
menuPosY[5] = 79 + top_adjust
itemsOnMenu[5] = 4

menuItems[5] = new Array(itemsOnMenu[5])
urlLinks[5] = new Array(itemsOnMenu[5])

menuItems[5][0] = "&nbsp;&nbsp;Petite";                 
menuItems[5][1] = "&nbsp;&nbsp;Average";                       
menuItems[5][2] = "&nbsp;&nbsp;Large";                 
menuItems[5][3] = "&nbsp;&nbsp;Child";    

urlLinks[5][0] = "petite.htm";
urlLinks[5][1] = "average.htm";
urlLinks[5][2] = "large.htm";
urlLinks[5][3] = "child.htm";
//CAPSTYLE NAV
menuPosY[6] = 79 + top_adjust
itemsOnMenu[6] = 5

menuItems[6] = new Array(itemsOnMenu[6])
urlLinks[6] = new Array(itemsOnMenu[6])

menuItems[6][0] = "&nbsp;&nbsp;Monofilament";                 
menuItems[6][1] = "&nbsp;&nbsp;Standard Cap";                       
menuItems[6][2] = "&nbsp;&nbsp;Capless";                 
menuItems[6][3] = "&nbsp;&nbsp;Skin Top";    
menuItems[6][4] = "&nbsp;&nbsp;3/4 Crown";    
urlLinks[6][0] = "monofilament.htm";
urlLinks[6][1] = "standardcap.htm";
urlLinks[6][2] = "capless.htm";
urlLinks[6][3] = "skiptop.htm";
urlLinks[6][4] = "crownfalls.htm";// EXTENSIONS NAVmenuPosY[7] = 79 + top_adjust
itemsOnMenu[7] = 2
menuItems[7] = new Array(itemsOnMenu[7])
urlLinks[7] = new Array(itemsOnMenu[7])
menuItems[7][0] = "&nbsp;&nbsp;Euro Extensions";menuItems[7][1] = "&nbsp;&nbsp;Ethnic Extensions";urlLinks[7][0] = "euroextensions.htm";
urlLinks[7][1] = "ethnicextensions.htm";// ADDITIONS NAV
menuItems[8] = new Array(itemsOnMenu[8])
urlLinks[8] = new Array(itemsOnMenu[8])
menuPosY[8] = 79 + top_adjust
itemsOnMenu[8] = 2

menuItems[8][0] = "&nbsp;&nbsp;Hair Additions";menuItems[8][1] = "&nbsp;&nbsp;Hair Pieces";

urlLinks[8][0] = "hairadditions.htm";
urlLinks[8][1] = "hairpieces.htm";

// MAY'S BEST SELLING WIGS & EXTENSIONS NAV
menuItems[9] = new Array(itemsOnMenu[9])
urlLinks[9] = new Array(itemsOnMenu[9])

menuPosY[9] = 24 + top_adjust
itemsOnMenu[9] = 7

menuItems[9][0] = "&nbsp;&nbsp;<font style='color:red'>New</font> Wig Pro's Remy Human Hair";menuItems[9][1] = "&nbsp;&nbsp;Wig Pro's Sale Item <font style='color:red'>Hot!!</font>";
menuItems[9][2] = "&nbsp;&nbsp;<font style='color:red'>New</font> Wig Pro's Synthetic Hair";menuItems[9][3] = "&nbsp;&nbsp;Raquel Welch 10-piece Clip-In Extension Kit";
menuItems[9][4] = "&nbsp;&nbsp;Wig Pro Fecility<font style='color:red'>(Best Selling Wig)</font>";menuItems[9][5] = "&nbsp;&nbsp;<font style='color:red'>Check</font> Wig Pro's Dancer";
menuItems[9][6] = "&nbsp;&nbsp;Wig Pro's Catalog";
urlLinks[9][0] = "wigpro.htm";
urlLinks[9][1] = "wigprossaleitem.htm";
urlLinks[9][2] = "wigprossynthetic.htm";
urlLinks[9][3] = "raquelwelch10.htm";
urlLinks[9][4] = "wigprosfecility.htm";
urlLinks[9][5] = "wigprosdancer.htm";
urlLinks[9][6] = "wigproscatalog.htm";

// NEW ITEMS ON HAIRADDITION NAVmenuPosY[10] = 24 + top_adjust
itemsOnMenu[10] = 3

menuItems[10] = new Array(itemsOnMenu[10])
urlLinks[10] = new Array(itemsOnMenu[10])
menuItems[10][0] = "&nbsp;&nbsp;Alexandra Petite <small>by Wig Pro<small>";menuItems[10][1] = "&nbsp;&nbsp;Jasmine <small>by Gem Tress</small>";menuItems[10][2] = "&nbsp;&nbsp;Adelle II <small>by Wig Pro</small>";
urlLinks[10][0] = "alexandrapetite.htm";
urlLinks[10][1] = "jasmin.htm";
urlLinks[10][2] = "adelleII.htm";

// QUICK ACCESS TO SPECIAL WIG CATEGORIES NAVmenuPosY[11] = 24 + top_adjust
itemsOnMenu[11] = 3

menuItems[11] = new Array(itemsOnMenu[11])
urlLinks[11] = new Array(itemsOnMenu[11])
menuItems[11][0] = "&nbsp;&nbsp;Large Cap Wigs, Petite Cap Wigs";menuItems[11][1] = "&nbsp;&nbsp;Hand Tied Wigs";menuItems[11][2] = "&nbsp;&nbsp;Ethnic Hair Extensions";
urlLinks[11][0] = "largecapwigs.htm";
urlLinks[11][1] = "handtiedwigs.htm";
urlLinks[11][2] = "ethnichairextensions.htm";// MORE HOT ITEMS NAVmenuPosY[12] = 24 + top_adjust
itemsOnMenu[12] = 2

menuItems[12] = new Array(itemsOnMenu[12])
urlLinks[12] = new Array(itemsOnMenu[12])
menuItems[12][0] = "&nbsp;&nbsp;Fiery Spice";menuItems[12][1] = "&nbsp;&nbsp;Silky Straight Weaving Hair";urlLinks[12][0] = "fieryspice.htm";
urlLinks[12][1] = "silkystraight.htm";

 // POPUP MENU FUNCTIONS

function doPopup (whichMenu, whichHotItem) {
        //if (version != "ok") {return}
                
//Moves menu over from left of window
        if (whichMenu == 0) { moveOver = 5; }
        else if (whichMenu == 1) { moveOver = 121; }
        else if (whichMenu == 2) { moveOver = 193; }
        else if (whichMenu == 3) { moveOver = 235; }
        else if (whichMenu == 4) { moveOver = 305; }
		else if (whichMenu == 5) { moveOver = 165; }
       	else if (whichMenu == 6) { moveOver = 386; }
		else if (whichMenu == 7) { moveOver = 442; }		else if (whichMenu == 8) { moveOver = 505; }		else if (whichMenu == 9) { moveOver = 6; }		else if (whichMenu == 10) { moveOver = 209; }		else if (whichMenu == 11) { moveOver = 391; }		else if (whichMenu == 12) { moveOver = 613; }
//Clears the HidePopup timeout
        clearTimeout(theTimeout);

// DO WE HAVE TO RE-DRAW THE MENU?
        newMenu = 0
        if (whichMenu != lastMenu) {
                lastMenu = whichMenu
                newMenu = 1 
        }
        else if (whichHotItem != lastHotItem) {
                newMenu = 1
        }

// RE-DO THE POPUP TABLE, IF NECESSARY
        if (newMenu) {
                lastHotItem = whichHotItem;
                popupWidth = "100"; insideWidth = "98";
//Adjusts the size of each of the popup menus according to the size of text
                 if ((whichMenu == 0)) { popupWidth = "120"; insideWidth = "118"; }
                 if ((whichMenu == 1)) { popupWidth = "130"; insideWidth = "128"; }
                 if ((whichMenu == 2)) { popupWidth = "90"; insideWidth = "88"; }
                 if ((whichMenu == 3)) { popupWidth = "150"; insideWidth = "148"; }
                 if ((whichMenu == 4)) { popupWidth = "170"; insideWidth = "168"; }
                 if ((whichMenu == 5)) { popupWidth = "100"; insideWidth = "98"; }
				 if ((whichMenu == 6)) { popupWidth = "130"; insideWidth = "128"; }
				 if ((whichMenu == 7)) { popupWidth = "140"; insideWidth = "138"; }				 if ((whichMenu == 8)) { popupWidth = "130"; insideWidth = "128"; }				 if ((whichMenu == 9)) { popupWidth = "250"; insideWidth = "248"; }				 if ((whichMenu == 10)) { popupWidth = "200"; insideWidth = "198"; }				 if ((whichMenu == 11)) { popupWidth = "215"; insideWidth = "213"; }				 if ((whichMenu == 12)) { popupWidth = "160"; insideWidth = "158"; }
//the size of the height of each tr (leave alone)
                                popupHeight = (itemsOnMenu[whichMenu] * 15)
//theTable is a variable that holds the string of the entire table of the Popups
                                theTable  = '<table width=' + popupWidth + ' cellpadding=0 cellspacing=0 border=1><tr><td>\n'
                                theTable += '<table align="center" width=' + insideWidth + ' height=' + popupHeight + ' bgcolor=' + bgNormal + ' cellspacing=0 cellpadding=0 border=0>\n'
                               //theTable += '<tr><td width="100%" height=1></td></tr>\n' 
                for (x = 0; x < itemsOnMenu[whichMenu]; x++ ) {
                        bg2Use = bgNormal; class2Use = "notHot";
                        if (x == whichHotItem) { bg2Use = bgHot; class2Use = "Hot"; }
                        theTable += '<tr bgcolor=' + bg2Use + '><td><a href="' + urlLinks[whichMenu][x] + '" class="' + class2Use + '" onMouseOver="doPopup(' + whichMenu + ',' + x + ');" onMouseOut="hideTime();">' + menuItems[whichMenu][x] + '</a></td></tr>\n'
                       //aif (x != itemsOnMenu[whichMenu]) { theTable += '<tr><td width="100%" height=1></td></tr>\n' }
                }
                theTable += '</table>\n</td></tr></table>\n'
//Check for N4 and writes to the Layer tag
                if (n4) {
                        browserWidth = window.innerWidth;
                        browserOffset = 20;
                        //if (browserWidth < pageWidth ) {
                        //      browserWidth = pageWidth;
                        //}
                        offset = (browserWidth - pageWidth)/2 + moveOver - 2;
        //              menuPosX = offset + browserOffset;
                        menuPosX = 0 + moveOver;
        
                        whichLayer = "nsPopup"
                        document.layers[whichLayer].visibility = 'hide'
                        document.layers[whichLayer].document.write(theTable)
                        document.layers[whichLayer].document.close()
                        if (whichHotItem == -1) {
                                document.layers["nsBuffer"].visibility = 'hide'
                                document.layers["nsBuffer"].document.write(theTable)
                                document.layers["nsBuffer"].document.close()
                                document.layers["nsBuffer"].moveTo(menuPosX, menuPosY[whichMenu])
                                document.layers["nsBuffer"].visibility = 'show'
                        }
                        document.layers[whichLayer].moveTo(menuPosX, menuPosY[whichMenu])
                        document.layers[whichLayer].visibility = 'show'
                }
//Checks for IE4 and writes to the Div tag
                else if (ie4) {
                        browserWidth = parseInt(document.body.offsetWidth);
                        browserOffset = 20;
//                      if (browserWidth < pageWidth ) {
//                                              browserWidth = pageWidth;
//                      }
                        offset = (browserWidth - pageWidth)/2 + moveOver;
//                      menuPosX = offset + browserOffset;
//                      menuPosX = offset - 70;
                        menuPosX = 0 + moveOver;

                        whichLayer = "iePopup"
                        document.all[whichLayer].innerHTML = theTable
                        document.all[whichLayer].style.posLeft = menuPosX
                        document.all[whichLayer].style.posTop = menuPosY[whichMenu]
                        document.all[whichLayer].style.visibility = 'visible'
                        }
                }
             
        }

        
function hideTime() {
        if (version != "ok") {
        }
        else{
                theTimeout = setTimeout("hidePopups()", "300");
	}
}

function hidePopups() {

                lastMenu = -99
                lastHotItem = -99
                
        if (n4) {
                document.layers["nsPopup"].visibility = "hide";
                document.layers["nsBuffer"].visibility = "hide";
        }

                else if (ie4) { 
                 document.all["iePopup"].style.visibility = 'hidden';
        }
}
