function initSelectItem(ele,str,emptyItem){$(ele).empty();if(typeof str=="string"){var ary=str.split(",");}else{var ary=str;}if(emptyItem==true)$("<option value=''>－－请选择－－</option>").appendTo(ele);for(var i in ary){if(typeof ary[i]=="string")$("<option value='"+ary[i]+"'>"+ary[i]+"</option>").appendTo(ele);}}
function insertMulSelect(eleAry,str,val){for(var i=0;i<eleAry.length;i++){initSelectItem(eleAry[i],str,true,val);}}
function initCascadeSelect(parentId,subId,ary,defaultEmptyValue){defaultEmptyValue=typeof defaultEmptyValue=='undefined'?"－－请选择－－":defaultEmptyValue;$(parentId).change(function(){$('option:selected',this).each(function(){if(this.value!=''){initSelectItem(subId,ary[this.value],false);}else{initSelectItem(subId,[],true);}});});}