//---------------------------------------------------------------------------------------------------------------------------------------------------------- // ANIXTER.COM JAVASCRIPT LIBRARY // AUTHOR: Scott Finlayson & Sara Pollack // HISTORY: January 2005 - Code documentation (SLF) //---------------------------------------------------------------------------------------------------------------------------------------------------------- function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i'; } function returnFalse(s){ //guess the field if not supplied s = (s == null) ? document.forms[0].Query : s; //if you want to do the search, use this line doSearch(s); //if you want to alert the user, use this line //alert('Please use the \'Go!!\' button to do a search'); //this line should always be here!! return false; } // search function doSearch ( s ) { if (s.value != ''){ openDbRelativeURL("Search?searchview&Query=" + s.value + "&Count=30"); } } function openDbRelativeURL( url, target ){ //Check we have a target window; target = (target == null ) ? window : target; //Work out the path of the database; lcasepath = location.pathname.toLowerCase(); path = lcasepath.split('.nsf')[0] + '.nsf/'; target.location.href = path + url; } function newSwapArrow(arrowID, swapFromImage, swapToImage){ // Expandable & Collapsable Arrow Graphics for Request Information forms var imageString = document.getElementById(arrowID).src; var imageStringArray = imageString.split("/"); var gifName; for (var l = 0 ; l < imageStringArray.length ; l++){ if (imageStringArray[l].indexOf(".gif") > -1){ if (imageStringArray[l].indexOf("!") > -1){ gifName = imageStringArray[l].split("!") }else{ gifName = imageStringArray[l].split("?") } if (gifName[0] == swapFromImage){ imageStringArray[l] = swapToImage + "?OpenImageResource" }else{ imageStringArray[l] = swapFromImage + "?OpenImageResource" } } } var newImageString = imageStringArray.join("/"); document.getElementById(arrowID).src = newImageString; } function ToggleMenuwithArrow(arrowID, divName) { // Expandable & Collapsable options for Request Information forms toggleDIVMenu(divName); newSwapArrow(arrowID , "actn019.gif" , "actn019down.gif") } function divMenu(divName, divStatus) { // Expandable & Collapsable Menus for Left Hand Navigator document.getElementById(divName).style.display = divStatus; } function toggleDIVMenu(divName) { // Expandable & Collapsable Menus for Left Hand Navigator if (document.getElementById(divName).style.display == "none") { document.getElementById(divName).style.display = "block" } else { document.getElementById(divName).style.display = "none" } } function open_win(url) { window.open(url,'SecondWindow','width=550,height=550, menubar=yes,status=yes,location=yes,toolbar=no,scrollbars=yes'); } function Trim(s) { // Remove leading spaces and carriage returns while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')) { s = s.substring(1,s.length); } // Remove trailing spaces and carriage returns while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')) { s = s.substring(0,s.length-1); } return s; } function removeSpaces(string) { // Removes all spaces in a string. It is used to return a
or ID name which does not contain spaces in the name. var tstring = ""; string = '' + string; splitstring = string.split(" "); for(i = 0; i < splitstring.length; i++) tstring += splitstring[i]; return tstring; } function removeChar(string, punc) { // Removes specified character in a string. if(string.indexOf(punc)>=0){ alert(punc); var tstring = ""; string = '' + string; splitstring = string.split(punc); for(i = 0; i < splitstring.length; i++) tstring += splitstring[i]; return tstring; } } function replaceString(oldS,newS,fullS) {// Replaces oldS with newS in the string fullS for (var i=0; i=0){ sectionNameDIV.innerHTML = col_array[x].substring(tildaPos + 1, caratPos); } sectionNameDIV.innerHTML = sectionNameDIV.innerHTML.replace("+",""); break; } else { //alert(col_array[x].substring(tildaPos + 1, col_array[x].length) + " -- " + x); } } i++; } while (document.getElementById(sectionName + i) != null) } function dynamicTextTranslation(sectionName) { // This function initiates the overwriting of certain existing English text with the corresponding Translations tFieldName = document.getElementsByName("MainValues"); for (j=1; j <=20; j++) { if (tFieldName == null) { return; } replaceSectionName(sectionName, tFieldName[j-1]); } } //taken from cisco - testing var d=document; var ddSwitch = 0; // initializes menus set to off var yMousePos=0; var yMousePosMin=0; var yMousePosMax=0; function ddShow(menu){ d.getElementById(menu).style.display="block"; } function ddHide(menu){ d.getElementById(menu).style.display="none"; } function ddHideAll(){ var ddFound = ddFind(); for (i=0;i(yMousePos-yMousePosMin))){ /* checks if room to open down */ d.getElementById(menu).style.top="-1px"; } else { /* opens up */ d.getElementById(menu).style.top = (2-(d.getElementById(menu+'Box').offsetHeight + d.getElementById(menu).offsetHeight))+'px'; } ddHide(menu); d.getElementById(menu).style.left="0px"; } function ddToggle(menu, e){ /* kill further events */ e.cancelBubble=true; // assuming parent div is same as child minus 3 letter ext, set primary menu menu = menu.substring(0, (menu.length-3)); if (ddSwitch==0){ /* if menus were initially off */ ddDir(menu); ddShow(menu); ddSwitch=1; } else { /* if the menu was open, turn that menu off */ if (d.getElementById(menu).style.display=="block"){ ddHide(menu); ddSwitch=0; /* otherwise confirm/turn other menus off before displaying primary menu */ } else { ddHideAll(); ddDir(menu); ddShow(menu); ddSwitch=1; } } } window.size = function() { var w = 0; var h = 0; //IE if(!window.innerWidth) { //strict mode if(!(document.documentElement.clientWidth == 0)) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } //quirks mode else { w = document.body.clientWidth; h = document.body.clientHeight; } } //w3c else { w = window.innerWidth; h = window.innerHeight; } return {width:w,height:h}; }