//
// User configuration
// Customize your menu below.
//
// You may copy and use this script for free, but if you like it
// please go to http://www.wiltech.net/downloads/menuj/create.htm and donate
// just $1.
//
// Thanks!
//
// coderunner (Joseph Sullivan)
//	
var mainMenuColor="#000000";
var menuItemColor="e0e0e0";
var highlightColor="#0099cc";
var highlightTextColor="#ffffff";
var borderWidth=1;
var borderHeight=1;
var paddingWidth=3;
var paddingHeight=3;
var itemWidth=168;
var itemHeight=20;
var hAlign="left";
var vAlign="middle";
var anchorClass="menuAnchor";
var itemTagsOpen="<font class='menuAnchor' face='Arial' size='2' color='#000000'>";
var itemTagsClose="</font>";
var menuDelay=0.3; 	





//	
// Do not change anything below this line
// ######################################
//
// Revision 1.5: Added support for getElementById() compliant (modern) browsers.
//		   this fixed compatability issues with Netscape 7.1
//


var lockArray=new Array();
var clrByJump = false;

	// Added 3/27/01 JS
	// For OK Farm site
function getLock(name){
	if(lockArray[name]!=true)
		return false;
	else    return true;
}

function clearLock(name){
	lockArray[name]=false;
}

function setLock(name){
	lockArray[name]=true;
}

function clearLocks() {
	for (a=0; a<lockArray.length;a++)
		lockArray[a]=false;
}

function clearByJump() {
	// Image restore goes here
	clrByJump = true;
}


	// Variable (and "constant") declaration:
	var TYPE_NONE = 0;
	var TYPE_IE4 = 1;
	var TYPE_NS4=2;
	var TYPE_COMPLIANT=4;
	function menu (left,top) { this.childMenuOpen=-1; this.parentMenuIndex=-1; this.hasMouse=false; this.left=left; this.top=top; this.childCount=0; this.children=new Array; this.url="";}
	function menuItem (contents,url,background) { this.transparent=false; this.childMenuIndex=-1; this.background=background; this.image=""; this.html=contents; this.url=url;}
	var menus=new Array();
	var menuCount=0;

	// Browser detection:
	var type= TYPE_NONE;
	if (document.layers) type = TYPE_NS4;
	if (document.all) type=TYPE_IE4;
	if (document.getElementById) type=TYPE_COMPLIANT;


function menuOn (index) {

	  setLock(index);	
          showMenu(index);
	  menus[index].hasMouse=true;

	  // If this menu has a parent, turn the parent on, too:
	  var parentIndex=menus[index].parentMenuIndex;
	  if (parentIndex > -1 ) {
	     menus[parentIndex].childMenuOpen=index;
	  	showMenu(parentIndex);
//	  	menus[parentIndex].hasMouse=true;
	  }


	if (index == 0) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/automotive_btn_ro.gif";
	}
	 else if (index == 1) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_appliances_btn_ro.gif";
	} else if (index == 2) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_electronics_btn_ro.gif";
	} else if (index == 3) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_decorating_btn_ro.gif";
	} else if (index == 4) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_remodeling_btn_ro.gif";
	} else if (index == 5) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/lawn_garden_btn_ro.gif";
	} else if (index == 6) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_maintenance_btn_ro.gif";
	} else if (index == 7) {
	  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_finances_btn_ro.gif";
        }
}

function menuOff(index,buttonName) {

		menus[index].hasMouse=false;

		// If this menu has a child open with the mouse, don't close: 
		if ((menus[index].childMenuOpen > -1)&&(menus[menus[index].childMenuOpen].hasMouse)) return;
		
		// If this is a child menu, close the parent too if the parent doesn't have the mouse:
		if (menus[index].parentMenuIndex > -1) {
		   if (menus[menus[index].parentMenuIndex].hasMouse==false)
		   this.timer=setTimeout(("hideMenu('"+menus[index].parentMenuIndex+"')"),1000*menuDelay);
		   menus[menus[index].parentMenuIndex].childMenuOpen=-1;  // We closed the child.
		}	
		
		// If this menu has an open child that doesn't have the mouse, close them both:
//		if(menus[index].childMenuOpen > -1){
	//		if((menus[index].hasMouse==false)&&(menus[(menus[index].childMenuOpen)].hasMouse==false))	;					  		
			//	this.timer=setTimeout(("hideMenu('"+menus[index].childMenuOpen+"')"),1000*menuDelay);
		//}	
		
		this.timer=setTimeout(("hideMenu('"+index+"')"),1000*menuDelay);
}


