/* =================== /* Program : Functions of DHtml objects Version : 1.0 Author : Neil Yuming Kuo @ Jaby Group [http://jaby.heyxu.com] Website : http://match.heyxu.com/user/neil or http://neil.heyxu.com Email : neilbaby.k at gmail.com /* =================== */ function jaby_HtmlSelectClear(io,start){if(io==null)return;for(var l=io.length;l>start;l--){io.remove(l-1);}} function jaby_HtmlSelectFillByArray(io,iarray){if(iarray==null)return 0;if(iarray.length <1)return false;for(var l=0;l < iarray.length;l++){var w = iarray[l].split('|');var oOption = document.createElement('option');oOption.value = w[0]?w[0]:'';oOption.text = w[1]?w[1]:'';jaby_ElementAddChild(io,oOption);}} function jaby_HtmlSelectFulltextSearch(io,val){for(var l=0;l< io.length;l++)if(io[l].text.substr(0,val.length)==val)return l;return -1;} function jaby_HtmlSelectInsert(io,txt,val){var oOption = document.createElement('option');oOption.value = val;oOption.text = txt;return jaby_ElementAddChild(io,oOption);} function jaby_HtmlSelectInsertUni(io,txt,val){if(jaby_HtmlSelectSearchByValue(io,val)< 0)return jaby_HtmlSelectInsert(io,txt,val);return false;} function jaby_HtmlSelectMatchByValue(io,val){for(var l=0;l< io.length;l++){if(io[l].value==val){io[l].selected=true;io.style.backgroundColor = io[l].style.backgroundColor;return true;}}io.style.backgroundColor ='';io.selectedIndex = -1;return false;} function jaby_HtmlSelectRemoveByIdx(io,idx){return io.remove(idx);} function jaby_HtmlSelectRemoveByValue(io,val){for(var l=0;l< io.length;l++)if(io[l].value==val){io.remove(l);return true;}return false;} function jaby_HtmlSelectSearchByValue(io,val){for(var l=0;l< io.length;l++)if(io[l].value==val){return l;}return -1;} function jaby_HtmlSelectSerialize(io,sym){if(io==null)return;var str='';for(var l=0;l< io.length;l++){ds = l>0?sym:'';str += ds + io[l].value;}return str;} function jaby_HtmlSelectSwapNode(io,ipa,ipb){var val = io[ipa].value;var txt = io[ipa].text;io[ipa].value = io[ipb].value;io[ipa].text = io[ipb].text;io[ipb].value = val;io[ipb].text = txt;io.selectedIndex = ipb;} function jaby_HtmlSelectSwapNodeDown(io){if(io.selectedIndex>=io.length-1)return 0;jaby_HtmlSelectSwapNode(io,io.selectedIndex,io.selectedIndex+1);} function jaby_HtmlSelectSwapNodeUp(io){if(io.selectedIndex<1)return 0; jaby_HtmlSelectSwapNode(io,io.selectedIndex,io.selectedIndex-1);} function jaby_HtmlTableClear(io,start){if(io==null)return false;for(var l=io.rows.length;l>start;l--){io.deleteRow(l-1);}} function jaby_HtmlTableInsertTR(io,dat){if(io==null)return false;var a = io.insertRow(-1);for(var l=0;l