var _cell_select;function cell_select(){this.css_row_off='tablerow1';this.css_row_on='tablerow2selected';this.row_tr_id='arow';this.row_checkbox_id='acid';this.toggle_all_name='cellselect-cball';this.toggle_all_id='';this.toggle_all_flag=0;this.selected_ids=new Array();this.total_ids=0;this.store_css_row=new Array();};cell_select.prototype.init=function(){try{this.toggle_all_id=document.getElementById(this.toggle_all_name);this.toggle_all_flag=1;this.toggle_all_id.checked=false;}catch(error){this.toggle_all_flag=0;}var checkboxes=document.getElementsByTagName('INPUT');_cell_select=this;for(var i=0;i<checkboxes.length;i++){try{if(!checkboxes[i].id){continue;}if(checkboxes[i].getAttribute('type')!='checkbox'){continue;}}catch(error){continue;}var cbid=checkboxes[i].id;var cbname=cbid.replace( /^(.*)-(\d+)$/,"$1");var cbnum=this.get_id_from_text(checkboxes[i].id);if(cbname==this.row_checkbox_id){if(checkboxes[i].getAttribute('checked')||checkboxes[i].checked){this.row_change_color(cbnum);this.selected_ids[cbnum]=1;this.total_ids++;}else{this.selected_ids[cbnum]=0;this.total_ids++;}}}};cell_select.prototype.row_toggle_all=function(){if(!this.toggle_all_flag){return;}var checkstate=this.toggle_all_id.checked;var checkboxes=document.getElementsByTagName('INPUT');for(var i=0;i<checkboxes.length;i++){try{if(!checkboxes[i].id){continue;}if(checkboxes[i].getAttribute('type')!='checkbox'){continue;}}catch(error){continue;}var cbid=checkboxes[i].id;var cbname=cbid.replace( /^(.*)-(\d+)$/,"$1");var cbnum=this.get_id_from_text(checkboxes[i].id);if(cbname==this.row_checkbox_id){checkboxes[i].checked=checkstate;this.selected_ids[cbnum]=checkstate?0:1;this.row_change_color(cbnum);this.selected_ids[cbnum]=checkstate?1:0;}}};cell_select.prototype.row_clicked=function(row_id){this.row_change_color(row_id);this.selected_ids[row_id]=(this.selected_ids[row_id])?0:1;if(this.toggle_all_flag){var c=0;for(var i in this.selected_ids){if(this.selected_ids[i]){c++;}}if(c!=this.total_ids){this.toggle_all_id.checked=false;}else{this.toggle_all_id.checked=true;}}};cell_select.prototype.row_change_color=function(row_id){var tds=document.getElementById(this.row_tr_id+'-'+row_id).getElementsByTagName('TD');var _cell=(this.store_css_row[row_id])?this.store_css_row[row_id]:this.css_row_off;for(var i=0;i<tds.length;i++){tds[i].className=(this.selected_ids[row_id])?_cell:this.css_row_on;}};cell_select.prototype.get_id_from_text=function(id){return id.replace( /.*(?:\-|_)(\d+)/,"$1");};