// Shows a menu...
function showMenu(index) {

	var parentIndex=menus[index].parentMenuIndex;
	var childIndex=menus[index].childMenuOpen;
	
	if (type==TYPE_NS4) {		// For Netscape browsers
	  // Hide all menus, except 1) This menu, 2) it's parent, and 3) any open child menu.
	   for (var n=0; n<menuCount; n++) if((n!=index)&&(n!=parentIndex)&&(n!=childIndex)) {	document.layers[n].visibility="hidden"; }
	   // Show this menu.
		document.layers[index].visibility="show";
	} else if (type==TYPE_IE4) {	// For IE browsers
	  // Hide all menus, except 1) This menu, 2) it's parent, and 3) any open child menu.
 	  for (var n=0; n<menuCount; n++) if((n!=index)&&(n!=parentIndex)&&(n!=childIndex)) { document.all("menu"+n+"d").style.visibility="hidden"; }    
	   // Show this menu.
		document.all("menu"+index+"d").style.visibility="visible";
	} else if (type==TYPE_COMPLIANT) {
	  // Hide all menus, except 1) This menu, 2) it's parent, and 3) any open child menu.
 	  for (var n=0; n<menuCount; n++) if((n!=index)&&(n!=parentIndex)&&(n!=childIndex)) { document.getElementById("menu"+n+"d").style.visibility="hidden"; }    
	   // Show this menu.
		document.getElementById("menu"+index+"d").style.visibility="visible";

	}

}


// Hides a menu...
function hideMenu(index) {

	// Just leave alone if this menu still has mouse over it, or has an open child with the mouse.
	if(menus[index].hasMouse) return;	
	if(menus[index].childMenuOpen > -1) {
		if (menus[menus[index].childMenuOpen].hasMouse) return;
	}
	
	// If this window has an open child, shut it down, too:
	if (menus[index].childMenuOpen > -1){
	   hideMenu(menus[index].childMenuOpen);  // Recursive call!
	   menus[index].childMenuOpen =-1;
	}
	
	if (type==TYPE_NS4) {		// For Netscape browsers
		document.layers[index].visibility="hidden";
	} else if (type==TYPE_IE4) {	// For IE browsers
		document.all("menu"+index+"d").style.visibility="hidden";
	} else if (type==TYPE_COMPLIANT) {
		document.getElementById("menu"+index+"d").style.visibility="hidden";
	}

	if ((getLock(index) == true)&&(menus[index].parentMenuIndex==-1)){	// Clear lock for root menus only
		// Image restore goes here
		clearLock(index);
	}

    if (index == 0) {
        document.getElementById("a").src = "http://www.home-n-garden-center.com/images/automotive_btn.gif";
	} else if (index == 1) {
        document.getElementById("b").src = "http://www.home-n-garden-center.com/images/home_appliances_btn.gif";
	} else if (index == 2) {
        document.getElementById("c").src = "http://www.home-n-garden-center.com/images/home_electronics_btn.gif";
   	} else if (index == 3) {
        document.getElementById("d").src = "http://www.home-n-garden-center.com/images/home_decorating_btn.gif";
	} else if (index == 4) {
        document.getElementById("e").src = "http://www.home-n-garden-center.com/images/home_remodeling_btn.gif";
	} else if (index == 5) {
        document.getElementById("f").src = "http://www.home-n-garden-center.com/images/lawn_garden_btn.gif";
	} else if (index == 6) {
        document.getElementById("g").src = "http://www.home-n-garden-center.com/images/home_maintenance_btn.gif";
	} else if (index == 7) {
        document.getElementById("h").src = "http://www.home-n-garden-center.com/images/home_finances_btn.gif";
	}
}

function buttonOn() {
  event.srcElement.src = "http://www.home-n-garden-center.com/images/home_garden_center_btn_ro.gif";
}

function buttonOff() {
  document.getElementById("i").src = "http://www.home-n-garden-center.com/images/home_garden_center_btn.gif";
}

function onMouseOverItem (index1, index2) {
		 
	// Highlight the menu:
	if (type==TYPE_NS4) {
		document.layers[index1].layers[index2].bgColor=highlightColor;
	} else if (type==TYPE_IE4) {
		document.all("menu"+index1+index2).style.background=highlightColor;
	} else if (type==TYPE_COMPLIANT){
        	document.getElementById("menu"+index1+index2).style.background="#A6FFA9";
	}

	// Hide any popout (children) menus that may be visible from previously:
	if(menus[index1].childMenuOpen > -1)
			hideMenu(menus[index1].childMenuOpen);
								   
	// If this item has a popout child, show the child:
	if ((menus[index1].children[index2].childMenuIndex) > -1){			   	  	   // Do we have a child menu?
	   menus[index1].childMenuOpen=menus[index1].children[index2].childMenuIndex;  // Remember which child is open
	   showMenu(menus[index1].children[index2].childMenuIndex);					   // Open the child	  
	   }
}

function onMouseOutItem (index1, index2) {

	if(menus[index1].children[index2].transparent) itemColor="";
	else    itemColor=menuItemColor;												

	if (type==TYPE_NS4) {
		document.layers[index1].layers[index2].bgColor=menuItemColor;
	} else if (type==TYPE_IE4) {
		document.all("menu"+index1+index2).style.background=itemColor;
	} else if (type==TYPE_COMPLIANT) {
		document.getElementById("menu"+index1+index2).style.background=itemColor;
	}
}

