/****************************************** * Common Scripts for KeyWord Selection (Single and Multiple) - WEBKeyWord-Selection.js * for iEnterprises, Inc - iExtensions CRM * by Shaji S http://shaji.go.to * Last update: Jan 2, 2003. ******************************************/ // Using Script Lib : WEBCommon.js // Using Global Variables - "Key" (the selection field name) // variable - isSingleSelection - used to identify whether single selection or multiple selection , from the passed // argument isSingle var Key = 0; var isSingleSelection = false; //=========================== function to open selection drop down function Key_Open(F,isSingle) { var VALS = eval("document.forms[0]." + F + "[0]"); if (VALS.type == "select-one") isSingleSelection = true; if (isSingle=="Single") isSingleSelection = true; if (Key==F) { //if already selected - hide drop down KOut2(); } else { if (Key!=0) { //if any other is selected - hide that KOut2(); } Key=F; //call function to show drop down Show_Key(); KOver(); var TIMER = setTimeout("KClose()",1000); // set Timer to close } } //===========================function to draw and show drop down function Show_Key() { var K=setdiv("K"+Key); K.height=19; //Start Message var M = "
Loading...
"; WriteDiv("K"+Key,M); K.visibility="visible"; //getting fields var VALS = eval("document.forms[0]." + Key + "[0]"); var F = eval("document.forms[0]." + Key + "[1]"); //Start var T = ""; for (i=0;i"; } else { T=T+"
"; } } else { if (F.value==VAL || F.value.indexOf(VAL + ",") != -1 || F.value.indexOf(", " + VAL) != -1 || F.value.indexOf("," + VAL) != -1) { T=T+"
"; } else { T=T+"
"; } } T=T+VALTEXT; T=T + "
"; if (i < 6 && i > 0) K.height=(i+1) * 18; } WriteDiv("K"+Key,T); } //===========================on selecting a value from the dropdown function Set_Key(K,i) { var VALS = eval("document.forms[0]." + Key + "[0]"); var F = eval("document.forms[0]." + Key + "[1]"); ENTRY = VALS.options[i]; if (ENTRY.value != "") VAL = ENTRY.value; else VAL = ENTRY.text; VALTEXT = ENTRY.text; if (isSingleSelection) { // if single section F.value = VAL; //close dropdown KOut2(); } else { var A = new Array(); A = ARRAY(F.value,",") if (K.selected) { A = REMOVE(A,VAL); K.selected = false; K.className = "KeyOptions"; } else { A = ADD(A,VAL); K.selected = true; K.className = "KeyOptions-Select"; } F.value = TEXT(A,", "); } } var img1=new Image;var img1a=new Image; img1="/iextensions/IENAddresses.nsf/BTN-Web.gif"; img1a="/iextensions/IENAddresses.nsf/BTN-Click.gif"; function KDown(K) { var KBTN=eval("document.BTN_" + K); var I=eval("img1a"); KBTN.src=I; } function KUp(K) { var KBTN=eval("document.BTN_" + K); var I=eval("img1"); KBTN.src=I; } //===========================to intialize keyword selection DHTML function Init_Key(K) { var VALS = eval("document.forms[0]." + K + "[0]"); VALS.style.display = 'none'; if (VALS.type == "select-one") { VALS.selectedIndex = -1; } else if (VALS.type == "select-multiple") { for (i=0;i" T=T+""; T=T+"
"; document.write(T); } //===========================drop down mouse over function KOver() { if (Key != 0) {var K=setdiv("K"+Key); K.isOn=true;} } //===========================drop down mouse out - close after a while function KOut() { if (Key != 0) {var K=setdiv("K"+Key); K.isOn=false;} var TIMER = setTimeout("KClose()",500); // set Timer to close } //===========================to close close drop down immediatly function KOut2() { if (Key != 0) {var K=setdiv("K"+Key); K.isOn=false;} KClose(); } //===========================close function function KClose() { if (Key != 0) { var K=setdiv("K"+Key); if (K.isOn!=true) { K.isOn=false; WriteDiv("K"+Key,""); KUp(Key); K.visibility="hidden"; Key=0; } } } //===========================