//************************************************************* // MouseOver Functions //************************************************************* function switchImage(strId,blnState){ //Purpose: Provides "mouseover" functionality for all menu // buttons on the CNP Solutions web site. //Accepts: strId - A page unique identifier for this rollover. // blnState - A boolean value indicating whether the button // is to be highlighted. //Returns: Nothing. var strImageName = (blnState) ? "_images/" + strId + "-1.gif" : "_images/" + strId + "-0.gif"; document.images[strId].src = strImageName; } //************************************************************* // Form Handling Functions //************************************************************* function clearField(strDefault,objField){ //Purpose: Clears the content of the passed form field when clicked // if the current content is the same as the passed string. //Accepts: strDefault - The default value of the form field as a string. // objField - An object reference to the form field to be cleared. //Returns: Nothing. if(objField.value == strDefault) objField.value = ""; } //************************************************************* // Window Handling Functions //************************************************************* var objPreview = null; function showImage(strImage,intWidth,intHeight){ //Purpose: Opens a window of the specified size, containing the passed image. //Accepts: strImage - The image file to display. // intWidth - The width of the window in pixels. // intHeight - The height of the window in pixels. //Returns: Nothing. var strURL = 'products_image.asp?name=' + strImage; var strFeature = 'width=' + intWidth + ',height=' + intHeight + ',top=100,left=100,scrollbars=no'; //Close the window if already open. closePopup(); //Open window and display image. objPreview = window.open(strURL,'Preview',strFeature); //Give the new window focus. setTimeout('objPreview.focus();',250); } function showPage(strURL,intWidth,intHeight){ //Purpose: Opens a window of the specified size, containing the passed page. //Accepts: strURL - The page to display. // intWidth - The width of the window in pixels. // intHeight - The height of the window in pixels. //Returns: Nothing. var strFeature = 'width=' + intWidth + ',height=' + intHeight + ',top=100,left=100,scrollbars=no'; //Close the window if already open. closePopup(); //Open window and display image. objPreview = window.open(strURL,'Preview',strFeature); //Give the new window focus. setTimeout('objPreview.focus();',250); } function closePopup(){ //Purpose: Closes the image preview popup window. //Accepts: Nothing. //Returns: Nothing. //Close the popup window if open. if(objPreview && objPreview.open) objPreview.close(); } //************************************************************* // Navigation Menu Functions //************************************************************* var strItemOverClass = "popupOver"; var strItemOutClass = "popupOff"; var intCurrentMenu = 0; var intActivityDelay = 5000; var objActivityTimer = null; var blnInactive = true; function itemOver(intMenu,intItem){ //Purpose: Highlights the menu item with the given id. //Accepts: intMenu - The id of the menu in which the above menu item resides. // intMenuItem - The id of the above menu item. //Returns: blnInactive - A boolean value indicating whether the menu is currently in use. //Set local variables. strMenuName = "popupmenu" + intMenu; strItemName = "popupmenu" + intMenu + "_" + intItem; strLinkName = strItemName + "_link"; //Clear the activity timer. clearTimeout(objActivityTimer); blnInactive = false; //Highlight the menu item. if(document.all){ document.all[strItemName].className = strItemOverClass; document.all[strLinkName].className = strItemOverClass; } else if(document.getElementById){ document.getElementById(strItemName).className = strItemOverClass; document.getElementById(strLinkName).className = strItemOverClass; } } function itemOut(intMenu,intItem){ //Purpose: Removes the highlight from the menu item with the given id. //Accepts: intMenu - The id of the menu in which the above menu item resides. // intMenuItem - The id of the above menu item. //Returns: blnInactive - A boolean value indicating whether the menu is currently in use. //Set local variables. strItemName = "popupmenu" + intMenu + "_" + intItem; strLinkName = strItemName + "_link"; //Remove the highlight from the menu item. if(document.all){ document.all[strItemName].className = strItemOutClass; document.all[strLinkName].className = strItemOutClass; } else if(document.getElementById){ document.getElementById(strItemName).className = strItemOutClass; document.getElementById(strLinkName).className = strItemOutClass; } //Start the activity timer. activityTimer(); blnInactive = true; } function menuOpen(intMenu,strMenuImage){ //Purpose: Opens the menu with the given id. //Accepts: intMenu - The id of the menu. //Returns: intCurrentMenu - Sets the id of the currently open menu. //Set local variables. strMenuName = "popupmenu" + intMenu; strCurrent = "popupmenu" + intCurrentMenu; //Clear the activity timer. clearTimeout(objActivityTimer); if(intCurrentMenu != 0 && intCurrentMenu != intMenu){ //Close all other menus. if(document.all) document.all[strCurrent].style.visibility = "hidden"; else if(document.layers) document.layers[strCurrent].visibility = "hide"; else if(document.getElementById) document.getElementById(strCurrent).style.visibility = "hidden"; } //Open the menu. if(document.all) document.all[strMenuName].style.visibility = "visible"; else if(document.layers) document.layers[strMenuName].visibility = "show"; else if(document.getElementById) document.getElementById(strMenuName).style.visibility = "visible"; //Change menu corner to straight. document.images["banner_right"].src = "_images/banner_rightStraight.gif"; document.images["banner_left"].src = "_images/banner_leftStraight.gif"; document.images["title"].src = "_images/title0.gif"; intCurrentMenu = intMenu; } function menuClose(intMenu){ //Purpose: Closes the menu with the given id. //Accepts: intMenu - The id of the menu. //Returns: intCurrentMenu - Sets the id of the currently open menu. if(intCurrentMenu != 0) { //If 0 is passed as a parameter, close the currently open menu. if(intMenu == 0) intMenu = intCurrentMenu; //Set local variables. strMenuName = "popupmenu" + intMenu; //Close the menu. if(document.all) document.all[strMenuName].style.visibility = "hidden"; else if(document.layers) document.layers[strMenuName].visibility = "hide"; else if(document.getElementById) document.getElementById(strMenuName).style.visibility = "hidden"; //Change menu corner to curve. document.images["banner_right"].src = "_images/banner_rightCurved.gif"; document.images["banner_left"].src = "_images/banner_leftCurved.gif"; document.images["title"].src = "_images/title" + strCurrentSection + ".gif"; intCurrentMenu = 0; } } function activityCheck(){ //Purpose: Close the currently opened menu if no activity is detected. //Accepts: Nothing. //Returns: Nothing. //Clear the activity timer. clearTimeout(objActivityTimer); //Close the menu. if(blnInactive && intCurrentMenu != 0) menuClose(intCurrentMenu); } function activityTimer(){ //Purpose: Starts a timer that calls the function activityCheck. //Accepts: Nothing. //Returns: Nothing. objActivityTimer = setTimeout("activityCheck();",intActivityDelay); }