// Draws the menus.
function drawMenus () {
	
addMenu(11,260);
addMenuItem("Antique Cars","http://www.home-n-garden-center.com/antique_cars.html","");
addMenuItem("Car Accessories","http://www.home-n-garden-center.com/car_accessories.html","");
addMenuItem("Car Insurance","http://www.home-n-garden-center.com/car_insurance.html","");
addMenuItem("Defensive Driving","http://www.home-n-garden-center.com/defensive_driving.html","");
addMenuItem("Electric Scooters","http://www.home-n-garden-center.com/electric_scooter.html","");
addMenuItem("GPS","http://www.home-n-garden-center.com/gps.html","");
addMenuItem("RV's","http://www.home-n-garden-center.com/rvs.html","");
addMenu(88,260);
addMenuItem("Air Purifiers","http://www.home-n-garden-center.com/air_purifiers.html","");
addMenuItem("Coffee Makers","http://www.home-n-garden-center.com/coffee_makers.html","");
addMenuItem("Juicers","http://www.home-n-garden-center.com/juicers.html","");
addMenuItem("Kitchen Appliances","http://www.home-n-garden-center.com/kitchen_aid.html","");
addMenuItem("Vacuum Cleaners","http://www.home-n-garden-center.com/vacuum_cleaners.html","");
addMenu(165,260);
addMenuItem("Broadband","http://www.home-n-garden-center.com/broadband.html","");
addMenuItem("HDTV","http://www.home-n-garden-center.com/hdtv.html","");
addMenuItem("Home Cinema","http://www.home-n-garden-center.com/home_cinema.html","");
addMenuItem("Home Security","http://www.home-n-garden-center.com/home_security.html","");
addMenuItem("Home Theater","http://www.home-n-garden-center.com/home_theater.html","");
addMenuItem("Portable Generators","http://www.home-n-garden-center.com/portable_generator.html","");
addMenuItem("Satellite TV","http://www.home-n-garden-center.com/satellite_tv.html","");
addMenuItem("Solar Power","http://www.home-n-garden-center.com/solar_power.html","");
addMenu(242,260);
addMenuItem("Aquariums","http://www.home-n-garden-center.com/aquariums.html","");
addMenuItem("Bathroom Decor","http://www.home-n-garden-center.com/bathroom_decor.html","");
addMenuItem("Blinds","http://www.home-n-garden-center.com/blinds.html","");
addMenuItem("Candles","http://www.home-n-garden-center.com/candles.html","");
addMenuItem("Clocks","http://www.home-n-garden-center.com/clocks.html","");
addMenuItem("Decor","http://www.home-n-garden-center.com/decor.html","");
addMenuItem("Incense","http://www.home-n-garden-center.com/incense.html","");
addMenuItem("Interior Design","http://www.home-n-garden-center.com/interior_design.html","");
addMenuItem("Kitchen Decor","http://www.home-n-garden-center.com/kitchen_decor.html","");
addMenu(319,260);
addMenuItem("Bathroom Remodeling","http://www.home-n-garden-center.com/bathroom_remodeling.html","");
addMenuItem("Cabinets","http://www.home-n-garden-center.com/cabinets.html","");
addMenuItem("Flooring","http://www.home-n-garden-center.com/flooring.html","");
addMenuItem("Home Improvement","http://www.home-n-garden-center.com/home_improvement.html","");
addMenuItem("Kitchen Remodeling","http://www.home-n-garden-center.com/remodeling_a_kitchen.html","");
addMenuItem("Laminate Flooring","http://www.home-n-garden-center.com/laminate_flooring.html","");
addMenuItem("Painting","http://www.home-n-garden-center.com/painting.html","");
addMenuItem("Remodeling","http://www.home-n-garden-center.com/remodeling.html","");
addMenuItem("Roofing","http://www.home-n-garden-center.com/roofing.html","");
addMenu(396,260);
addMenuItem("Bird Houses","http://www.home-n-garden-center.com/bird_house.html","");
addMenuItem("Bonsai","http://www.home-n-garden-center.com/bonsai.html","");
addMenuItem("Fountains","http://www.home-n-garden-center.com/fountains.html","");
addMenuItem("Garden Tools","http://www.home-n-garden-center.com/garden_tools.html","");
addMenuItem("Gardening","http://www.home-n-garden-center.com/gardening.html","");
addMenuItem("Gardening Tips","http://www.home-n-garden-center.com/gardening_tip.html","");
addMenuItem("Gardens","http://www.home-n-garden-center.com/gardens.html","");
addMenuItem("Hot Tubs","http://www.home-n-garden-center.com/hot_tubs.html","");
addMenuItem("Hydroponics","http://www.home-n-garden-center.com/hydroponics.html","");
addMenuItem("Landscaping","http://www.home-n-garden-center.com/landscaping.html","");
addMenuItem("Lawn Care","http://www.home-n-garden-center.com/lawn_care.html","");
addMenuItem("Organic Gardening","http://www.home-n-garden-center.com/organic_gardening.html","");
addMenuItem("Outdoor Decor","http://www.home-n-garden-center.com/outdoor_decor.html","");
addMenuItem("Plants","http://www.home-n-garden-center.com/plants.html","");
addMenuItem("Rose Gardening","http://www.home-n-garden-center.com/roses.html","");
addMenuItem("Saunas","http://www.home-n-garden-center.com/saunas.html","");
addMenuItem("Solar Lighting","http://www.home-n-garden-center.com/solar_lighting.html","");
addMenuItem("Vegetable Gardening","http://www.home-n-garden-center.com/vegetable_gardening.html","");
addMenuItem("Wind Chimes","http://www.home-n-garden-center.com/wind_chimes.html","");
addMenu(473,260);
addMenuItem("Heating","http://www.home-n-garden-center.com/heating.html","");
addMenuItem("Pest Control","http://www.home-n-garden-center.com/pest_control.html","");
addMenuItem("Power Tools","http://www.home-n-garden-center.com/power_tools.html","");
addMenuItem("Solar Heating","http://www.home-n-garden-center.com/solar_heating_system.html","");
addMenu(550,260);
addMenuItem("Attorneys","http://www.home-n-garden-center.com/attorneys.html","");
addMenuItem("Bankruptcy","http://www.home-n-garden-center.com/bankruptcy.html","");
addMenuItem("Credit Repair","http://www.home-n-garden-center.com/credit_repair.html","");
addMenuItem("Debt Relief","http://www.home-n-garden-center.com/debt_relief.html","");
addMenuItem("Foreclosures","http://www.home-n-garden-center.com/foreclosures.html","");
addMenuItem("Home Mortgage","http://www.home-n-garden-center.com/home_mortgage.html","");
addMenuItem("Home Refinance","http://www.home-n-garden-center.com/home_loan_refinance.html","");

    // Loop through the menu items, looking for items that are parents of submenus.
	// For each one we find, set it's child menu's parentMenuIndex.
	for (var n=0; n<menuCount; n++) {
		for (var m=0; m<menus[n].childCount; m++) {
			if (menus[n].children[m].childMenuIndex > -1)
			   menus[menus[n].children[m].childMenuIndex].parentMenuIndex=n;
		}
	}
				
	if (type==TYPE_NS4) {			// Draw Netscape menus.

		for (var curMenu=0; curMenu<menuCount; curMenu++) {
                  document.writeln("<layer visibility='hidden' width='"+(itemWidth+(2*borderWidth))+"' height='"+((itemHeight+borderHeight)*(menus[curMenu].childCount)+borderHeight)+"' pagex='"+menus[curMenu].left+"' pagey='"+menus[curMenu].top+"' bgcolor='#00ae04' onmouseover='menuOn("+curMenu+")' onmouseout='menuOff("+curMenu+")'>");


			for (var curItem=0; curItem<menus[curMenu].childCount; curItem++) {
				document.write("<layer width='"+itemWidth+"' height='"+itemHeight+"' top='"+(borderHeight+(curItem*(itemHeight+borderHeight)))+"' left='"+borderWidth+"' bgcolor='"+menuItemColor+"'><center><table cellspacing='0' cellpadding='0' border='0' background='"+menus[curMenu].children[curItem].background+"' width='"+(itemWidth-(2*paddingWidth))+"' height='"+(itemHeight-(2*paddingHeight))+"'><tr><td align='"+hAlign+"' valign='"+vAlign+"'><a class='"+anchorClass+"' href='"+menus[curMenu].children[curItem].url+"'  onmouseover='onMouseOverItem("+curMenu+","+curItem+")' onmouseout='onMouseOutItem("+curMenu+","+curItem+")'>");
				document.write(itemTagsOpen+menus[curMenu].children[curItem].html+itemTagsClose);
				document.writeln("</a></td></tr></table></center></layer>");
			}
			document.writeln("</layer>");
		}

	} else if ((type==TYPE_IE4)||(type==TYPE_COMPLIANT)) {		// Draw IE menus.

		for (var curMenu=0; curMenu<menuCount; curMenu++) {
		  document.writeln("<div id='menu"+curMenu+"d' style='background:#00ae04;position:absolute;visibility:hidden;width:"+(itemWidth+(2*borderWidth))+";height:"+((itemHeight+borderHeight)*(menus[curMenu].childCount)+borderHeight)+";left:"+menus[curMenu].left+";top:"+menus[curMenu].top+";' onmouseover='menuOn("+curMenu+")' onmouseout='menuOff("+curMenu+")'>");

            
			for (var curItem=0; curItem<menus[curMenu].childCount; curItem++) {
				if(menus[curMenu].children[curItem].transparent) itemColor="";
				else    itemColor=menuItemColor;												
				document.write("<div id='menu"+curMenu+""+curItem+"' style='background:"+itemColor+";position:absolute;width:"+itemWidth+";height:"+itemHeight+";top:"+(borderHeight+(curItem*(itemHeight+borderHeight)))+";left:"+borderWidth+";' bgcolor='"+menuItemColor+"'><center><table cellspacing='0' cellpadding='0' border='0' background='"+menus[curMenu].children[curItem].background+"' width='"+(itemWidth-(2*paddingWidth))+"' height='"+(itemHeight-(2*paddingHeight))+"'><tr><td align='"+hAlign+"' valign='"+vAlign+"'><a href='"+menus[curMenu].children[curItem].url+"' class='"+anchorClass+"' onmouseover='onMouseOverItem("+curMenu+","+curItem+")' onmouseout='onMouseOutItem("+curMenu+","+curItem+")'>");
				document.write(itemTagsOpen+menus[curMenu].children[curItem].html+itemTagsClose);
				document.writeln("</a></td></tr></table></center></div>");
			}
			document.writeln("</div>");
		}



	}

}


