var contentArray = new Array(); var letterArray = new Array(); var baseRef = window.top.location.href; //var baseRef = document.domain; var startDomain = baseRef.indexOf('.'); var endDomain = baseRef.indexOf('/',startDomain); var cookieDomain = baseRef.substring(startDomain, endDomain); //var cookieDomain = baseRef.substring(startDomain); //var cookieDomain = document.domain; //cookieDomain = cookieDomain.substring(startDomain); var recentCoNames = new Array(); var recentCoValues = new Array(); var storedCoNames = GetCookie("recentCoNames"); var storedCoValues = GetCookie("recentCoValues"); var lastUserName = GetCookie("lastUserName"); function toggleAdminView(imageId) { var toggleImage = document.getElementById(imageId); var imagePath = toggleImage.src.substring(0, (toggleImage.src.indexOf(imageId)+imageId.length)); var currentImage = toggleImage.src.substring(toggleImage.src.indexOf(imageId)+imageId.length); if(currentImage=="_off.gif") { imagePath = imagePath+"_on.gif"; MM_showHideLayers('customerView','','show'); } else { imagePath = imagePath+"_off.gif"; MM_showHideLayers('alphaResults','','hide','searchError','','hide','customerView','','hide') } toggleImage.src = imagePath; } function MM_findObj(n, d) { //v4.01 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'; var companyNamesContent = ""; var currentArray = contentArray[letterPosition]; var printName; var printValue; for(var i =0; i < currentArray.length; i++) { printName = currentArray[i][0].replace(/'/,"\\'"); printValue = currentArray[i][1].replace(/'/,"\\'"); companyNamesContent += '' + currentArray[i][0] + '
'; } /* for(var i =0; i < currentArray.length; i++) { companyNamesContent += '' + currentArray[i][0] + '
'; } */ document.getElementById('letterHead').innerHTML = letterHeadContent; document.getElementById('companyNames').innerHTML = companyNamesContent; } function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //Populate recentCoNames from cookie if(storedCoNames && storedCoNames!=null && storedCoNames.length>1) { var cookieCounter = 0; var commaIndex1 = storedCoNames.indexOf('|'); var commaIndex2 = storedCoValues.indexOf('|'); if(commaIndex1 < 0) { recentCoNames[cookieCounter] = storedCoNames; recentCoValues[cookieCounter] = storedCoValues; } else if(commaIndex1 == storedCoNames.length) { recentCoNames[cookieCounter] = storedCoNames.substring(0, commaIndex1-1); recentCoValues[cookieCounter] = storedCoValues.substring(0, commaIndex2-1); } else { while( (commaIndex1 > 0) && (commaIndex1 != (storedCoNames.length-1)) ) { recentCoNames[cookieCounter] = storedCoNames.substring(0, commaIndex1); recentCoValues[cookieCounter] = storedCoValues.substring(0, commaIndex2); storedCoNames = storedCoNames.substring(commaIndex1+1); storedCoValues = storedCoValues.substring(commaIndex2+1); while(storedCoNames.charAt(0)==' ')storedCoNames = storedCoNames.substring(1); while(storedCoValues.charAt(0)==' ')storedCoValues = storedCoValues.substring(1); cookieCounter++; commaIndex2 = storedCoValues.indexOf('|'); commaIndex1 = storedCoNames.indexOf('|'); } if(storedCoNames.length>0)recentCoNames[cookieCounter] = storedCoNames; if(storedCoValues.length>0)recentCoValues[cookieCounter] = storedCoValues; } } /* TEST LOOP */ //for(i=0; i < recentCoNames.length; i++){alert(recentCoValues[i]+' : '+recentCoNames[i]);} function changeCompany(companyId, companyName) { var endOfUrl = baseRef.indexOf("&CHANGE_COMPANY="); if(endOfUrl<5)endOfUrl = baseRef.length; var callRef = (baseRef.substring(0,endOfUrl))+"&CHANGE_COMPANY=" + escape(companyId); var coNameCookie = ""; var coValueCookie = ""; var duplicateCompany = false; for(i=0; i < recentCoValues.length; i++) { if(recentCoValues[i]==companyId) { duplicateCompany = true; break; } } if(duplicateCompany) { var tempNames = new Array(); var tempValues = new Array(); for(i=0; i < recentCoValues.length; i++) { if(recentCoValues[i]!=companyId) { tempNames.push(recentCoNames[i]); tempValues.push(recentCoValues[i]); } } recentCoNames = tempNames; recentCoValues = tempValues; } recentCoNames.push(companyName); recentCoValues.push(companyId); var storedCompanyCount = (recentCoNames.length>10)?9:(recentCoNames.length-1); for(i=storedCompanyCount; i>=0; i--) { if(recentCoNames[i]&&recentCoNames[i]!=null) { coNameCookie = coNameCookie+recentCoNames[i]+'| '; coValueCookie = coNameCookie+recentCoValues[i]+'| '; } } SetCookie("recentCoNames", coNameCookie, expiry, "/", cookieDomain, false); SetCookie("recentCoValues", coValueCookie, expiry, "/", cookieDomain, false); self.location = callRef; } function myCompanySearch(dynamicSearchField) { searchString = dynamicSearchField.value; if(!searchString||searchString.length<1) { alert('Search box is empty!'); return; } var coList1; var firstChar; var indexChar; var testStr; var tempStr; var groupList; var coResult; var isGroup = false; var groupId = 0; var matchCount = 0; searchString = searchString; firstChar = searchString.charAt(0); for(i=0; i < letterArray.length; i++) { indexChar = letterArray[i].charAt(0); if(firstChar.toLowerCase()==indexChar.toLowerCase()) { isGroup = true; groupId = i; break } if(!(isNaN(firstChar))&&!(isNaN(indexChar))) { isGroup = true; groupId = i; break } } if(isGroup) { groupList = contentArray[groupId]; searchLen = searchString.length; testStr = searchString; testStr = testStr.toLowerCase(); for(i=0; i=searchLen) { tempStr = tempStr.substring(0,searchLen).toLowerCase(); if(tempStr==testStr) { matchCount++; coResult = [groupList[i][1],groupList[i][0]]; } } } }//if(isGroup) if(isGroup&&matchCount==1)//pefrect match! { changeCompany(coResult[0], coResult[1]) } else if(isGroup)//partial match { populateCompanies(groupId); MM_showHideLayers('alphaResults','','show','customerView','','hide','searchError','','hide') // searchError } else//no match! { alert(searchString+' Not found'); } } // Derived from the Bill Dortch code at http://www.hidaho.com/cookies/cookie.txt var today = new Date(); var expiry = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); }