//***************************************************************************** // Menu object //***************************************************************************** var TOP_OFFSET_DEFAULT = 75; var TOP_MENU_OFFSET = 15; var LEFT_OFFSET_DEFAULT = -10; var RIGHT_OFFSET_DEFAULT = 20; var MAX_WIDTH = 920; var CURR_MENU = -1; var menuItems; function menuItem( text, width, height, left, top, searchIdx, data ) { this.recalc = true; this.text = text; this.width = width; this.height = height; this.left = left; this.top = top; this.searchIdx = searchIdx; this.data = data; } function showMenuItem() { // position the div and display the nav if (this.data != '') { var shim = document.getElementById("shim"); var menu_div = document.getElementById("top_nav"); menu_div.style.width = this.width+"px"; menu_div.style.left = this.left+"px"; menu_div.style.top = this.top+"px"; menu_div.style.display = 'block'; menu_div.innerHTML = this.data; shim.style.width = this.width+"px"; shim.style.height = menu_div.offsetHeight +"px"; shim.style.left = this.left+"px"; shim.style.top = this.top+"px"; shim.style.display = 'block'; } } function hideMenuItem() { var navItem = document.getElementById ("tnav" + CURR_MENU); if( navItem ) navItem.className = "white_n"; CURR_MENU = -1; var menu_div = document.getElementById("top_nav"); menu_div.style.display = 'none'; var shim = document.getElementById("shim"); shim.style.display = 'none'; return true; } function recomputeLayout(elem) { if( this.recalc ) { var width = window.document.body.clientWidth; if( width > MAX_WIDTH ) width = MAX_WIDTH; if( width > (this.width + this.left) ) this.left = elem.offsetLeft + LEFT_OFFSET_DEFAULT; else this.left = width - (this.width + RIGHT_OFFSET_DEFAULT); this.top = elem.offsetTop + TOP_MENU_OFFSET; p = elem.offsetParent; while(p) { if( width > (this.width + this.left) ) this.left += p.offsetLeft; else this.left = width - (this.width + RIGHT_OFFSET_DEFAULT); this.top += p.offsetTop; p = p.offsetParent; } this.recalc = false; } }; menuItem.prototype.show = showMenuItem; menuItem.prototype.hide = hideMenuItem; menuItem.prototype.layout = recomputeLayout; //***************************************************************************** // Menu functions //***************************************************************************** function displayitems(elem) { var idx = elem.id.replace( /tnav/, "" ); var anItem = menuItems[idx]; anItem.layout(elem); //identify clicked link so it can be highlighted if (CURR_MENU != idx) { // hide the old item if(CURR_MENU != -1) { var oldItem = menuItems[CURR_MENU]; if(oldItem) oldItem.hide(); var oldElem = document.getElementById ("tnav" + CURR_MENU); if( oldElem ) oldElem.className = "white_n"; } // load the html if (anItem.data == '') { var menu_div = document.getElementById("top_nav"); menu_div.style.display = 'block'; menu_div.style.width = anItem.width+"px"; menu_div.style.left = anItem.left+"px"; menu_div.style.top = anItem.top+"px"; menu_div.innerHTML = "Loading..."; var ajaxData = new Ajax; ajaxData.getXml("/include/top_nav_items.asp", "top_nav_id=" + anItem.searchIdx, anItem, loadMenuHtml) } else { anItem.show(); } elem.className = 'yellow'; CURR_MENU = idx; } else { anItem.hide(); } return false; } function loadMenuHtml(anItem, html) { html_response = html.responseText; if (html_response != "") { anItem.data = html_response; anItem.show(); } } function hidemenuitem() { if( CURR_MENU != -1 ) menuItems[CURR_MENU].hide(); } var oldResizeFunction = window.onresize; function handleResize() { if( menuItems ) { for (i = 0; i < menuItems.length; i++) { menuItems[i].recalc = true; } if( CURR_MENU != -1 ) { menuItems[CURR_MENU].hide(); } } if(oldResizeFunction) oldResizeFunction(); } window.onresize = handleResize; //***************************************************************************** // Search functions //***************************************************************************** function ConstructURL(u,remove,add) { var p = BuildURLArray(u); var n = ""; for (var i=0; i 0) { n = n.substr(1); n = "?"+n; } else { n = "?N="+eneroot; } return n; } function BuildURLArray(u) { var a = new Array(); var n; if (u == "CURRENTURL") n = location.search; else if (u == "BLANKURL") { } else { var t = u.split("?"); n = "?"+t[1]; } if (n) { n = n.substr(1); var s = n.split("&"); for(var i=0; i 0) { within = frm.within.checked; } if(t == defaultTerm || t == '') { alert ("Oops! You forgot to enter a keyword or product number before hitting \"GO\". \n\t\tPlease try again."); } else { // Create new url with property search and dimension search if (within == false) { var dept = ""; add = ["N=" + ((dept == "") ? "0" : dept), "Ntt="+t, "Ntk=All", "Nty=1", "D="+t, "Dx=mode matchall"]; remove = ["N", "CusaNe", "Ntt", "Ntk", "Nty", "D", "No", "Dx", "autoredir", "search", "search_redir", "Swl", "product_code", "cm_ven", "cm_cat", "cm_pla", "cm_ite", "engine", "amount", "pfp", "prod_group_category_id", "mfg_id", "mfg_name", "Cn"]; } else { var oldterms = escape(frm.oldterms.value); var olddept = escape(frm.olddept.value); add = ["N=" + ((olddept == "") ? "0" : olddept), "Ntt="+t + ' ' + oldterms, "Ntk=All", "Nty=1", "D="+t + ' ' + oldterms, "Dx=mode matchall"]; remove = ["N", "Ntt", "Ntk", "Nty", "D", "No", "Dx", "autoredir", "search", "search_redir", "Swl", "product_code", "cm_ven", "cm_cat", "cm_pla", "cm_ite", "engine", "amount", "pfp", "Cn"]; } var u = ConstructURL("CURRENTURL", remove, add); location.href = "/products/products.asp" + u; } } function clearSearchBox(c) { if(escape(c.value) == defaultTerm) { c.value = ""; } }