					
					var curDiv = null;
					var curTop = null;
					var curTopOrigClass = null;
					var IE = document.all?true:false;
					


					var xy;
					
					function detectOff(e)
					{
						getMousePos(e);

						var topLeft = getRealPos(curTop, "Left");
						var topTop = getRealPos(curTop, "Top");
						
						if ((xy[0] < topLeft)||
							(xy[0] > topLeft + curDiv.offsetWidth)||
							(xy[1] < topTop) || 
							(xy[1] > topTop + curDiv.offsetHeight + curTop.offsetHeight)){
							setTimeout("delayOff();",  300);
							
							document.onmousemove = getMousePos;	

						}					
					}
					
					function delayOff(e)
					{
						var topLeft = getRealPos(curTop, "Left");
						var topTop = getRealPos(curTop, "Top");
											
						if ((xy[0] < topLeft)||
							(xy[0] > topLeft + curDiv.offsetWidth)||
							(xy[1] < topTop) || 
							(xy[1] > topTop + curDiv.offsetHeight + curTop.offsetHeight)){
							curDiv.style.display = "none";	
							if(document.getElementById('category_div_1')){
							    document.getElementById('category_div_1').style.display = 'block';
							}
							
							curTop.className = curTopOrigClass;		
							document.onmousemove = null;						
						}	
						else
						{
							document.onmousemove = detectOff;
						}											
					}
					

					function getMousePos(e)
					{
					
					
						var mouseX = 0;
						var mouseY = 0;

						if (!e)
						var e = window.event||window.Event;

						if('undefined'!=typeof(e.pageX))
						{
							mouseX = e.pageX;
							mouseY = e.pageY;
						}
						else
						{
							mouseX = event.clientX;
							mouseY = event.clientY;
						}

					
						xy = new Array(mouseX, mouseY);

					
					}					
					
					function getRealPos(el,which) 
					{
						iPos = 0
						while (el!=null) {
				 			iPos += el["offset" + which]
							el = el.offsetParent
						}
						return iPos
					}					
					function showDrop(id, show, topClass, td)
					{
						var div = $("menu_" + id);
						if (div != null){
						//alert(id);
						if(document.getElementById('category_div_1')){
							if (id=='x13' || id =='x8'){
							document.getElementById('category_div_1').style.display = 'none';
							}
						}
							//if the mouse cursor is within the top range and div range, don't do
							//anything, otherwise, hide it
					
							var topLeft = getRealPos($("top_" + id), "Left");
							var topTop = getRealPos($("top_" + id), "Top");	
							
							if (topClass != null)
								curTopOrigClass = topClass;
					
							if (show == "block"){
								$('top_' + id).className = "topnavselect";
								
								//hide all open items right away except if the match sub menu is open
								var divs = document.getElementsByClassName("dropDiv");
								var i=0;
								for (i=0;i<divs.length;i++)
								{
									if (divs[i].id != "menu_" + id)
									{
										var thisID = divs[i].id.substring(5, divs[i].id.length + 1);
										divs[i].style.display = "none";
										$("top_" + thisID).className = $("oClass_" + thisID).value;
									}									
								}
								
								div.style.display = show;
								
								

								//enable mouse move event to detect if the mouse
								//if off both top and div
								
								curTop = $('top_' + id);
								curDiv = div;
								
								document.onmousemove = detectOff;

							}
								
					
							div.style.left = topLeft  + "px";
							div.style.top = topTop + $("top_" + id).offsetHeight + "px";
							if (td != null)
							{
								if (IE)
									div.style.width = td.offsetWidth;
								else
									div.style.width = td.offsetWidth - 8;
							}
								
						}
					}
