(function(){BMS.Utility={durationChanged:function(checkBoxEle){if(checkBoxEle.checked){$get("endDatePickerContainer").style.display="none";}else{$get("endDatePickerContainer").style.display="inline";}},formatRadioButton:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<input type='radio' name='"+sData+"' value='"+oRecord.getData("ID")+"' >";if(typeof oRecord.getData("secondID")!='undefined')
elCell.innerHTML+="<input type='hidden' name='hidden-"+oRecord.getData("number")+"' value='"+oRecord.getData("secondID")+"' >";elCell.style.textAlign="center";},formatFixedRadioButton:function(elCell,oRecord,oColumn){elCell.innerHTML="<input type='radio' name='selector' value='"+oRecord.getData("ID")+"' >";if(typeof oRecord.getData("secondID")!='undefined')
elCell.innerHTML+="<input type='hidden' name='hidden-"+oRecord.getData("number")+"' value='"+oRecord.getData("secondID")+"' >";elCell.style.textAlign="center";},formatCheckBox:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<input class='select_checkbox' type='checkbox' name='"+sData+"' value='"+oRecord.getData("ID")+"' >";if(typeof oRecord.getData("secondID")!='undefined')
elCell.innerHTML+="<input type='hidden' name='hidden-"+oRecord.getData("number")+"' value='"+oRecord.getData("secondID")+"' >";elCell.style.textAlign="center";},formatUrl:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<a href='"+oRecord.getData("clickUrl")+"'>"+sData+"</a>";elCell.style.textAlign="right";},formatEditLink:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<a title='"+BMS.labels["edit"]+"' href='"+oRecord.getData("editLink")+"'><img alt='"+BMS.labels["edit"]+"' border='0' src='"+BMS.Config.$imgpath+"/icon/but_edit.png'></a>";elCell.style.textAlign="center";},formatDeleteLink:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<a title='"+BMS.labels["delete"]+"' href='"+oRecord.getData("deleteLink")+"'><img alt='"+BMS.labels["delete"]+"' border='0' src='"+BMS.Config.$imgpath+"but_delete.png'></a>";elCell.style.textAlign="center";},formatDeleteButton:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<img alt='"+BMS.labels["delete"]+"' border='0' src='"+BMS.Config.$imgpath+"but_delete.png' onClick='"+oRecord.getData("deleteButton")+"'>";elCell.style.textAlign="center";},formatText:function(elCell,oRecord,oColumn,sData){elCell.innerHTML=sData;elCell.style.textAlign=floating;},formatDate:function(elCell,oRecord,oColumn,sData){date=sData.split("-");elCell.innerHTML=BMS.labels["day-"+date[3]]+" "+date[2]+"/"+BMS.labels["month-"+date[1]]+"/"+date[0];elCell.style.textAlign="center";},formatImage:function(elCell,oRecord,oColumn,sData)
{if(sData==null)
{elCell.innerHTML="<img  border='0' size=20 src='"+BMS.Config.$filepath+"nopic3.jpg'/>";elCell.style.textAlign="center";}
else
{elCell.innerHTML="<img  border='0' src='"+BMS.Config.$filepath+sData+"'/>";elCell.style.textAlign="center";}},formatStatus:function(elCell,oRecord,oColumn,sData){elCell.innerHTML="<a href='#' onClick='changeStatus(\""+oRecord.getData("statusLink")+"\",\""+oRecord.getData("status")+"\");return false;'><img id='img-"+oRecord.getData("status")+"' border='0' src='"+BMS.Config.$imgpath+((sData=="1"||sData=="2")?"icon/but_stat_ok":"icon/but_stat_no")+".png'></a>";elCell.style.textAlign="center";},getScript:function(url,succ_callback,fail_callback){if(succ_callback==undefined){var succ_callback=$THIS.onSuccessGetScript;}else{var succ_callback=succ_callback;}
if(fail_callback==undefined){var fail_callback=$THIS.onFailureGetScript;}else{var fail_callback=fail_callback;}
YAHOO.util.Get.script(url,{onSuccess:succ_callback,onFailure:fail_callback})},onSuccessGetScript:function(success){BMS.CurrentDataTable=BMS.DataTable.getDataTable();return true;},onFailureGetScript:function(error){},getCss:function(url,succ_callback,fail_callback){if(succ_callback==undefined){var succ_callback=$THIS.onSuccessGetCss;}else{var succ_callback=succ_callback;}
if(fail_callback==undefined){var fail_callback=$THIS.onFailureGetCss;}else{var fail_callback=fail_callback;}
YAHOO.util.Get.css(url,{onSuccess:succ_callback,onFailure:fail_callback})},onSuccessGetCss:function(success){},onFailureGetCss:function(error){},checkDataTableScript:function(){var data_table_scripts=[];var data_table_css=[];if(data_table_scripts.length==0){data_table_scripts=[BMS.Config.$jslibpath+'yui/build/yuiloader/yuiloader-min.js',BMS.Config.$jslibpath+'yui/build/datasource/datasource-min.js',BMS.Config.$jslibpath+'yui/build/dragdrop/dragdrop-min.js',BMS.Config.$jslibpath+'yui/build/element/element-beta-min.js',BMS.Config.$jslibpath+'yui/build/datatable/datatable-min.js',BMS.Config.$jslibpath+'yui/build/button/button-min.js',BMS.Config.$jslibpath+'yui/build/paginator/paginator-min.js'];$THIS.getScript(data_table_scripts);}
if(data_table_css.length==0){data_table_css=[BMS.Config.$jslibpath+'yui/build/datatable/assets/skins/sam/datatable.css'];$THIS.getCss(data_table_css);}},checkCalendarScript:function(){var calendar_scripts=[];var calendar_css=[];if(calendar_scripts.length==0){calendar_scripts=[BMS.Config.$jslibpath+'DHTMLCalendarWidget/jalali.js',BMS.Config.$jslibpath+'DHTMLCalendarWidget/calendar.js',BMS.Config.$jslibpath+'DHTMLCalendarWidget/calendar-setup.js',BMS.Config.$jslibpath+'DHTMLCalendarWidget/lang/calendar-fa.js'];$THIS.getScript(calendar_scripts,$THIS.getCalendarScriptSucc,$THIS.getCalendarScriptFailure);}
if(calendar_css.length==0){calendar_css=[BMS.Config.$jslibpath+'DHTMLCalendarWidget/skins/aqua/theme.css'];$THIS.getCss(calendar_css);}
return true;},getCalendarScriptSucc:function(succ){for(var c in BMS.Calendars){Calendar.setup({inputField:BMS.Calendars[c],button:"date_btn_"+BMS.Calendars[c],ifFormat:"%Y-%m-%d",dateType:'jalali',weekNumbers:true});}},getCalendarScriptFailure:function(error){},checkDataTableArratFill:function(){if(BMS.datatableColumnsDefs){}},changeRole:function(p_sType,p_aArgs,p_oItem){var query_string=p_oItem.value.url;var role=p_oItem.value.rolenum;var url=BMS.Config.$basepath+'?'+query_string+role;window.location=url;},changeUrl:function(url){window.location=url;},showWaitPanel:function(){if(!$THIS.getGlobal('wait_container')){if($get('wait_container')){var myPanel=new YAHOO.widget.Panel("wait_container",{width:"240px",fixedcenter:false,close:false,draggable:false,zindex:4,modal:true,visible:false});myPanel.setHeader("<div style='width:100%;' align='right' dir='rtl'>"+BMS.labels["loading"]+"<div>");myPanel.setBody('<img src="'+BMS.Config.$imgpath+'cpanel/loading.gif" />');$THIS.setGlobal('wait-panel',myPanel);myPanel.render();myPanel.show();clearTimeout(check_available);}else{var check_available=setTimeout($THIS.showWaitPanel,200);}}else{$THIS.hideWaitPanel();}},hideWaitPanel:function(){var myPanel=$THIS.getGlobal('wait-panel');if(myPanel){myPanel.hide();$THIS.removeGlobal('wait-panel');}else{var checkMyPanelAvailable=setTimeout($THIS.hideWaitPanel,200);}},showCustomPanel:function(panel){if($THIS.getGlobal('custom-panel-container')){$THIS.removeGlobal('custom-panel-container');}
var header=panel.header||'BMS Packing Industrial Co';var body=panel.body||'Body';var footer=panel.footer||'<div style="color:#000000">'+BMS.labels["prjName"]+'</div>';var _div=$ce('div');_div.id='custom-panel-container';document.body.appendChild(_div);var myPanel=new YAHOO.widget.Panel("custom-panel-container",{width:panel.width,height:panel.height,fixedcenter:true,close:panel.close,draggable:panel.draggable,zindex:4,modal:panel.modal,visible:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.50}});myPanel.setHeader(header);myPanel.setBody(body);myPanel.setFooter(footer);$THIS.setGlobal('custom-panel-container',myPanel);myPanel.render();myPanel.show();},hideCustomPanel:function(){var myPanel=$THIS.getGlobal('custom-panel-container');if(myPanel){myPanel.hide();$THIS.removeGlobal('custom-panel-container');}},setGlobal:function(key,param){var item=[];item[key]=param;BMS.GlobalItems.push(item);},getGlobal:function(key){if(BMS.GlobalItems){for(var i=0;i<BMS.GlobalItems.length;i++){for(key in BMS.GlobalItems[i]){return BMS.GlobalItems[i][key];}}}else{return false;}},removeGlobal:function(){if(BMS.GlobalItems){for(var i=0;i<BMS.GlobalItems.length;i++){for(key in BMS.GlobalItems[i]){BMS.GlobalItems.splice(i,1);return false;}}}else{return false;}},getSplitButton:function(inputID,selectID,label){var oSplitButton=new YAHOO.widget.Button(inputID,{type:"menu",menu:selectID,label:label});return oSplitButton;},_onMenuItemClick:function(p_sType,p_aArgs,p_oItem){oMenuButton.set("label",p_oItem.cfg.getProperty("text"));},getMenuButton:function(label,name,container,menu){var oMenuButton=new YAHOO.widget.Button({type:"menu",label:label,name:name,menu:menu,container:container});},succGetPageContent:function(){pageContent();},failureGetPageContent:function(){},request_sender:function(url,succCallback,failureCallback){YAHOO.util.Connect.asyncRequest('GET',url,callback,null);var callback={success:succCallback,failure:failureCallback};},showPopup:function(url,name,width,height,left,top){var width=width||"500";var height=height||"600";var left=left||"200";var top=top||"100";var newwindow=window.open(url,name,'width='+width+',height='+height+',left='+left+',top='+top+',scrollbars=1');if(window.focus){if(newwindow){newwindow.focus();}}
return newwindow;}}
var $THIS=BMS.Utility;})();(function(){window.$get=function $get(a){return document.getElementById(a);};window.$ce=function $ce(el){return document.createElement(el);};window.$ct=function $ct(text){return document.createTextNode(text);};})();