// Adds a menu to the list 
function addMenu (left,top) {
		 if(type==TYPE_IE4) 
		 		 menus[menuCount]=new menu(left,top);
		 else
		 		 menus.push(new menu(left,top));

		 menuCount++;
		 
}

// Adds a submenu item to the current menu item 
function addMenuItem (html,url,background) {
		 if (type==TYPE_IE4)
		 	menus[menuCount-1].children[(menus[menuCount-1].childCount)]=new menuItem(html,url,background);
		 else
		 	 menus[menuCount-1].children.push(new menuItem(html,url,background));

		 menus[menuCount-1].childCount++;
}

// Adds an expandable submenu item to the current menu item 
function addExpandableMenuItem (html,url,background,index) {
		 // Add the menu item:
		 addMenuItem (html,url,background);
		 // Set the item's child index:
		 menus[menuCount-1].children[(menus[menuCount-1].childCount-1)].childMenuIndex=index;
}

// Makes the previous entry transparent:
function makeTransparent() {
		 menus[menuCount-1].children[(menus[menuCount-1].childCount)-1].transparent=true;
}


function goToDirectory(inURL) {
   window.location = "http://"+inURL+".com/resources/favoritelinks.html"; 
}

function showStatus(inURL) {
   window.status="http://"+inURL+".com/resources/favoritelinks.html";
   document.all("directory").style.cursor = 'hand';
}

function hideStatus() {
   window.status=""; 
}
