/*----------------------------------------------------------------------------- - Description: - - This file contains proprietary and confidential information from WebAssist.com - corporation. Any unauthorized reuse, reproduction, or modification without - the prior written consent of WebAssist.com is strictly prohibited. - - Copyright 2009 WebAssist.com Corporation. All rights reserved. ------------------------------------------------------------------------------*/ var cssmw3 = { select_current: 0, // 1 = whole cascade, 2 = just child, 3 = just main level orientation: 0, // 0 = v1, 1 = horizontal, 2 = vertical main_ul: null, stopClear: false, hoverLI: false, focusLI: false, stopBlur: false, browser: { isIE6: false, isIE7: false, isSafari: false }, intializeMenu: function(id,opts) { if (!opts) opts = {}; var params = { select_current : ( opts.select_current || 0 ), orientation : ( opts.orientation || 0 ) } //initialize variables var ul = document.getElementById(id); this.select_current = params.select_current; this.orientation = params.orientation; this.main_ul = ul; this.browser.isIE6 = (navigator.appName == 'Microsoft Internet Explorer' && this.ieVersion() < 7); this.browser.isIE7 = (navigator.appName == 'Microsoft Internet Explorer' && this.ieVersion() == 7); this.browser.isLteIE7 = (this.browser.isIE6 || this.browser.isIE7); this.browser.isSafari = (navigator.appName == "Netscape" && navigator.userAgent.indexOf("Safari") >= 0); if (this.orientation != 2) { //not done in V1 vertical include //set top of uls for IE 7- if (this.browser.isLteIE7) { var topOffset = ul.offsetHeight; var lis = ul.childNodes; for(var i = 0; i < lis.length; i++) { if(lis[i].tagName && lis[i].tagName.toLowerCase() == 'li') { var uls = lis[i].childNodes; for(var j = 0; j < uls.length; j++) { if(uls[j].tagName && uls[j].tagName.toLowerCase() == 'ul') { uls[j].style.top = topOffset + 'px'; } } } } } } //set mouseover and mouseout for IE 6- var lis = this.localGetElementsByTagName(this.main_ul, 'li'); for(var i=0; i 1)) { //otherwise move out of sub-level for all liToSelect = this.browseGetParent(ul); } break; case 38: //up key //do nothing in a top-level horizontal if (level == 0 && this.orientation == 1) { return; } liToSelect = this.browseGetSibling(ul, li, -1); if (!liToSelect && level == 1 && this.orientation == 1) { //top level of first sub of a horizontal menu, move out liToSelect = this.browseGetParent(ul); } break; case 39: //right key //move right in top level of horizontal list if (level == 0 && this.orientation == 1) { liToSelect = this.browseGetSibling(ul, li, 1); } else { //enter child list if it exists liToSelect = this.browseGetChild(li); } break; case 40: //down key //move into child in top level of horizontal list if (level == 0 && this.orientation == 1) { liToSelect = this.browseGetChild(li); } else { //move down anywhere else liToSelect = this.browseGetSibling(ul, li, 1); } break; } if (liToSelect) { var aTags = this.localGetElementsByTagName(liToSelect, "A"); if (aTags.length) { aTags[0].focus(); } } }, browseGetParent: function(presentLI) { var parentLI = presentLI.parentNode; while (parentLI && parentLI.parentNode && parentLI.tagName.toLowerCase() != "li") { parentLI = parentLI.parentNode; } if (parentLI && parentLI.tagName.toLowerCase() == "li") return parentLI; return false; }, browseGetChild: function(presentLI) { var tULs = this.localGetElementsByTagName(presentLI, "ul"); if (tULs.length && tULs[0].childNodes && tULs[0].childNodes.length) { return this.localGetElementsByTagName(tULs[0], "li")[0]; } return false; }, browseGetSibling: function(presentUL, presentLI, plusMinus) { var tLIs = this.localGetElementsByTagName(presentUL, "li"); var childLIs = []; for (var n=0; n= 0 && n+plusMinus != childLIs.length) { return childLIs[n+plusMinus]; } break; } } return false; }, clearHoverLIs: function() { this.clearHovFocLIs("hoverLI"); }, clearFocusLIs: function() { this.clearHovFocLIs("focusLI"); }, clearHovFocLIs: function(toClear) { var myLIs = this.localGetElementsByTagName(this.main_ul, "li"); for (var n=0; n= 0) { hrefString = hrefString.substring(hrefString.indexOf("://") + 3); if (hrefString.charAt(0) == "/") { hrefString = hrefString.substring(1); } hrefString = hrefString.substring(hrefString.indexOf("/")); } if (testLoc.indexOf("://") >= 0) { testLoc = testLoc.substring(testLoc.indexOf("://") + 3); if (testLoc.charAt(0) == "/") { testLoc = testLoc.substring(1); } testLoc = testLoc.substring(testLoc.indexOf("/")); } var hrefFolder = hrefString.substring(0, hrefString.lastIndexOf("/") + 1); var testFolder = testLoc.substring(0, testLoc.lastIndexOf("/") + 1); if (hrefFolder.toLowerCase() != testFolder.toLowerCase()) return false; // folder must match var hrefPage = hrefString.substring(hrefFolder.length); var testPage = testLoc.substring(testFolder.length); var hrefURLVars = ""; var testURLVars = ""; if (hrefPage.indexOf("?") >= 0) { hrefURLVars = hrefPage.substring(hrefPage.indexOf("?") + 1); hrefPage = hrefPage.substring(0, hrefPage.indexOf("?")); } if (testPage.indexOf("?") >= 0) { testURLVars = testPage.substring(testPage.indexOf("?") + 1); testPage = testPage.substring(0, testPage.indexOf("?")); } if (testPage == "#") testPage = hrefPage; if (hrefPage.toLowerCase() != testPage.toLowerCase()) return false; // file name must match var tVarArr = testURLVars.split("&"); var hrefURLVars = "&" + hrefURLVars + "&"; //all url vars in the link must be in the page url for (var n=0; n= 0) { return true; } } return false; }, addClassName: function(tElm, toAdd) { if (!this.hasClassName(tElm, toAdd)) { var tClassName = String(tElm.className); if (tClassName == "undefined") tClassName = ""; tClassName += ( (tClassName != "") ? " " : "" ) + toAdd; tElm.className = tClassName; } }, remClassName: function(tElm, toRem, toAdd) { if (this.hasClassName(tElm, toRem)) { var tClassName = String(tElm.className); if (tClassName == "undefined") tClassName = ""; var remPattns = this.getClassExpressions(toRem); for (var n=0; n