//============================= //Scripts for Mainmenu-Popup //============================= //Variable for popup-timer var vwcms_common_menu_close; var vwcms_common_menu_modindclose; //Variable for active highlight var vwcms_common_activeImage; //Variables for active gallery-Pic var vwcms_common_activeSmallPic; var isMac = (navigator.platform == "MacPPC"); //mainMenuConstructor function mainMenu(whichMenu,whichImg,offsrc,onsrc){ //creating mouseover-Images this.imgname = new Object(whichImg); this.imgname.createHiliteImages = createImgObjs; this.imgname.createHiliteImages(offsrc,onsrc); //reading arrays, writing four menus this.activeMenu = eval(whichMenu); this.imgPosChecked = 0; this.menuPos = 0; this.menuTop = 0; this.imgHeight = 0; this.menuWidth = 0; this.menuItemsListOne = ""; this.menuItemsListTwo = ""; this.menuItemsListThree = ""; this.menuItemsListFour = ""; this.menuItemsListFive = ""; this.menuItemsListSix = ""; this.completeMenuHTML = ""; for(var i = 0; i < this.activeMenu.length; i++) { if(i <= 6) { this.menuItemsListOne += this.activeMenu[i + 1] + this.activeMenu[i] + "
"; i = i + 1; } else if (i >= 8 && i <= 15) { this.menuItemsListTwo += this.activeMenu[i + 1] + this.activeMenu[i] + "
"; i = i + 1; } else if (i >= 16 && i <= 23) { this.menuItemsListThree += this.activeMenu[i + 1] + this.activeMenu[i] + "
"; i = i + 1; } else if (i >= 24 && i <= 31) { this.menuItemsListFour += this.activeMenu[i + 1] + this.activeMenu[i] + "
"; i = i + 1; } else if (i >= 32 && i <= 39) { this.menuItemsListFive += this.activeMenu[i + 1] + this.activeMenu[i] + "
"; i = i + 1; } else if (i >= 40 && i <= 47) { this.menuItemsListSix += this.activeMenu[i + 1] + this.activeMenu[i] + "
"; i = i + 1; } } if (this.menuItemsListOne) this.menuItemsListOne = "" + this.menuItemsListOne + ""; if (this.menuItemsListTwo) this.menuItemsListTwo = "" + this.menuItemsListTwo + ""; if (this.menuItemsListThree) this.menuItemsListThree = "" + this.menuItemsListThree + ""; if (this.menuItemsListFour) this.menuItemsListFour = "" + this.menuItemsListFour + ""; if (this.menuItemsListFive) this.menuItemsListFive = "" + this.menuItemsListFive + ""; if (this.menuItemsListSix) this.menuItemsListSix = "" + this.menuItemsListSix + ""; this.completeMenuHTML = "" + this.menuItemsListOne + this.menuItemsListTwo + this.menuItemsListThree + this.menuItemsListFour + this.menuItemsListFive + this.menuItemsListSix + "
"; } //show-function for mainmenu //args = name of menuset,Hilite-Toggle (1 = Hilite on, 0 = hilite off) function showMenu(whichMenu,whichPic) { //show new hilite resetHighlight(); if(whichPic == 0) showHighlight(whichMenu.imgname); //workaround mozilla menuwidth bug if(navigator.appVersion.indexOf("MSIE") != -1 && isMac != true){ document.getElementById("main_sub_container").style.width = 500 + "px"; } else{ document.getElementById("main_sub_container").style.width = "auto"; } //writing HTML content document.getElementById("main_sub_container").innerHTML = whichMenu.completeMenuHTML; document.getElementById("main_sub_container").style.display = "block"; //check img-position to get menu position if(whichMenu.imgPosChecked == 0) { whichMenu.menuPos = eval("document." + whichMenu.imgname + ".offsetLeft"); whichMenu.menuWidth = document.getElementById("main_sub_list").offsetWidth; var currWidth = whichMenu.menuPos + whichMenu.menuWidth; if(currWidth >= 780){ whichMenu.menuPos = (780 - whichMenu.menuWidth + 10); } else{ //left indent whichMenu.menuPos = whichMenu.menuPos + 6; } whichMenu.imgPosChecked = 1; } //positioning of menu document.getElementById("main_sub_container").style.width = whichMenu.menuWidth + "px"; document.getElementById("main_sub_container").style.left = whichMenu.menuPos + "px"; document.getElementById("main_sub_container").style.visibility = "visible"; //disable timeout window.clearTimeout(vwcms_common_menu_close); } function dropdown_mouseEnter() { window.clearTimeout(vwcms_common_menu_close); if(vwcms_common_menu_modindclose) clearTimeout(vwcms_common_menu_modindclose); } function dropdown_mouseLeave(whichMenu) { switch (whichMenu) { case 'main': vwcms_common_menu_close = window.setTimeout("menuCollapse()",50); break; case 'sr35_sub': vwcms_common_menu_close = window.setTimeout("sr35_submenuCollapse()",50); break; } } function showHighlight(menupic){ document.images[menupic].src = menupic.onimg.src; vwcms_common_activeImage = menupic; } function resetHighlight(){ if(vwcms_common_activeImage) document.images[vwcms_common_activeImage].src = vwcms_common_activeImage.offimg.src; } function menuCollapse(){ //reset highlight; resetHighlight(); //hide popup-menu window.clearTimeout(vwcms_common_menu_close); document.getElementById("main_sub_container").style.visibility="hidden"; document.getElementById("main_sub_container").style.display="none"; } //=============================== //image hilite without submenu-popup //============================== function subButton(whichImg,offsrc,onsrc){ this.imgname = new Object(whichImg); this.imgname.createHiliteImages = createImgObjs; this.imgname.createHiliteImages(offsrc,onsrc); } function showHigh(whichButton,whichPic){ if(whichPic == 0) document.images[whichButton.imgname].src = whichButton.imgname.onimg.src; } function resetHigh(whichButton,whichPic){ if(whichPic == 0 && vwcms_common_activeSmallPic != whichButton.imgname ) document.images[whichButton.imgname].src = whichButton.imgname.offimg.src; } //hilite-image method function createImgObjs(offsrc,onsrc,hisrc,midsrc,big800,big1024,big1280){ this.offimg = new Image(); if (typeof offsrc!="undefined" && offsrc.length!=0) { this.offimg.src = offsrc; } this.onimg = new Image(); if (typeof onsrc!="undefined" && onsrc.length!=0) { this.onimg.src = onsrc; } this.hiliteimg = new Image(); if (typeof hisrc!="undefined" && hisrc.length!=0) { this.hiliteimg.src = hisrc; } if(arguments.length > 3) { this.midimg = midsrc; this.big800 = big800; if(big1024) this.big1024 = big1024; if(big1280) this.big1280 = big1280; } } //=============================== //image object constructor submenu model index //============================== function createModelImgObjs(offsrc,onsrc){ this.offimg = new Image(); this.offimg.src = offsrc; this.onimg = new Image(); this.onimg.src = onsrc; } //========================================= // image popup //========================================= function showImagePopupSimple(pImageURL, pWidth, pHeight, pTitle) { if (!pImageURL) { return; } var windowFeatures = "toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no," + "width=" + pWidth + ",height=" + pHeight; if (!pTitle || pTitle=='') { pTitle = 'Volkswagen'; } var popup = window.open('', 'imagePopup', windowFeatures); if (popup) { popup.document.clear(); popup.focus(); popup.document.writeln('' + pTitle + ''); popup.document.writeln(''); popup.document.writeln('
'); popup.document.writeln(''); popup.document.writeln(''); popup.document.close(); popup.focus(); } } function showImagePopupUrl(pURL, pWidth, pHeight, pAltText) { if (!pURL) { return; } var offsetWidth = 30; var offsetHeight = 60; if (pAltText) { if (pAltText.length!=0) { offsetHeight += 30; } } var windowFeatures = "toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no," + "width=" + (pWidth + offsetWidth) + ",height=" + (pHeight + offsetHeight); var popup = window.open(pURL, 'imagePopup', windowFeatures); if (popup) { popup.focus(); } } // adds on load event 'function' to window on load handler function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } }