
Runner.controls.constants={FORMAT_NONE:'',FORMAT_DATE_SHORT:"Short Date",FORMAT_DATE_LONG:"Long Date",FORMAT_DATE_TIME:"Datetime",FORMAT_TIME:"Time",FORMAT_CURRENCY:"Currency",FORMAT_PERCENT:"Percent",FORMAT_HYPERLINK:"Hyperlink",FORMAT_EMAILHYPERLINK:"Email Hyperlink",FORMAT_FILE_IMAGE:"File-based Image",FORMAT_DATABASE_IMAGE:"Database Image",FORMAT_DATABASE_FILE:"Database File",FORMAT_FILE:"Document Download",FORMAT_LOOKUP_WIZARD:"Lookup wizard",FORMAT_PHONE_NUMBER:"Phone Number",FORMAT_NUMBER:"Number",FORMAT_HTML:"HTML",FORMAT_CHECKBOX:"Checkbox",FORMAT_MAP:"Map",FORMAT_CUSTOM:"Custom",EDIT_FORMAT_NONE:"",EDIT_FORMAT_TEXT_FIELD:"Text field",EDIT_FORMAT_TEXT_AREA:"Text area",EDIT_FORMAT_RTE:"RTE",EDIT_FORMAT_RTEINNOVA:"RTEINNOVA",EDIT_FORMAT_RTECK:"RTECK",EDIT_FORMAT_PASSWORD:"Password",EDIT_FORMAT_DATE:"Date",EDIT_DATE_SIMPLE:0,EDIT_DATE_SIMPLE_DP:11,EDIT_DATE_DD:12,EDIT_DATE_DD_DP:13,EDIT_FORMAT_TIME:"Time",EDIT_FORMAT_RADIO:"Radio button",EDIT_FORMAT_CHECKBOX:"Checkbox",EDIT_FORMAT_DATABASE_IMAGE:"Database image",EDIT_FORMAT_DATABASE_FILE:"Database file",EDIT_FORMAT_FILE:"Document upload",EDIT_FORMAT_LOOKUP_WIZARD:"Lookup wizard",EDIT_FORMAT_HIDDEN:"Hidden field",EDIT_FORMAT_READONLY:"Readonly",LCT_DROPDOWN:0,LCT_AJAX:1,LCT_LIST:2,LCT_CBLIST:3,LT_LISTOFVALUES:0,LT_LOOKUPTABLE:1,MODE_ADD:0,MODE_EDIT:1,MODE_SEARCH:2,MODE_LIST:3,MODE_PRINT:4,MODE_VIEW:5,MODE_INLINE_ADD:6,MODE_INLINE_EDIT:7,MODE_EXPORT:8};Runner.namespace('Runner.util.IEHelper');Runner.util.IEHelper.iframe=function(cfg){var cfg=cfg||{},id;if(cfg.constructor===Object){cfg.w=cfg.w||0,cfg.h=cfg.h||0,cfg.t=cfg.t||0,cfg.l=cfg.l||0,id=cfg.id||Runner.genId();}else{var el=cfg;id=Runner.genId();}
var iframe=$('#'+id);if(!iframe.length){$(document).find('body').append('<iframe src="javascript:false;" id="'+id+'" frameborder="1" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="background:white;position:absolute;display:block;opacity:0;filter:alpha(opacity=0);"></iframe>');iframe=$('#'+id);}
var iframeObj={move:function(t,l){if(t!==undefined&&l!==undefined){iframe.css('top',t+'px').css('left',l+'px');}
return this;},destroy:function(){iframe.remove();return this;},resize:function(w,h){if(w!==undefined&&h!==undefined){iframe.css('height',h).css('width',w);}
return this;},hide:function(){iframe.hide();return this;},show:function(){iframe.show();return this;},reset:function(coors){coors=coors||this.getPos()||cfg;this.move(coors.t,coors.l).resize(coors.w,coors.h).show();Runner.getZindex(iframe);return this;},getPos:function(){if(!el){this.getPos=function(){return false;}}else{this.getPos=function(){var posObj=getAbsolutePosition(el),coors={};coors.w=el.offsetWidth,coors.h=el.offsetHeight,coors.t=posObj.t,coors.l=posObj.l;return coors;}}
this.getPos();}}
return iframeObj.reset();}
Runner.util.IEHelper.selectsHider=function(el){var selToHide=[],elem=el;return{checkIntersection:function(selCoors,elCoors){if((Math.abs((elCoors.x-selCoors.x))<=(elCoors.w+selCoors.w)/2)&&(Math.abs((elCoors.y-selCoors.y))<=(elCoors.h+selCoors.h)/2)){return true;}},getCenter:function(coors){coors.x=coors.l+coors.w/2;coors.y=coors.t+coors.h/2;return coors;},hideSels:function(){for(var i=0;i<selToHide.length;i++){$(selToHide[i]).hide();}
return this;},showSels:function(){for(var i=0;i<selToHide.length;i++){$(selToHide[i]).show();}
return this;},getSelects:function(elPos){var elCoors=elPos||{},selToCheck=$('select');selToHide=[];if(!elPos){var pos=findPos(el);elCoors.l=pos[0];elCoors.t=pos[1];elCoors.w=el.offsetWidth;elCoors.h=el.offsetHeight;}
elCoors=this.getCenter(elCoors);var coors={};for(var i=0;i<selToCheck.length;i++){pos=findPos(selToCheck[i]);coors.l=pos[0];coors.t=pos[1];coors.w=selToCheck[i].offsetWidth;coors.h=selToCheck[i].offsetHeight;coors=this.getCenter(coors);if(this.checkIntersection(coors,elCoors)){selToHide.push(selToCheck[i]);}}
return selToHide;}}}
Runner.Event=Runner.extend(Runner.emptyFn,{events:null,listeners:null,elemsForEvent:null,suspendedEvents:null,constructor:function(){this.listeners=[];this.elemsForEvent=[];this.suspendedEvents=[];},init:function(){if(this.events.length==0){return false;}
for(var i=0;i<this.events.length;i++){if(typeof this[this.events[i]]=="function"){this.on(this.events[i],this[this.events[i]]);}else if(typeof this[this.events[i]]=="object"){this.on(this.events[i],this[this.events[i]].fn,this[this.events[i]].options,this[this.events[i]].scope);}}
return true;},suspendEvent:function(eventArr){for(var i=0;i<eventArr.length;i++){if(!this.suspendedEvents.isInArray(eventArr[i])){this.suspendedEvents.push(eventArr[i]);}}},resumeEvent:function(eventArr){var eventInd=-1;for(var i=0;i<eventArr.length;i++){eventInd=this.suspendedEvents.getIndexOfElem(eventArr[i]);if(eventInd!=-1){this.suspendedEvents.splice(eventInd,1);}}},createDelayed:function(handler,timeout){return function(e){setTimeout(function(){handler(e);},timeout||10);};},createBuffered:function(handler,buffer){var task=new Runner.util.DelayedTask(handler);return function(e){task.delay(buffer,handler,null,[e]);};},createSingle:function(handler,eventName){var obj=this;return function(e){handler(e);if(e){obj.unbindHn(eventName,e.data.hn);}};},bindHn:function(eventName,callHandler){if(!callHandler||!eventName){return false;}
var el;for(var i=0;i<this.elemsForEvent.length;i++){el=this.elemsForEvent[i];$(el).bind(eventName,{hn:callHandler,obj:this},callHandler);}
return true;},unbindHn:function(eventName,callHandler){if(!callHandler||!eventName){return false;}
var el;for(var j=0;j<this.elemsForEvent.length;j++){el=this.elemsForEvent[j];$(el).unbind(eventName,callHandler);}
return true;},on:function(eventName,fn,options,scope){if(!this.elemsForEvent.length||!fn){return false;}
eventName=eventName.toLowerCase();this.addEvent([eventName]);var onEventName="";if(eventName.indexOf("on",0)==0){onEventName=eventName;eventName=eventName.substring(2);}else{onEventName="on"+eventName;}
var scope=scope?scope:this,objScope=this,options=options?options:{};var args=options.args?options.args:[],single=options.single?options.single:false,timeout=options.timeout?options.timeout:0,buffer=options.buffer?options.buffer:0;var callHandler=function(e){if(objScope.suspendedEvents.isInArray(eventName)){return;}
fn.apply(scope,[e].concat(args));}
if(timeout){callHandler=this.createDelayed(callHandler,timeout);}
if(single){callHandler=this.createSingle(callHandler,eventName)}
if(buffer){callHandler=this.createBuffered(callHandler,buffer);}
this.listeners.push({name:eventName,handler:fn,callHandler:callHandler,options:options,scope:scope,index:this.listeners.length});this.bindHn(eventName,callHandler);return true;},addEvent:function(eventNameArr){if(!this.events){this.events=[];}
this.addEvent=function(eventNameArr){for(var i=0;i<eventNameArr.length;i++){if(!this.events.isInArray(eventNameArr[i])){this.events.push(eventNameArr[i]);}}}
this.addEvent(eventNameArr);},killEvent:function(eventName){var eventInd=this.isDefinedEvent(eventName);if(eventInd==-1){return false;}
this.clearEvent(eventName);this.unbindHn(eventName,this[eventName]);delete this[eventName];this.events.splice(eventInd,1);return true;},purgeListeners:function(){for(var i=0;i<this.events.length;i++){this.killEvent(this.events[i]);}},clearEvent:function(eventName){var listeners=this.getListeners(eventName);for(var i=0;i<listeners.length;i++){this.unbindHn(eventName,listeners[i].callHandler);this.listeners.splice(i,1);}
return true;},stopEvent:function(e){this.stopPropagation(e);this.preventDefault(e);},stopPropagation:function(e){e=this.getEvent(e);if(e&&e.stopPropagation){e.stopPropagation();}else if(e){e.cancelBubble=true;}},preventDefault:function(e){e=this.getEvent(e);if(e&&e.preventDefault){e.preventDefault();}else if(e){e.returnValue=false;}},getEvent:function(e){return e||window.event;},getTarget:function(e){if(e){return e.target||e.srcElement;}},fireEvent:function(eventName){var listeners=this.getListeners(eventName);for(var i=0;i<listeners.length;i++){listeners[i].callHandler.apply(this,[null].concat(Array.prototype.slice.call(arguments,1)));}
if(this[eventName]){this[eventName].apply(this,[null].concat(Array.prototype.slice.call(arguments,1)));}},isDefinedEvent:function(eventName){return this.events.getIndexOfElem(eventName);},getListeners:function(eventName){var listeneresArr=[];for(var i=0;i<this.listeners.length;i++){if(this.listeners[i].name==eventName){listeneresArr.push(this.listeners[i]);}}
return listeneresArr;}});validation={validatorConsts:{predefined:1,user:2,notFound:3},userValidators:[],predefinedValidatorsArr:['isrequired','isnumeric','ispassword','isemail','ismoney','iszipcode','isphonenumber','isstate','isssn','iscc','istime','isdate','regexp'],arrStates:['AL','AK','AS','AZ','AR','CA','CO','CT','DE','DC','FM','FL','GA','GU','HI','ID','IL','IN','IA','KS','KY','LA','ME','MH','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','MP','OH','OK','OR','PW','PA','PR','RI','SC','SD','TN','TX','UT','VT','VI','VA','WA','WV','WI','WY'],validate:function(validArr,control){var validationRes=false,validatorStatus,result={result:true,messageArr:[]};for(var i=0;i<validArr.length;i++){if(!validArr[i]){continue;}
validatorStatus=this.getValidatorStatus(validArr[i]);if(validatorStatus==this.validatorConsts.user){validationRes=window[control.validationArr[i]](control.getValue());}else if(validatorStatus==this.validatorConsts.predefined){if(validArr[i]=="IsRequired"){if(control.isEmpty()){validationRes=Runner.lang.constants.TEXT_INLINE_FIELD_REQUIRED;}else{validationRes=true;}}else{validationRes=this[validArr[i]](control.getValue(),control.regExp);}}else{validationRes=true;}
result=this.setResult(validationRes,result);}
return result;},getValidatorStatus:function(validatorName){if(this.predefinedValidatorsArr.isInArray(validatorName)){return this.validatorConsts.predefined;}else if(window[validatorName]&&((typeof(window[validatorName])=='function')||(Runner.isIE&&typeof(window[validatorName])=='object'))){return this.validatorConsts.user;}else{return this.validatorConsts.notFound;}},setResult:function(res,obj){var len=obj.messageArr.length;if(res!==true){obj.result=false;if(typeof(res)=='object'){for(var i=0;i<res.length;i++){obj.messageArr.push(res[i]);}}else{obj.messageArr.push(res);}}
return obj;},registerCustomValidation:function(ctrl){var validatorStatus;for(var i=0;i<ctrl.validationArr.length;i++){if(!ctrl.validationArr[i]){continue;}
validatorStatus=this.getValidatorStatus(ctrl.validationArr[i]);if(validatorStatus==this.validatorConsts.user||validatorStatus==this.validatorConsts.notFound){var isAdded=false;for(var j=0;j<this.userValidators.length;j++){if(this.userValidators[j]==ctrl.validationArr[i]){isAdded=true;break;}}
if(!isAdded){Runner.loadJS('include/validate/'+ctrl.validationArr[i]+'.js');this.userValidators.push(ctrl.validationArr[i]);}}}},"IsRequired":function(sVal)
{var regexp=/.+/;if(typeof(sVal)!='string')
sVal=sVal.toString();if(!sVal.match(regexp)&&!this.setRequired)
{this.setRequired=true;return Runner.lang.constants.TEXT_INLINE_FIELD_REQUIRED;}
else
return true;},"IsNumeric":function(sVal)
{sVal=sVal.replace(/,/g,"");if(isNaN(sVal))
return Runner.lang.constants.TEXT_INLINE_FIELD_NUMBER;else
return true;},"IsPassword":function(sVal)
{var regexp1=/^password$/;var regexp2=/.{4,}/;if(sVal.match(regexp1))
return Runner.lang.constants.TEXT_INLINE_FIELD_PASSWORD1;else if(!sVal.match(regexp2))
return Runner.lang.constants.TEXT_INLINE_FIELD_PASSWORD2;else
return true;},"IsEmail":function(sVal)
{var regexp=/^[A-z0-9_-]+([.][A-z0-9_-]+)*[@][A-z0-9_-]+([.][A-z0-9_-]+)*[.][A-z]{2,4}$/;if(sVal.match(/.+/)&&!sVal.match(regexp))
return Runner.lang.constants.TEXT_INLINE_FIELD_EMAIL;else
return true;},"IsMoney":function(sVal)
{var regexp=/^(\d*)\.?(\d*)$/;if(sVal.match(/.+/)&&!sVal.match(regexp))
return Runner.lang.constants.TEXT_INLINE_FIELD_CURRENCY;else
return true;},"IsZipCode":function(sVal)
{var regexp=/^\d{5}([\-]\d{4})?$/;if(sVal.match(/.+/)&&!sVal.match(regexp))
return Runner.lang.constants.TEXT_INLINE_FIELD_ZIPCODE;else
return true;},"IsPhoneNumber":function(sVal)
{var regexp=/^\(\d{3}\)\s?\d{3}\-\d{4}$/;var stripped=sVal.replace(/[\(\)\.\-\ ]/g,'');if(sVal.match(/.+/)&&(isNaN(parseInt(stripped))||stripped.length!=10))
return Runner.lang.constants.TEXT_INLINE_FIELD_PHONE;else
return true;},"IsState":function(sVal)
{if(sVal.match(/.+/)&&!this.arrStates.isInArray(sVal))
return Runner.lang.constants.TEXT_INLINE_FIELD_STATE;else
return true;},"IsSSN":function(sVal)
{var regexp=/^\d{3}(-|\s)\d{2}(-|\s)\d{4}$/;if(sVal.match(/.+/)&&!sVal.match(regexp))
return Runner.lang.constants.TEXT_INLINE_FIELD_SSN;else
return true;},"IsCC":function(sVal)
{var regexp=/^((4\d{3})|(5[1-5]\d{2}))(-?|\040?)(\d{4}(-?|\040?)){3}|^(3[4,7]\d{2})(-?|\040?)\d{6}(-?|\040?)\d{5}/;if(sVal.match(/.+/)&&!sVal.match(regexp))
return Runner.lang.constants.TEXT_INLINE_FIELD_CC;else
return true;},"IsTime":function(sVal)
{var regexp=/\d+/g;if(!sVal)
return true;var arr=sVal.match(regexp);var bFlag=true;if(arr==null||arr.length>3)
bFlag=false;while(bFlag&&arr.length<3)
arr[arr.length]=0;if(bFlag&&(arr[0]<0||arr[0]>23||arr[1]<0||arr[1]>59||arr[2]<0||arr[2]>59))
bFlag=false;if(!bFlag)
return Runner.lang.constants.TEXT_INLINE_FIELD_TIME;else
return true;},"IsDate":function(sVal)
{var fmt="";switch(locale_dateformat){case 0:fmt="MDY";break;case 1:fmt="DMY";break;default:fmt="YMD";break;};if(!this.isValidDate(sVal,fmt)){return Runner.lang.constants.TEXT_INLINE_FIELD_DATE;}else{return true;}},"RegExp":function(sVal,regExpParamsObj){var re=new RegExp(regExpParamsObj.regex);if(sVal.length!=0&&(!re.test(sVal)||re.exec(sVal)[0]!=sVal)){if(regExpParamsObj.messagetype=='Text'){return regExpParamsObj.message;}else{return GetCustomLabel(regExpParamsObj.message);}}else{return true;}},isValidDate:function(dateStr,format){if(format==null)
format="MDY";format=format.toUpperCase();if(format.length!=3)
format="MDY";if((format.indexOf("M")==-1)||(format.indexOf("D")==-1)||(format.indexOf("Y")==-1))
format="MDY";if(format.substring(0,1)=="Y")
{var reg1=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;var reg2=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;}
else if(format.substring(1,2)=="Y"){var reg1=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/;var reg2=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/;}else{var reg1=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/;var reg2=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;}
if((reg1.test(dateStr)==false)&&(reg2.test(dateStr)==false))
return false;var parts=dateStr.split(RegExp.$1);if(format.substring(0,1)=="M")
var mm=parts[0];else if(format.substring(1,2)=="M")
var mm=parts[1];else
var mm=parts[2];if(format.substring(0,1)=="D")
var dd=parts[0];else if(format.substring(1,2)=="D")
var dd=parts[1];else
var dd=parts[2];if(format.substring(0,1)=="Y")
var yy=parts[0];else if(format.substring(1,2)=="Y")
var yy=parts[1];else
var yy=parts[2];if(parseFloat(yy)<=50)
yy=(parseFloat(yy)+2000).toString();if(parseFloat(yy)<=99)
yy=(parseFloat(yy)+1900).toString();var dt=new Date(parseFloat(yy),parseFloat(mm)-1,parseFloat(dd),0,0,0,0);if(parseFloat(dd)!=dt.getDate())
return false;if(parseFloat(mm)-1!=dt.getMonth())
return false;return true;}}
Runner.controls.RowManager=Runner.extend(Runner.emptyFn,{fields:{},rowId:-1,fieldsCount:0,fieldNames:[],constructor:function(rowId){Runner.controls.RowManager.superclass.constructor.call(this,rowId);this.fields={};this.fieldNames=[];this.rowId=rowId;},register:function(control){var controlName=control.fieldName;if(!this.fields[controlName]){this.fields[controlName]=[];this.fieldNames.push(controlName);this.fieldsCount++;}
this.fields[controlName][control.ctrlInd]=control;return true;},getAt:function(fName,controlIndex){if(!fName){var rowControlsArr=[];for(var i=0;i<this.fieldNames.length;i++){for(var j=0;j<this.fields[this.fieldNames[i]].length;j++){var fControl=this.getAt(this.fieldNames[i],j);rowControlsArr.push(fControl);}}
return rowControlsArr;}
if(!this.fields[fName]){return false;}
return this.fields[fName][controlIndex];},unregister:function(fName,controlIndex){if(fName==null){for(var i=0;i<this.fieldsCount;i++){this.unregister(this.fieldNames[i],null);i--;}
return true;}else if(!this.fields[fName]){return false;}else if(controlIndex==null){for(var i=0;i<this.fields[fName].length;i++){this.unregister(fName,i);};for(var i=0;i<this.fieldsCount;i++){if(this.fieldNames[i]==fName){this.fieldNames.splice(i,1);this.fieldsCount--;}}
delete this.fields[fName];return true;}else{if(this.fields[fName][controlIndex].destructor){this.fields[fName][controlIndex].destructor();}else if(this.fields[fName][controlIndex]["destructor"]){this.fields[fName][controlIndex]["destructor"]();}
delete this.fields[fName][controlIndex];return true;}},getMaxFieldIndex:function(fName){if(!this.fields[fName]){return false;}
return this.fields[fName].length;}});Runner.controls.TableManager=Runner.extend(Runner.emptyFn,{rows:{},tName:"",rowsCount:0,rowIds:[],constructor:function(tName){this.tName=tName;this.rows={};this.rowIds=[];},register:function(control){var controlId=control.id;if(!this.rows[controlId]){this.rows[controlId]=new Runner.controls.RowManager(controlId);this.rowIds.push(controlId);this.rowsCount++;}
return this.rows[controlId].register(control);},getAt:function(rowId,fName,controlIndex){if(rowId==null){var tableControlsArr=[];for(var i=0;i<this.rowIds.length;i++){var rowControls=this.rows[this.rowIds[i]].getAt();for(var j=0;j<rowControls.length;j++){tableControlsArr.push(rowControls[j]);}}
return tableControlsArr;}
if(!this.rows[rowId]){return false;}
return this.rows[rowId].getAt(fName,controlIndex);},unregister:function(rowId,fName,controlIndex){if(rowId==null){for(var i=0;i<this.rowsCount;i++){this.rows[this.rowIds[i]].unregister(null,null);}
return true;}else if(!this.rows[rowId]){return false;}else{var rowUnregStat=this.rows[rowId].unregister(fName,controlIndex);if(rowUnregStat&&fName==null){for(var i=0;i<this.rowsCount;i++){if(this.rowIds[i]==rowId){this.rowIds.splice(i,1);this.rowsCount--;}}
delete this.rows[rowId];return true;}else{return rowUnregStat;}}},getMaxFieldIndex:function(rowId,fName){if(!this.rows[rowId]){return false;}
return this.rows[rowId].getMaxFieldIndex(fName);}});Runner.controls.ControlManager=function(){var tables={};var tablesCount=0;var tableNames=[];return{register:function(control){if(!control){return false;}
var controlTable=control.table;if(!tables[controlTable]){tables[controlTable]=new Runner.controls.TableManager(controlTable);tableNames.push(controlTable);tablesCount++;}
return tables[controlTable].register(control);},getAt:function(tName,rowId,fName,controlIndex){controlIndex=controlIndex?controlIndex:0;if(tName===false){for(var i=0;i<tableNames.length;i++){var ctrl=tables[tableNames[i]].getAt(rowId,fName,controlIndex);if(ctrl!==false){return ctrl;}}
return false;}
if(!tables[tName]){return false;}
return tables[tName].getAt(rowId,fName,controlIndex);},unregister:function(tName,rowId,fName,controlIndex){if(!tables[tName]){return false;}
var tUnregStat=tables[tName].unregister(rowId,fName,controlIndex);if(tUnregStat&&rowId==null){for(var i=0;i<tablesCount;i++){if(tableNames[i]==tName){tableNames.splice(i,1);tablesCount--;}}
delete tables[tName];return true;}else{return tUnregStat;}},getMaxFieldIndex:function(tName,rowId,fName){if(!tables[tName]){return false;}
return tables[tName].getMaxFieldIndex(rowId,fName);},resetControlsForTable:function(tName){var cntrls=this.getAt(tName);if(!cntrls){return false;}
for(var i=0;i<cntrls.length;i++){cntrls[i].reset();}
return true;},clearControlsForTable:function(tName){var cntrls=this.getAt(tName);if(!cntrls){return false;}
for(var i=0;i<cntrls.length;i++){cntrls[i].clear();}
return true;}};}();Runner.namespace('Runner.form');Runner.form.Button=Runner.extend(Runner.Event,{id:"",messContId:"",messageCont:null,elem:null,disableHandler:null,tagName:"",constructor:function(cfg){Runner.apply(this,cfg);Runner.form.Button.superclass.constructor.call(this,cfg);this.elem=$('#'+this.id);if(!this.elem.length){this.elem=document.createElement('INPUT');this.elem=$(this.elem).attr('type','button');}
this.elemsForEvent=[this.elem.get(0)];this.tagName=this.elem[0].tagName;},setDisabled:function(){switch(this.tagName)
{case'INPUT':this.elem.get(0).disabled=true;break;default:this.suspendEvent(['click']);break;}},setEnabled:function(){switch(this.tagName)
{case'INPUT':this.elem.get(0).disabled=false;break;default:this.resumeEvent(['click']);break;}},setMessage:function(txt){this.initMessCont();this.setMessage=function(txt){this.messageCont.html(txt);}
this.setMessage(txt);},removeMessage:function(){this.initMessCont();this.removeMessage=function(){this.messageCont.empty();}
this.removeMessage();},initMessCont:function(){if(this.messageCont){return;}
var messCont=document.createElement('DIV');this.messContId=this.id+"_messCont";messCont.id=this.messContId;this.messageCont=$(messCont);this.messageCont.insertAfter(this.elem);}});Runner.controls.ControlFabric=function(baseCfg){var cfg={goodFieldName:Runner.goodFieldName(baseCfg.fieldName)};Runner.apply(cfg,baseCfg);var tName=cfg.table,id=cfg.id,fName=cfg.fieldName;if(cfg.editFormat==undefined){cfg.editFormat=Runner.pages.PageSettings.getEditFormat(tName,fName);}
if(cfg.RTEType==undefined){cfg.RTEType=Runner.pages.PageSettings.getFieldData(tName,fName,"RTEType","");}
if(cfg.dateEditType==undefined){cfg.dateEditType=Runner.pages.PageSettings.getFieldData(tName,fName,"dateEditType",Runner.controls.constants.EDIT_DATE_SIMPLE);}
cfg.shortTableName=Runner.pages.PageSettings.getShortTName(tName);var validation=Runner.pages.PageSettings.getValidations(tName,fName);cfg.validationArr=validation.validationArr||[];cfg.regExp=validation.regExp;cfg.disabled=Runner.pages.PageSettings.getDisabledStatus(tName,fName);cfg.hidden=Runner.pages.PageSettings.getHiddenStatus(tName,fName);switch(cfg.editFormat){case Runner.controls.constants.EDIT_FORMAT_NONE:return new Runner.controls.TextField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_TEXT_FIELD:return new Runner.controls.TextField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_TEXT_AREA:{switch(cfg.RTEType)
{case Runner.controls.constants.EDIT_FORMAT_RTE:return new Runner.controls.RTEInnova(cfg);break;case Runner.controls.constants.EDIT_FORMAT_RTEINNOVA:cfg.useRTE="INNOVA";return new Runner.controls.RTEInnova(cfg);break;case Runner.controls.constants.EDIT_FORMAT_RTECK:return new Runner.controls.RTECK(cfg);break;default:return new Runner.controls.TextArea(cfg);break;}}
case Runner.controls.constants.EDIT_FORMAT_PASSWORD:return new Runner.controls.TextField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_DATE:{cfg.ctrlType="date"+cfg.dateEditType;switch(cfg.dateEditType)
{case Runner.controls.constants.EDIT_DATE_SIMPLE_DP:cfg.useDatePicker=true;return new Runner.controls.DateTextField(cfg);break;case Runner.controls.constants.EDIT_DATE_DD:return new Runner.controls.DateDropDown(cfg);break;case Runner.controls.constants.EDIT_DATE_DD_DP:cfg.useDatePicker=true;return new Runner.controls.DateDropDown(cfg);break;case Runner.controls.constants.EDIT_DATE_SIMPLE:default:return new Runner.controls.DateTextField(cfg);break;}}
case Runner.controls.constants.EDIT_FORMAT_TIME:return new Runner.controls.TimeField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_RADIO:cfg.parentFieldName=Runner.pages.PageSettings.getCategoryField(tName,fName);cfg.lookupTable=Runner.pages.PageSettings.getLookupTable(tName,fName);cfg.linkField=Runner.pages.PageSettings.getFieldData(tName,fName,"linkField","");cfg.dispField=Runner.pages.PageSettings.getFieldData(tName,fName,"dispField","");if(cfg.mode==Runner.pages.constants.PAGE_EDIT||cfg.mode==Runner.pages.constants.PAGE_INLINE_EDIT)
cfg.autoCompleteFields=Runner.pages.PageSettings.getFieldData(tName,fName,"autoCompleteFieldsEdit",[]);else if(cfg.mode==Runner.pages.constants.PAGE_ADD||cfg.mode==Runner.pages.constants.PAGE_INLINE_ADD)
cfg.autoCompleteFields=Runner.pages.PageSettings.getFieldData(tName,fName,"autoCompleteFieldsAdd",[]);return new Runner.controls.RadioControl(cfg);break;case Runner.controls.constants.EDIT_FORMAT_CHECKBOX:if(cfg.mode==Runner.controls.constants.MODE_SEARCH){return new Runner.controls.DropDownLookup(cfg);}else{return new Runner.controls.CheckBoxLookup(cfg);}
break;case Runner.controls.constants.EDIT_FORMAT_DATABASE_IMAGE:return new Runner.controls.ImageField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_DATABASE_FILE:return new Runner.controls.FileField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_FILE:return new Runner.controls.FileField(cfg);break;case Runner.controls.constants.EDIT_FORMAT_LOOKUP_WIZARD:cfg.lcType=Runner.pages.PageSettings.getLCT(tName,fName);cfg.multiSel=Runner.pages.PageSettings.getLookupSize(tName,fName);cfg.parentFieldName=Runner.pages.PageSettings.getCategoryField(tName,fName);cfg.lookupTable=Runner.pages.PageSettings.getLookupTable(tName,fName);cfg.linkField=Runner.pages.PageSettings.getFieldData(tName,fName,"linkField","");cfg.dispField=Runner.pages.PageSettings.getFieldData(tName,fName,"dispField","");if(cfg.mode==Runner.pages.constants.PAGE_EDIT||cfg.mode==Runner.pages.constants.PAGE_INLINE_EDIT)
cfg.autoCompleteFields=Runner.pages.PageSettings.getFieldData(tName,fName,"autoCompleteFieldsEdit",[]);else if(cfg.mode==Runner.pages.constants.PAGE_ADD||cfg.mode==Runner.pages.constants.PAGE_INLINE_ADD)
cfg.autoCompleteFields=Runner.pages.PageSettings.getFieldData(tName,fName,"autoCompleteFieldsAdd",[]);switch(cfg.lcType){case Runner.controls.constants.LCT_DROPDOWN:return new Runner.controls.DropDownLookup(cfg);break;case Runner.controls.constants.LCT_AJAX:cfg.freeInput=Runner.pages.PageSettings.getFieldData(tName,fName,"freeInput",false);return new Runner.controls.EditBoxLookup(cfg);break;case Runner.controls.constants.LCT_LIST:return new Runner.controls.ListPageLookup(cfg);break;case Runner.controls.constants.LCT_CBLIST:cfg.lcSize=2;return new Runner.controls.CheckBoxLookup(cfg);break;default:throw('Invalid lookup wizard type = '+cfg.lcType+'. Cannot create lookup!');};break;case Runner.controls.constants.EDIT_FORMAT_READONLY:return new Runner.controls.ReadOnly(cfg);break;default:throw('Invalid control edit format = '+cfg.editFormat+'. Cannot create control!');return;};};Runner.controls.Control=Runner.extend(Runner.Event,{fieldName:"",goodFieldName:"",shortTableName:"",id:"",css:"",style:"",valContId:"",valueElem:null,spanContId:"",spanContElem:null,errContId:"",errContainer:null,validationArr:null,defaultValue:null,isResetHappend:false,table:"",regExp:null,inputType:"",ctrlType:"",showStatus:true,ctrlInd:-1,isSetFocus:false,hidden:false,mode:'',isInvalid:false,constructor:function(cfg){this.validationArr=[];Runner.apply(this,cfg);Runner.controls.Control.superclass.constructor.call(this,cfg);this.valContId="value"+(cfg.ctrlInd||"")+"_"+this.goodFieldName+"_"+this.id;this.valueElem=(this.valueElem==null)?$("#"+this.valContId):this.valueElem;this.spanContId="edit"+this.id+"_"+this.goodFieldName+"_"+cfg.ctrlInd;this.spanContElem=$("#"+this.spanContId);this.errContId="errorCont"+cfg.ctrlInd+"_"+this.valContId;if(cfg.disabled===true||cfg.disabled==="true"){this.setDisabled();}
if(cfg.hidden===true||cfg.hidden==="true"){this.hide();}
this.ccs?valueElem.addclass(this.css):'';this.addStyle(this.style);this.defaultValue=this.getValue();if(this.valueElem.attr&&this.valueElem.attr("type")){this.inputType=this.valueElem.attr("type");}
this.addEvent(["click"]);if(cfg.stopEventInit!==true){if(this.valueElem.length)
this.elemsForEvent=[this.valueElem.get(0)];this.addEvent(["blur"]);this.init();}
Runner.controls.ControlManager.register(this);validation.registerCustomValidation(this);},destructor:function(){this.purgeListeners();},unregister:function(){Runner.controls.ControlManager.unregister(this.table,this.id,this.fieldName);},initToolTip:function(text,pageObj){if(this.valueElem.addClass&&this.mode!=Runner.controls.constants.MODE_SEARCH){this.valueElem.addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj});this.initToolTip=Runner.emptyFn;return true;}else{return false;}},addStyle:function(styleToAdd){if(!styleToAdd){return false;}
var stylesArr=styleToAdd.split(';');for(var i=0;i<stylesArr.length;i++){var style=stylesArr[i].split(":");style[0]=style[0].toString().trim();if(!style[0]){continue;}
style[1]=style[1].toString().trim();this.valueElem.css(style[0],style[1]);}
return true;},validate:function(valArr){if(!this.valueElem.length){return{result:true,messageArr:[]};}
var vRes=validation.validate(valArr||this.validationArr,this);if(valArr||this.validationArr.length){if(!vRes.result){this.markInvalid(vRes.messageArr);}else{this.clearInvalid();}}
return vRes;},removeValidation:function(vType){if(typeof vType!="string"){this.regExp=null;vType="RegExp";}
for(var i=0;i<this.validationArr.length;i++){if(this.validationArr[i]==vType){this.validationArr.splice(i,1);return true;}}
return false;},addValidation:function(vType){if(typeof vType!="string"){this.regExp=vType;vType="RegExp";}
if(!this.isSetValidation(vType)){this.validationArr[this.validationArr.length]=vType;}},isSetValidation:function(vType){if(!validation[vType]){return false;}
for(var i=0;i<this.validationArr.length;i++){if(this.validationArr[i]==vType){return true;}}
return false;},validateAs:function(vType){if(!this.valueElem.length){return{result:true,messageArr:[]};}
return validation[vType](this.getValue());},initErrorCont:function(){this.errContainer=document.createElement('div');this.errContainer=$(this.errContainer);this.errContainer.attr('id',this.errContId);this.errContainer.addClass('errorText');this.errContainer.css('display',"none");this.errContainer.appendTo(this.spanContElem);this.initErrorCont=Runner.emptyFn;},markInvalid:function(messArr,dontDenySubmit){this.initErrorCont();this.markInvalid=function(messArr){var divInnerHtml="";this.errContainer.show();for(var i=0;i<messArr.length;i++){divInnerHtml+=messArr[i]+"</br>";}
this.errContainer.html(divInnerHtml);if(!dontDenySubmit)
this.isInvalid=true;}
this.markInvalid(messArr);},clearInvalid:function(){this.initErrorCont();this.clearInvalid=function(){this.errContainer.hide();this.errContainer.empty();this.isInvalid=false;}
this.clearInvalid();},invalid:function(){return this.isInvalid;},reset:function(){this.isResetHappend=true;this.setValue(this.defaultValue);this.clearInvalid();this.isResetHappend=false;return true;},clear:function(){this.setValue('');this.clearInvalid();return true;},hide:function(){this.spanContElem.css("display","none");this.showStatus=false;},show:function(){this.spanContElem.css("display","");this.showStatus=true;},toggleHide:function(){if(this.showStatus){this.hide();}else{this.show();}},getValue:function(){if(this.valueElem.val){return this.valueElem.val();}else{return false;}},getStringValue:function(){return this.getValue();},setValue:function(val,triggerEvent){if(this.valueElem.val){this.valueElem.val(val);if(triggerEvent===true){this.fireEvent("change");}
return true;}else{return false;}},setDisabled:function(){if(this.valueElem.get(0)){this.valueElem.get(0).disabled=true;return true;}else{return false;}},setEnabled:function(){if(this.valueElem.get(0)){this.valueElem.get(0).disabled=false;return true;}else{return false;}},getControlType:function(){return this.inputType;},setFocus:function(triggerEvent){var cType=this.getControlType();if(cType!=""&&(cType=='text'||cType=='password'||cType=='file'||cType=='textarea')){if(!this.valueElem.length||this.valueElem.get(0).disabled==true||!this.showStatus||this.valueElem.css('display')=='none'||this.valueElem.css('visibility')=='hidden'){return false;}
try{this.valueElem.get(0).focus();}catch(err){}
if(triggerEvent===true){this.fireEvent("focus");}
this.isSetFocus=true;return true;}else{this.isSetFocus=false;return false;}},isEmpty:function(){return this.getValue().toString()=="";},"blur":function(e){this.stopEvent(e);this.isSetFocus=false;if(this.invalid()){return this.validate();}else{var valArr=this.validationArr.copy().removeElem("IsRequired");return this.validate(valArr);}},"click":function(e){this.isSetFocus=true;},removeCSS:function(className){this.valueElem.removeClass(className);},addCSS:function(className){this.valueElem.addClass(className);},getAttr:function(attrName){return this.valueElem.attr(attrName);},getDispElem:function(){return this.valueElem;},getForSubmit:function(){return(this.valueElem.length?[this.valueElem.clone().val(this.valueElem.val())]:[]);}});Runner.controls.ReadOnly=Runner.extend(Runner.controls.Control,{constructor:function(cfg){Runner.controls.ReadOnly.superclass.constructor.call(this,cfg);},validate:function(){return{result:true};},getControlType:function(){return"readonly";},setFocus:function(){return false;}});Runner.controls.TextArea=Runner.extend(Runner.controls.Control,{constructor:function(cfg){this.addEvent(["change","keyup"]);Runner.controls.TextArea.superclass.constructor.call(this,cfg);this.inputType="textarea";},getForSubmit:function(){if(!this.valueElem.length){return[];}
return[this.valueElem.clone().val(this.getValue())]}});Runner.controls.TextField=Runner.extend(Runner.controls.Control,{constructor:function(cfg){this.addEvent(["change","keyup"]);Runner.controls.TextField.superclass.constructor.call(this,cfg);}});Runner.controls.TimeField=Runner.extend(Runner.controls.Control,{typeHiddId:"",typeHiddElem:null,constructor:function(cfg){Runner.controls.TimeField.superclass.constructor.call(this,cfg);this.typeHiddId="type_"+this.goodFieldName+"_"+this.id;this.typeHiddElem=$("#"+this.typeHiddId);this.imgTime=$("#trigger-test-"+this.valContId);if(this.imgTime.length&&!Runner.isIE){this.imgTime.css('visibility','visible');}
if(cfg.disabled===true||cfg.disabled==="true"){this.setDisabled();}
this.addEvent(["change"]);this.init();this.initTimePicker();},initTimePicker:function(){var ctrl=this;var initializer=function(e){ctrl.imgTime.unbind("click");$(function(){var settings=Runner.pages.PageSettings.getFieldData(ctrl.table,ctrl.fieldName,'timePick',{});var params={handle:"#"+ctrl.imgTime.attr("id"),tName:ctrl.table,fName:ctrl.fieldName,rowId:ctrl.id,dropslide:{hideoutDelay:2000,trigger:'click'},open:ctrl.open,convention:settings['convention'],seconds:settings['showSec'],rangeMin:settings['rangeMin'],apm:settings['apm'],select:function(e,dropslide){if(!dropslide){return;}
var t=dropslide.getSelection();var tvar;if(!settings['showSec']){tvar=t[2];t[2]=0;}else{tvar=t[3];}
var newVal=print_time(t[0],t[1],t[2],settings['locale'],(settings['convention']==12?(settings['apm'][0]==tvar?true:false):false),settings['convention'],settings['apm'][0],settings['apm'][1]);ctrl.setValue(newVal,true);e.stopPropagation();}};params["range"+settings['convention']+"h"]=settings['range'];ctrl.valueElem.timepickr(params);ctrl.imgTime.click();});}
this.imgTime.bind("click",initializer);},addValidation:function(type){if(type!="isRequired"){return false;}
Runner.controls.TimeField.superclass.addValidation.call(this,type);},getForSubmit:function(){return[this.valueElem.clone(),this.typeHiddElem.clone()];},setDisabled:function()
{if(this.valueElem.get(0)&&this.imgTime)
{this.valueElem.get(0).disabled=true;this.imgTime.css('visibility','hidden');return true;}else{return false;}},setEnabled:function()
{if(this.valueElem.get(0))
{this.valueElem.get(0).disabled=false;if(!Runner.isIE){this.imgTime.css('visibility','visible');}
return true;}else{return false;}},"change":function(e)
{return this.validate().result;}});Runner.controls.RTEField=Runner.extend(Runner.controls.Control,{iframeElemId:"",iframeElem:null,constructor:function(cfg){cfg.stopEventInit=true;Runner.controls.RTEField.superclass.constructor.call(this,cfg);this.inputType="RTE";this.tName=cfg.table;this.iframeElemId=this.valContId;this.iframeElem=$('#'+this.iframeElemId);if(cfg.disabled==true||cfg.disabled=="true"){this.setDisabled();}
this.fixForChrome();},useRTE:false,fixForChrome:function(){var pageObj=Runner.pages.PageManager.getAt(this.tName,this.id);if($.browser.safari&&pageObj.fly){src=this.iframeElem.attr('src');this.iframeElem.attr('src',"");this.iframeElem.attr('src',src);}},addValidation:function(type)
{if(type!="isRequired")
return false;Runner.controls.RTEField.superclass.addValidation.call(this,type);},getForSubmit:function(){if(!this.valueElem.length){return[];}
var clElem=$('<input type="hidden" name="'+this.iframeElemId+'">').clone();$(clElem).val(this.getValue());return[clElem];},setDisabled:function()
{if(this.iframeElem){var val=this.getValue();this.iframeElem.css('display','none');this.spanContElem.prepend('<div id="disabledRTE'+this.fieldName+'_'+this.id+'">'+val+'</div>')
return true;}else{return false;}},setEnabled:function()
{if(this.iframeElem){$("#disabledRTE"+this.fieldName+'_'+this.id).remove();this.iframeElem.css('display','block');return true;}else{return false;}}});Runner.controls.RTEInnova=Runner.extend(Runner.controls.RTEField,{constructor:function(cfg)
{Runner.controls.RTEInnova.superclass.constructor.call(this,cfg);this.useRTE=cfg.useRTE?cfg.useRTE:false;if(this.useRTE=="INNOVA")
this.innerIframeId='idContentoEdit'+this.goodFieldName+'_'+this.id;this.fixForChrome();},getValue:function()
{var val;if(this.iframeElem)
{if(this.useRTE=='INNOVA')
val=this.iframeElem.contents().find('#'+this.innerIframeId).contents().find('body').html();else
val=this.iframeElem.contents().find('#'+this.iframeElemId).contents().find('body').html();if(val)
val=val.trim();if(val=='<br>')
val='';return val;}
else
return false;},setValue:function(val)
{if(this.useRTE=='INNOVA')
this.iframeElem.contents().find('#'+this.innerIframeId).contents().find('body').html(val);else
this.iframeElem.contents().find('#'+this.iframeElemId).contents().find('body').html(val);}});Runner.controls.RTECK=Runner.extend(Runner.controls.RTEField,{constructor:function(cfg){Runner.controls.RTECK.superclass.constructor.call(this,cfg);nWidth=Runner.pages.PageSettings.getFieldData(this.tName,this.fieldName,'nWidth',100);nHeight=Runner.pages.PageSettings.getFieldData(this.tName,this.fieldName,'nHeight',200);if(this.valueElem.length){CKEDITOR.replace(this.valContId,{"width":nWidth,"height":nHeight});}},getEditor:function(){if(!window.CKEDITOR){return false;}
if(typeof window.CKEDITOR.instances[this.valContId]=='undefined'){return false;}
return window.CKEDITOR.instances[this.valContId];},destructor:function(){var editor=this.getEditor();if(editor!==false){CKEDITOR.remove(editor);}},getValue:function(){var editor=this.getEditor();if(editor===false){return false;}
return editor.getData();},setValue:function(val){var editor=this.getEditor();if(editor===false){return false;}
editor.setData(val);return true;},initToolTip:function(text,pageObj){if(this.valueElem.addClass&&this.mode!=Runner.controls.constants.MODE_SEARCH&&this.valueElem.parent().length&&this.valueElem.parent().get(0).nodeName=="SPAN"){this.valueElem.parent().addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj});this.initToolTip=Runner.emptyFn;return true;}else{return false;}}});Runner.controls.FileControl=Runner.extend(Runner.controls.Control,{radioElemsName:"",radioElems:null,notEmptyCntrl:0,constructor:function(cfg){this.radioElems={};cfg.stopEventInit=true;Runner.controls.FileControl.superclass.constructor.call(this,cfg);var notEmpty=$("#notempty_"+this.goodFieldName+"_"+this.id);this.notEmptyCntrl=parseInt($(notEmpty).val());this.radioElemsName="type_"+this.goodFieldName+"_"+this.id;if($('#'+this.radioElemsName).length){this.getChekedRadio=function(){return false;}}
this.getRadioControls();this.events=["change"];delete this["blur"];this.elemsForEvent=[this.valueElem.get(0)];this.init();},"blur":Runner.emptyFn,"change":function(e){this.stopEvent(e);this.changeRadio("updateRadio");return this.validate();},changeRadio:function(radioToCheck){for(var radio in this.radioElems){if(radio==radioToCheck&&this.radioElems[radio]!=false){this.radioElems[radio].elem.get(0).checked=true;this.radioElems[radio].cheked=true;}else if(radio==radioToCheck&&this.radioElems[radio]==false){return false;}else if(this.radioElems[radio]!=false){this.radioElems[radio].elem.get(0).checked=false;this.radioElems[radio].cheked=false;}}
return true;},getRadioControls:function(){var keepRadio=$('#'+this.radioElemsName+'_keep');var ctrl=this;keepRadio.bind('click',function(e){ctrl.changeRadio('keepRadio');});var deleteRadio=$('#'+this.radioElemsName+'_delete');deleteRadio.bind('click',function(e){ctrl.changeRadio('deleteRadio');});var updateRadio=$('#'+this.radioElemsName+'_update');updateRadio.bind('click',function(e){ctrl.changeRadio('updateRadio');});this.radioElems["keepRadio"]=keepRadio.length?{elem:keepRadio,cheked:true}:false;this.radioElems["deleteRadio"]=deleteRadio.length?{elem:deleteRadio,cheked:false}:false;this.radioElems["updateRadio"]=updateRadio.length?{elem:updateRadio,cheked:false}:false;return true;},getChekedRadio:function(){for(var radio in this.radioElems){if(this.radioElems[radio]!=false&&this.radioElems[radio].cheked===true){return radio;}}
return false;},validate:function(valArr){if(this.notEmptyCntrl&&(this.mode==Runner.pages.constants.PAGE_EDIT||this.mode==Runner.pages.constants.PAGE_INLINE_EDIT)){return{result:true,messageArr:[]};}else{return Runner.controls.FileControl.superclass.validate.call(this,valArr);}},getForSubmit:function(){var radio=this.getChekedRadio();var cloneArr=[];if(radio){var radioClone=document.createElement('input');$(radioClone).attr('type','hidden');$(radioClone).attr('id',this.radioElems[radio].elem.attr('id'));$(radioClone).attr('name',this.radioElems[radio].elem.attr('name'));$(radioClone).val(this.radioElems[radio].elem.val());cloneArr.push($(radioClone));}else if($('#'+this.radioElemsName).length){cloneArr.push($('#'+this.radioElemsName));}
var realFile=this.valueElem;var clone=this.valueElem.clone(true);clone.insertAfter(realFile);cloneArr.push(realFile);return cloneArr;},isEmpty:function(){if(this.mode==Runner.pages.constants.PAGE_EDIT||this.mode==Runner.pages.constants.PAGE_INLINE_EDIT){if(this.notEmptyCntrl){return false;}else{return(this.radioElems["keepRadio"].cheked===true||this.getValue().toString()==""||this.radioElems["updateRadio"].cheked===false)}}else{return(this.getValue().toString()=="")}}});Runner.controls.ImageField=Runner.extend(Runner.controls.FileControl,{imgElem:null,constructor:function(cfg){Runner.controls.ImageField.superclass.constructor.call(this,cfg);this.imgElemId="image_"+this.goodFieldName+"_"+this.id;this.imgElem=$("#"+this.imgElemId);},setValue:function(val,triggerEvent){if($(val).attr('src')){this.imgElem.attr('src',($(val).attr('src')+"&rndVal="+Math.random()));}else{Runner.controls.ImageField.superclass.setValue.call(this,val,triggerEvent);}}});Runner.controls.FileField=Runner.extend(Runner.controls.FileControl,{addTimeStamp:false,fileNameElemId:"",fileNameElem:null,fileHiddElemId:"",fileHiddElem:null,constructor:function(cfg){cfg.stopEventInit=true;Runner.controls.FileField.superclass.constructor.call(this,cfg);this.fileNameElemId="filename_"+this.goodFieldName+"_"+this.id;this.fileNameElem=$("#"+this.fileNameElemId).length?$("#"+this.fileNameElemId):null;this.fileHiddElemId="filenameHidden_"+this.goodFieldName+"_"+this.id;this.fileHiddElem=$("#"+this.fileHiddElemId).length?$("#"+this.fileHiddElemId):null;this.addTimeStamp=cfg.addTimeStamp||Runner.pages.PageSettings.getFieldData(this.table,this.fieldName,'isUseTimeStamp',false);for(radio in this.radioElems){if(this.radioElems[radio]){var objScope=this;this.radioElems[radio].elem.bind('click',function(e){var radioTypeStartFrom=this.id.lastIndexOf('_');var radioTypeName=this.id.substring(radioTypeStartFrom+1)+'Radio';objScope.changeControlsStyles(radioTypeName);});}}},addValidation:function(type){if(type!="isRequired"){return false;}
Runner.controls.FileField.superclass.addValidation.call(this,type);},getFileNameFromPath:function(path){var wpos=path.lastIndexOf('\\');var upos=path.lastIndexOf('/');var pos=wpos;if(upos>wpos)
pos=upos;return path.substr(pos+1);},setValue:function(val,triggerEvent){var valWithStamp="",fileName="";if(this.fileNameElem!=null||this.addTimeStamp){fileName=this.getFileNameFromPath(this.valueElem.val());}
if(this.addTimeStamp){var valWithStamp=addTimestamp(fileName);}
if(this.fileNameElem!=null){this.fileNameElem.val(valWithStamp||fileName);}
if(triggerEvent===true){this.fireEvent("change");}},"change":function(e){this.stopEvent(e);this.changeRadio("updateRadio");var vRes=this.validate();if(vRes.result){var vl=this.getValue();this.setValue(vl,false);}
return vRes.result;},changeRadio:function(radioToCheck){this.changeControlsStyles(radioToCheck);Runner.controls.FileField.superclass.changeRadio.call(this,radioToCheck);},changeControlsStyles:function(radioToCheck){if(!this.radioElems[radioToCheck]){return false;}
if(this.fileNameElem==null){return false;}
if(radioToCheck=="deleteRadio"){this.fileNameElem.css('backgroundColor','gainsboro');this.fileNameElem[0].disabled=true;return true;}else if(radioToCheck=="updateRadio"||radioToCheck=="keepRadio"){this.fileNameElem.css('backgroundColor','white');this.fileNameElem[0].disabled=false;return true;}else{return false;}},getFileName:function(){if(this.fileHiddElem){return this.fileHiddElem.val();}else{return false;}},setFileName:function(fileName){if(this.fileHiddElem){this.fileHiddElem.val(fileName);return true;}else{return false;}},getForSubmit:function(){var cloneArr=Runner.controls.ImageField.superclass.getForSubmit.call(this);if(this.fileNameElem){cloneArr.push(this.fileNameElem.clone());}
if(this.fileHiddElem){cloneArr.push(this.fileHiddElem.clone());}
return cloneArr;}});Runner.controls.DateField=Runner.extend(Runner.controls.Control,{datePickerHiddId:"",datePickerHiddElem:null,imgCal:null,useDatePicker:false,dateFormatHiddId:"",dateFormat:"",showTime:false,dateFormatHiddElem:null,dataPicker:null,timeBox:null,dateDelimiter:"/",constructor:function(cfg){Runner.controls.DateField.superclass.constructor.call(this,cfg);this.useDatePicker=cfg.useDatePicker?cfg.useDatePicker:false;this.dateFormat=typeof cfg.dateFormat!="undefined"?cfg.dateFormat:Runner.pages.PageSettings.getGlobalData("locale").dateFormat;this.dateDelimiter=Runner.pages.PageSettings.getGlobalData("locale")["dateDelimiter"];this.showTime=Runner.pages.PageSettings.getFieldData(this.table,this.fieldName,"showTime",false);this.dateFormatHiddId="type"+(cfg.ctrlInd||"")+"_"+this.goodFieldName+"_"+this.id;this.dateFormatHiddElem=$("#"+this.dateFormatHiddId);this.initDataPicker();},initDataPicker:function(){if(!this.useDatePicker){this.initDataPicker=Runner.emptyFn;return false;}
this.imgCal=$('#imgCal_'+this.valContId);this.datePickerHiddId="tsvalue"+(this.ctrlInd||"")+"_"+this.goodFieldName+"_"+this.id;this.datePickerHiddElem=$("#"+this.datePickerHiddId);var dateControl=this;this.imgCal.bind("click",function(e){(function(e){Runner.Event.prototype.stopEvent(e);if(!this.dataPicker){YAHOO.util.Event.on(document,"click",function(e){(function(e){var el=YAHOO.util.Event.getTarget(e);var dialogEl=this.dataPicker.element;if(el!=this.dataPicker.dataPickerEl&&!YAHOO.util.Dom.isAncestor(dialogEl,el)&&el!=this.imgCal.get(0)&&!YAHOO.util.Dom.isAncestor(this.imgCal.get(0),el)){this.dataPicker.hide();}}).createDelegate(dateControl,[e])();});function todayHandler(){this.setValue(this.calendar.today,true);this.calendar.select(this.calendar.today);this.dataPicker.hide();}
function closeHandler(){this.dataPicker.hide();}
this.dataPicker=new YAHOO.widget.Dialog("container_"+this.goodFieldName+this.id,{visible:false,context:["show","tl","bl"],buttons:[{text:Runner.lang.constants.TEXT_TODAY,handler:todayHandler.createDelegate(dateControl),isDefault:true}],draggable:true,close:true,constraintoviewport:true,fixedcenter:true,modal:true});var dt=new Date();var currentYear=dt.getFullYear();var initialYear=Runner.pages.PageSettings.getFieldData(this.table,this.fieldName,"initialYear",110);var lastYear=Runner.pages.PageSettings.getFieldData(this.table,this.fieldName,"lastYear",10);var startYear=this.startYear=currentYear-initialYear;var endYear=this.endYear=currentYear+lastYear;var addCalId="cal"+this.id;this.dataPicker.setBody('<div id="'+addCalId+'"></div>');this.dataPicker.render(document.body);}
if(this.showTime&&!this.timeBox){var timeSpan=$(document.createElement('DIV')).css("text-align","center");this.timeBox=$(document.createElement('INPUT')).attr('type','text').attr('size','10').attr('id','timeBox'+this.id).attr('maxlength',8).css("margin-bottom","8px").appendTo(timeSpan);$(this.dataPicker.footer).prepend(timeSpan);}else{this.timeBox=$('#timeBox'+this.id);}
if(!this.calendar){this.calendar=new YAHOO.widget.Calendar(addCalId,{iframe:false,hide_blank_weeks:true,LOCALE_WEEKDAYS:"short",START_WEEKDAY:1,mindate:"1/1/"+startYear,maxdate:"12/31/"+endYear});this.calendar.buildMonthLabel=function(){var date=this.cfg.getProperty('pagedate'),currentYear=(date.getFullYear()+this.Locale.YEAR_OFFSET);var yearDDId=this.id+'_year_dd';this.yearDDId=yearDDId;var monthDDId=this.id+'_month_dd';this.monthDDId=monthDDId;var yearDD='<select id="'+yearDDId+'">';$('#'+yearDDId).remove();$('#'+monthDDId).remove();var minYear=this.cfg.getProperty('mindate').getFullYear(),maxYear=this.cfg.getProperty('maxdate').getFullYear();for(var i=minYear;i<=maxYear;i++){yearDD+='<option value="'+i+'"';if(i==currentYear){yearDD+='selected="selected"';}
yearDD+='>'+i+'</option>';}
yearDD+='<div></select>';var currMonth=date.getMonth();var monthNames=[Runner.lang.constants.TEXT_MONTH_JAN,Runner.lang.constants.TEXT_MONTH_FEB,Runner.lang.constants.TEXT_MONTH_MAR,Runner.lang.constants.TEXT_MONTH_APR,Runner.lang.constants.TEXT_MONTH_MAY,Runner.lang.constants.TEXT_MONTH_JUN,Runner.lang.constants.TEXT_MONTH_JUL,Runner.lang.constants.TEXT_MONTH_AUG,Runner.lang.constants.TEXT_MONTH_SEP,Runner.lang.constants.TEXT_MONTH_OCT,Runner.lang.constants.TEXT_MONTH_NOV,Runner.lang.constants.TEXT_MONTH_DEC];var monthDD='<select class="datapicker-dd" id="'+monthDDId+'">';for(var i=0;i<monthNames.length;i++){monthDD+='<option value="'+i+'"';if(i==currMonth){monthDD+='selected="selected"';}
monthDD+='>'+monthNames[i]+'</option>';}
monthDD+='</select></div>';return monthDD+yearDD;this.buildMonthLabel=Runner.emptyFn;}
var baseNextMonthHn=this.calendar.doNextMonthNav;this.calendar.doNextMonthNav=function(e,cal){var currYear=cal.getDateByCellId("newcalelement_0_cell17").getFullYear(),currMonth=cal.getDateByCellId("newcalelement_0_cell17").getMonth();if(currYear<endYear||(currYear==endYear&&cal.getDateByCellId("newcalelement_0_cell17").getMonth()<11)){baseNextMonthHn(e,cal);}}
var basePrevMonthHn=this.calendar.doPreviousMonthNav;this.calendar.doPreviousMonthNav=function(e,cal){var currYear=cal.getDateByCellId("newcalelement_0_cell17").getFullYear(),currMonth=cal.getDateByCellId("newcalelement_0_cell17").getMonth();if(currYear>startYear||(currYear==startYear&&cal.getDateByCellId("newcalelement_0_cell17").getMonth()>0)){basePrevMonthHn(e,cal);}}
var currDate=this.getValue();this.calendar.cfg.setProperty("pagedate",currDate);this.calendar.selectEvent.subscribe(function(){var selDate=this.calendar.getSelectedDates()[0];var selTime=this.getTime();if(selTime){var timeArr=selTime.split(":");selDate.setHours(timeArr[0]);selDate.setMinutes(timeArr[1]);selDate.setSeconds(timeArr[2]);}
if(selDate.toString()!=this.getValue().toString()){this.setValue(selDate,true);this.dataPicker.hide();}},this,this);this.calendar.renderEvent.subscribe(function(){var currYear=this.calendar.getDateByCellId("newcalelement_0_cell17").getFullYear(),currMonth=this.calendar.getDateByCellId("newcalelement_0_cell17").getMonth(),cal=this.calendar;$('#'+this.calendar.yearDDId).val(currYear);$('#'+this.calendar.monthDDId).val(currMonth);$('#'+this.calendar.yearDDId).bind('change',function(e){var val=parseInt(this.value);if(val<endYear+1&&val>startYear-1){cal.setYear(val);cal.render();}});$('#'+this.calendar.monthDDId).bind('change',function(e){var val=parseInt(this.value);cal.setMonth(val);cal.render();});if(Runner.isGecko){$(this.dataPicker.body).find('a.calnavright').css({top:'10',right:'-1'});}},this,this);this.localizeCalendar();}
var selDate=this.getValue();this.setTime(selDate);if(selDate){this.calendar.cfg.setProperty("pagedate",selDate);this.calendar.select(selDate);}
this.calendar.render();this.dataPicker.show();}).call(dateControl,e);});},localizeCalendar:function(){if(!this.calendar){return false;}
this.calendar.cfg.setProperty("DATE_FIELD_DELIMITER",this.dateDelimiter);if(this.dateFormat==-1){this.calendar.cfg.setProperty("MDY_DAY_POSITION",1);this.calendar.cfg.setProperty("MDY_MONTH_POSITION",2);this.calendar.cfg.setProperty("MDY_YEAR_POSITION",3);}else if(this.dateFormat==1){this.calendar.cfg.setProperty("MDY_DAY_POSITION",1);this.calendar.cfg.setProperty("MDY_MONTH_POSITION",2);this.calendar.cfg.setProperty("MDY_YEAR_POSITION",3);}else if(this.dateFormat==0){this.calendar.cfg.setProperty("MDY_DAY_POSITION",2);this.calendar.cfg.setProperty("MDY_MONTH_POSITION",1);this.calendar.cfg.setProperty("MDY_YEAR_POSITION",3);}else{this.calendar.cfg.setProperty("MD_DAY_POSITION",2);this.calendar.cfg.setProperty("MD_MONTH_POSITION",1);}
this.calendar.cfg.setProperty("MONTHS_SHORT",[Runner.lang.constants.TEXT_MONTH_JAN,Runner.lang.constants.TEXT_MONTH_FEB,Runner.lang.constants.TEXT_MONTH_MAR,Runner.lang.constants.TEXT_MONTH_APR,Runner.lang.constants.TEXT_MONTH_MAY,Runner.lang.constants.TEXT_MONTH_JUN,Runner.lang.constants.TEXT_MONTH_JUL,Runner.lang.constants.TEXT_MONTH_AUG,Runner.lang.constants.TEXT_MONTH_SEP,Runner.lang.constants.TEXT_MONTH_OCT,Runner.lang.constants.TEXT_MONTH_NOV,Runner.lang.constants.TEXT_MONTH_DEC]);this.calendar.cfg.setProperty("MONTHS_LONG",[Runner.lang.constants.TEXT_MONTH_JAN,Runner.lang.constants.TEXT_MONTH_FEB,Runner.lang.constants.TEXT_MONTH_MAR,Runner.lang.constants.TEXT_MONTH_APR,Runner.lang.constants.TEXT_MONTH_MAY,Runner.lang.constants.TEXT_MONTH_JUN,Runner.lang.constants.TEXT_MONTH_JUL,Runner.lang.constants.TEXT_MONTH_AUG,Runner.lang.constants.TEXT_MONTH_SEP,Runner.lang.constants.TEXT_MONTH_OCT,Runner.lang.constants.TEXT_MONTH_NOV,Runner.lang.constants.TEXT_MONTH_DEC]);this.calendar.cfg.setProperty("WEEKDAYS_1CHAR",[Runner.lang.constants.TEXT_DAY_SU,Runner.lang.constants.TEXT_DAY_MO,Runner.lang.constants.TEXT_DAY_TU,Runner.lang.constants.TEXT_DAY_WE,Runner.lang.constants.TEXT_DAY_TH,Runner.lang.constants.TEXT_DAY_FR,Runner.lang.constants.TEXT_DAY_SA]);this.calendar.cfg.setProperty("WEEKDAYS_SHORT",[Runner.lang.constants.TEXT_DAY_SU,Runner.lang.constants.TEXT_DAY_MO,Runner.lang.constants.TEXT_DAY_TU,Runner.lang.constants.TEXT_DAY_WE,Runner.lang.constants.TEXT_DAY_TH,Runner.lang.constants.TEXT_DAY_FR,Runner.lang.constants.TEXT_DAY_SA]);this.calendar.cfg.setProperty("WEEKDAYS_MEDIUM",[Runner.lang.constants.TEXT_DAY_SU,Runner.lang.constants.TEXT_DAY_MO,Runner.lang.constants.TEXT_DAY_TU,Runner.lang.constants.TEXT_DAY_WE,Runner.lang.constants.TEXT_DAY_TH,Runner.lang.constants.TEXT_DAY_FR,Runner.lang.constants.TEXT_DAY_SA]);this.calendar.cfg.setProperty("WEEKDAYS_LONG",[Runner.lang.constants.TEXT_DAY_SU,Runner.lang.constants.TEXT_DAY_MO,Runner.lang.constants.TEXT_DAY_TU,Runner.lang.constants.TEXT_DAY_WE,Runner.lang.constants.TEXT_DAY_TH,Runner.lang.constants.TEXT_DAY_FR,Runner.lang.constants.TEXT_DAY_SA]);},addValidation:function(type){if(type!="IsRequired"){return false;}
Runner.controls.DateField.superclass.addValidation.call(this,type);},parseTime:function(dtObj){if(typeof dtObj=="object"){return((dtObj.getHours()<10?'0':'')+dtObj.getHours()+":"
+(dtObj.getMinutes()<10?'0':'')+(dtObj.getMinutes())+":"
+(dtObj.getSeconds()<10?'0':'')+(dtObj.getSeconds()));}else{return"";}},getTime:function(){if(this.showTime){return this.timeBox.val();}else{return"";}},setTime:function(dtObj){if(this.showTime){if(dtObj)
this.timeBox.val(this.parseTime(dtObj));else
this.timeBox.val('00:00:00');}},setValue:function(newDate,triggerEvent){if(typeof newDate=="string"){return parse_datetime(newDate,this.dateFormat);}else{return newDate;}},print_datetime:function(value,format){var date='';if(format==-1)
date+=(value.getDate()<10?'0'+value.getDate():value.getDate())+'-'+(value.getMonth()<9?'0'+(value.getMonth()+1):value.getMonth()+1)+'-'+value.getFullYear();else if(format==1)
date+=(value.getDate()<10?'0'+value.getDate():value.getDate())+this.dateDelimiter+(value.getMonth()<9?'0'+(value.getMonth()+1):value.getMonth()+1)+this.dateDelimiter+value.getFullYear();else if(format==0)
date+=(value.getMonth()<9?'0'+(value.getMonth()+1):value.getMonth()+1)+this.dateDelimiter+(value.getDate()<10?'0'+value.getDate():value.getDate())+this.dateDelimiter+value.getFullYear();else
date+=value.getFullYear()+this.dateDelimiter+(value.getMonth()<9?'0'+(value.getMonth()+1):value.getMonth()+1)+this.dateDelimiter+(value.getDate()<10?'0'+value.getDate():value.getDate());if(value.getHours()==0&&value.getMinutes()==0&&value.getSeconds()==0){return date;}
var time='';if(value.getHours()>0||value.getMinutes()>0||value.getSeconds()>0){time+=(value.getHours()<10?'0'+value.getHours():value.getHours());time+=':'+(value.getMinutes()<10?'0'+value.getMinutes():value.getMinutes())}
if(value.getSeconds()>0)
time+=':'+(value.getSeconds()<10?'0'+value.getSeconds():value.getSeconds());return date+' '+time;}});Runner.controls.DateTextField=Runner.extend(Runner.controls.DateField,{constructor:function(cfg){this.addEvent(["change","keyup"]);Runner.controls.DateTextField.superclass.constructor.call(this,cfg);if(cfg.disabled===true||cfg.disabled==="true"){this.setDisabled();}
this.defaultValue=this.getValue();},getValue:function(){var parsedTime=parse_datetime(this.valueElem.val(),this.dateFormat);if(parsedTime==null){return"";}else{return parsedTime;}},setValue:function(newDate,triggerEvent){newDate=Runner.controls.DateTextField.superclass.setValue.call(this,newDate,triggerEvent);if(typeof newDate=='object'&&newDate!=null){var dt=this.print_datetime(newDate,this.dateFormat);this.valueElem.val(dt);if(this.useDatePicker){dt=this.print_datetime(newDate,-1);this.datePickerHiddElem.val(dt);}
this.validate();return true;}else{this.valueElem.val("");if(this.useDatePicker){this.datePickerHiddElem.val("");}
this.validate();return false;}
if(triggerEvent===true){this.fireEvent("change");}},"blur":function(e){this.stopEvent(e);this.focusState=false;if(!this.invalid()){return;}
var vRes=this.validate();if(vRes.result&&this.useDatePicker&&this.getValue()){this.setValue(this.getValue());}},setDisabled:function(){if(this.valueElem.get(0)&&this.imgCal)
{this.valueElem.get(0).disabled=true;this.imgCal.css('visibility','hidden');return true;}else{return false;}},setEnabled:function(){if(this.valueElem.get(0)){this.valueElem.get(0).disabled=false;if(this.imgCal!=null)
this.imgCal.css('visibility','visible');return true;}else{return false;}},getForSubmit:function(){return[this.valueElem.clone(),this.dateFormatHiddElem.clone()];},getStringValue:function(){return this.valueElem.val();}});Runner.controls.DateDropDown=Runner.extend(Runner.controls.DateField,{hiddValueElem:null,hiddElemId:"",constructor:function(cfg){cfg.stopEventInit=true;Runner.controls.DateDropDown.superclass.constructor.call(this,cfg);this.valueElem={"day":$("#day"+this.valContId),"month":$("#month"+this.valContId),"year":$("#year"+this.valContId)};if(cfg.disabled===true||cfg.disabled==="true"){this.setDisabled();}
this.addEvent(["change"]);this.killEvent("blur");this.elemsForEvent=[this.valueElem["day"].get(0),this.valueElem["month"].get(0),this.valueElem["year"].get(0)];this.init();this.hiddElemId=this.valContId;this.hiddValueElem=$("#"+this.hiddElemId);this.inputType="3dd";if(Runner.lang.constants.TEXT_MONTH_JAN){this.addYearOptions(cfg.yearVal);this.addMonthOptions(cfg.monthVal);this.addDayOptions(cfg.dayVal);}
if(this.hiddValueElem.length){var dateObj=parse_datetime(this.hiddValueElem.val(),2);this.setValue(dateObj);}
this.defaultValue=this.getValue();},destructor:function(){Runner.controls.DateDropDown.superclass.destructor.call(this);this.valueElem['day'].remove();this.valueElem['month'].remove();this.valueElem['year'].remove();},initToolTip:function(text,pageObj){if(this.valueElem['day'].addClass&&this.valueElem['month'].addClass&&this.valueElem['year'].addClass){this.valueElem['day'].addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj,el:this.valueElem['year']});this.valueElem['month'].addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj,el:this.valueElem['year']});this.valueElem['year'].addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj});return true;}else{return false;}},addYearOptions:function(selectedYear){this.valueElem["year"].html('');var dt=new Date();var currentYear=dt.getFullYear();var initialYear=Runner.pages.PageSettings.getFieldData(this.table,this.fieldName,"initialYear",110);var lastYear=Runner.pages.PageSettings.getFieldData(this.table,this.fieldName,"lastYear",10);var startYear=currentYear-initialYear;var endYear=currentYear+lastYear;var opt=document.createElement('OPTION');$(opt).val('').html('');this.valueElem["year"].append(opt);for(var i=startYear;i<=endYear;i++){var opt=document.createElement('OPTION');$(opt).val(i).html(i);if(i==selectedYear){opt.selected=true;}
this.valueElem["year"].append(opt);};this.addYearOptions=Runner.emptyFn;},addMonthOptions:function(selectedMonth){this.valueElem["month"].html('');var opt=document.createElement('OPTION');$(opt).val('').html('');this.valueElem["month"].append(opt);var monthNames=[];monthNames[1]=Runner.lang.constants.TEXT_MONTH_JAN;monthNames[2]=Runner.lang.constants.TEXT_MONTH_FEB;monthNames[3]=Runner.lang.constants.TEXT_MONTH_MAR;monthNames[4]=Runner.lang.constants.TEXT_MONTH_APR;monthNames[5]=Runner.lang.constants.TEXT_MONTH_MAY;monthNames[6]=Runner.lang.constants.TEXT_MONTH_JUN;monthNames[7]=Runner.lang.constants.TEXT_MONTH_JUL;monthNames[8]=Runner.lang.constants.TEXT_MONTH_AUG;monthNames[9]=Runner.lang.constants.TEXT_MONTH_SEP;monthNames[10]=Runner.lang.constants.TEXT_MONTH_OCT;monthNames[11]=Runner.lang.constants.TEXT_MONTH_NOV;monthNames[12]=Runner.lang.constants.TEXT_MONTH_DEC;for(var i=1;i<monthNames.length;i++){var opt=document.createElement('OPTION');$(opt).val(i).html(monthNames[i]);if(i==selectedMonth){opt.selected=true;}
this.valueElem["month"].append(opt);}
this.valueElem["month"].css('width','90px');this.addMonthOptions=Runner.emptyFn;},addDayOptions:function(selectedDay){this.valueElem["day"].html('');var opt=document.createElement('OPTION');$(opt).val('').html('');this.valueElem["day"].append(opt);for(var i=1;i<=31;i++){var opt=document.createElement('OPTION');$(opt).val(i).html(i);if(i==selectedDay){opt.selected=true;}
this.valueElem["day"].append(opt);};this.addDayOptions=Runner.emptyFn;},"change":function(e){this.stopEvent(e);for(var name in this.valueElem){if(this.valueElem[name].val()=='')
{this.setValue();return true;}}
var vRes=this.validate();if(vRes.result){this.setValue(this.getValue());}
return vRes;},"blur":Runner.emptyFn,getValue:function()
{if(this.valueElem["day"]&&this.valueElem["day"].val()){var dayVal=this.valueElem["day"].val();}else{return false;}
if(this.valueElem["month"]&&this.valueElem["month"].val()){var monthVal=this.valueElem["month"].val();}else{return false;}
if(this.valueElem["year"]&&this.valueElem["year"].val()){var yearVal=this.valueElem["year"].val();}else{return false;}
var date=new Date(yearVal,monthVal-1,dayVal,00,00,00);return date;},setValue:function(newDate,triggerEvent){newDate=Runner.controls.DateTextField.superclass.setValue.call(this,newDate,triggerEvent);if(typeof newDate=='object'&&newDate!=null){this.hiddValueElem.get(0).value=newDate.getFullYear()+'-'+(newDate.getMonth()+1)+'-'+newDate.getDate();this.valueElem["day"].get(0).selectedIndex=newDate.getDate();this.valueElem["month"].get(0).selectedIndex=newDate.getMonth()+1;for(var i=0;i<this.valueElem["year"].get(0).options.length;i++){if(this.valueElem["year"].get(0).options[i].value==newDate.getFullYear()){this.valueElem["year"].get(0).selectedIndex=i;break;}}
if(this.useDatePicker){this.datePickerHiddElem.get(0).value=newDate.getDate()+'-'+(newDate.getMonth()+1)+'-'+newDate.getFullYear();if(this.calendar&&this.calendar.cfg.getProperty('pagedate').toString()!=newDate.toString()){this.calendar.cfg.setProperty('pagedate',newDate);this.calendar.select(newDate);}}
return true;}else{this.hiddValueElem.val('');if(this.isResetHappend)
{this.valueElem["day"].get(0).selectedIndex=0;this.valueElem["month"].get(0).selectedIndex=0;this.valueElem["year"].get(0).selectedIndex=0;}
if(this.useDatePicker){this.datePickerHiddElem.val("");}
return false;}
if(triggerEvent===true){this.fireEvent("change");}},setDisabled:function(){if(!this.valueElem["day"]||!this.valueElem["month"]||!this.valueElem["year"]||!this.imgCal){return false;}
this.valueElem["day"][0].disabled=true;this.valueElem["month"][0].disabled=true;this.valueElem["year"][0].disabled=true;this.imgCal.css('visibility','hidden');return true;},setEnabled:function(){this.valueElem["day"][0].disabled=false;this.valueElem["month"][0].disabled=false;this.valueElem["year"][0].disabled=false;if(this.imgCal!=null){this.imgCal.css('visibility','visible');}
return true;},getForSubmit:function(){return[this.hiddValueElem.clone(),this.dateFormatHiddElem.clone()];},setFocus:function(triggerEvent){if(this.valueElem["day"].get(0).disabled!=true){this.valueElem["day"].get(0).focus();if(triggerEvent===true){this.fireEvent("focus");}
this.isSetFocus=true;return true;}else{this.isSetFocus=false;return false;}},isEmpty:function(){if(this.valueElem["day"].val()==""||this.valueElem["month"].val()==""||this.valueElem["year"].val()==""){return true;}else{return false;}},validate:function(valArr){if(!this.valueElem["day"].length||!this.valueElem["month"].length||!this.valueElem["year"].length){return{result:true,messageArr:[]};}
var vRes=validation.validate(valArr||this.validationArr,this);if(valArr||this.validationArr.length){if(!vRes.result){this.markInvalid(vRes.messageArr);}else{this.clearInvalid();}}
return vRes;},getStringValue:function(){return this.hiddValueElem.val();}});Runner.controls.LookupWizard=Runner.extend(Runner.controls.Control,{isLookupWizard:true,dependentCtrls:null,parentCtrl:null,parentFieldName:'',lookupTable:"",addNew:"",pageId:-1,dispField:"",linkField:"",preloadData:null,autoCompleteFields:null,constructor:function(cfg){cfg.stopEventInit=true;this.dependentCtrls=[];this.autoCompleteFields=[];Runner.controls.LookupWizard.superclass.constructor.call(this,cfg);this.addNew=$("#addnew_"+this.valContId);this.addEvent(["change"]);var control=this;this.addNew.bind("click",this,function(e){Runner.Event.prototype.stopEvent(e);if(!e.data.getPageParams)
return;var params=e.data.getPageParams();control.pageId=Runner.pages.PageManager.openPage(params);});},destructor:function(){Runner.controls.LookupWizard.superclass.destructor.call(this);delete this.dependentCtrls;},getPageParams:function(){var control=this,category='';if(this.parentCtrl){category=this.parentCtrl.getValue();}
return{tName:this.lookupTable,pageType:Runner.pages.constants.PAGE_ADD,destroyOnClose:true,fName:this.fieldName,category:this.parentFieldName,lookupCtrl:this,modal:true,baseParams:{parId:this.id,field:Runner.goodFieldName(this.fieldName),category:category,table:Runner.pages.PageSettings.getShortTName(this.table),editType:Runner.pages.constants.ADD_ONTHEFLY},afterSave:{fn:function(respObj,formObj,fieldControls,page){if(respObj.success){if(control.inputType=='select'){control.addOption(respObj.vals[control.dispField],respObj.vals[control.linkField]);control.setValue([respObj.vals[control.dispField],respObj.vals[control.linkField]],true);}else if(control.inputType=='text'&&control.suggestValues){control.suggestValues.push(respObj.vals[control.dispField]);control.lookupValues.push(respObj.vals[control.linkField]);control.setValue(respObj.vals[control.dispField],respObj.vals[control.linkField],true);}}else
{if(respObj.message!=undefined)
{$('#message_block'+page.id+' div.message').html(respObj.message);}
else
{page.win.setBody(respObj.html);}
$('div.bd').animate({scrollTop:0});return false;}},scope:this}}},addDependentCtrls:function(ctrlsArr){for(var i=0;i<ctrlsArr.length;i++){this.dependentCtrls.push(ctrlsArr[i]);}},clearChildrenLinks:function(triggerReload){for(var i=0;i<this.dependentCtrls.length;i++){if(this.dependentCtrls[i]){this.dependentCtrls[i].clearParent(triggerReload);}}},clearParent:function(triggerReload){this.parentCtrl=null;if(triggerReload===true){this.reload();}},setParentCtrl:function(ctrl){this.parentCtrl=ctrl;},reloadDependeces:function(){if(!this.dependentCtrls||!this.dependentCtrls.length){return false;}
var masterCtrlVal=this.getValue();masterCtrlVal=typeof(masterCtrlVal)=='object'?masterCtrlVal[0]:masterCtrlVal;for(var i=0;i<this.dependentCtrls.length;i++){if(this.dependentCtrls[i]){this.dependentCtrls[i].reload(masterCtrlVal);}}},clearInvalidOnDependences:function(){if(!this.dependentCtrls)
return;for(var i=0;i<this.dependentCtrls.length;i++){if(this.dependentCtrls[i]){this.dependentCtrls[i].clearInvalid();}}},doAutoCompleteFields:function(val){if(this.autoCompleteFields.length){$.ajax({url:'autofillfields.php',type:"GET",dataType:"json",data:{mainTable:Runner.pages.PageSettings.getShortTName(this.table),mainField:this.fieldName,linkField:this.linkField,linkFieldVal:val||this.getValue()},success:(function(respObj){if(!respObj.success){return false;}
var data=respObj.data,valToFill,fillFieldName,ctrl=null;for(var i=0;i<this.autoCompleteFields.length;i++){ctrl=Runner.controls.ControlManager.getAt(this.table,this.id,this.autoCompleteFields[i].masterF);if(!ctrl)
continue;fillFieldName=this.autoCompleteFields[i].lookupF;valToFill=data[fillFieldName];ctrl.setValue(valToFill,true);}}).createDelegate(this)});}},"change":function(e){this.doAutoCompleteFields();this.clearInvalidOnDependences();var vRes=this.validate();if(vRes.result){this.reloadDependeces();return true;}else{return false;}}});Runner.controls.RadioControl=Runner.extend(Runner.controls.LookupWizard,{radioElemsId:"",radioElemsArr:[],radioElemsNameAttr:"",radioElem:null,radioElemsCount:0,constructor:function(cfg){this.radioElemsArr=new Array();cfg.stopEventInit=true;Runner.controls.RadioControl.superclass.constructor.call(this,cfg);this.radioElemsId="radio_"+this.goodFieldName+"_"+this.id+"_";this.radioElemsNameAttr="radio_"+this.goodFieldName+"_"+this.id;this.radioElem=$('input[@name='+this.radioElemsNameAttr+']');this.radioElemsCount=this.radioElem.length;for(var i=0;i<this.radioElemsCount;i++){this.radioElemsArr.push($("#"+this.radioElemsId+i));this.elemsForEvent.push(this.radioElemsArr[i].get(0));}
if(cfg.disabled==true||cfg.disabled=="true"){this.setDisabled();}
this.addEvent(["click"]);this.init();},setValue:function(val,triggerEvent){var choosen=false;for(var i=0;i<this.radioElemsCount;i++){if(this.radioElemsArr[i].val()==val){this.radioElemsArr[i].get(0).checked=true;this.valueElem.val(val);choosen=true;}else{this.radioElemsArr[i].get(0).checked=false;}}
if(triggerEvent===true){this.fireEvent("change");}
return choosen;},setDisabled:function(){for(var i=0;i<this.radioElemsCount;i++){this.radioElemsArr[i].get(0).disabled=true;}
return true;},setEnabled:function(){for(var i=0;i<this.radioElemsCount;i++){this.radioElemsArr[i].get(0).disabled=false;}
return true;},"blur":Runner.emptyFn,"change":Runner.emptyFn,"click":function(e){if(e.target.value!=this.getValue()){this.setValue(e.target.value,false);this.doAutoCompleteFields();return this.validate().result;}else{return true;}},initToolTip:function(text,pageObj){if(this.valueElem.addClass&&this.mode!=Runner.controls.constants.MODE_SEARCH&&this.valueElem.parent().length&&this.valueElem.parent().get(0).nodeName=="SPAN"){this.valueElem.parent().addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj});this.initToolTip=Runner.emptyFn;return true;}else{return false;}}});Runner.controls.DropDownLookup=Runner.extend(Runner.controls.LookupWizard,{multiSel:1,optionsDOM:null,constructor:function(cfg){this.multiSel=cfg.multiSel?cfg.multiSel:1;this.valContId="value"+(cfg.ctrlInd||"")+"_"+cfg.goodFieldName+"_"+cfg.id;this.valueElem=$("#"+this.valContId);if(this.valueElem.length){this.optionsDOM=this.valueElem.get(0).options;}else{this.optionsDOM=[];}
Runner.controls.DropDownLookup.superclass.constructor.call(this,cfg);this.inputType="select";this.defaultValue=this.getValue(true);this.elemsForEvent=[this.valueElem.get(0)];this.init();if(cfg.disabled==true||cfg.disabled=="true"){this.setDisabled();}
if(this.preloadData){this.preload(this.preloadData.vals,this.preloadData.fVal);}},setValue:function(pvals,triggerEvent){var vals=pvals
if(!Runner.isArray(pvals)){vals=[pvals]}
var choosen=0;for(var i=0;i<this.valueElem.get(0).options.length;i++){for(var j=0;j<vals.length;j++){if(this.valueElem.get(0).options[i].value==vals[j]){try{this.optionsDOM[i].selected=true;choosen++;}catch(e){};if(this.multiSel==1){try{this.valueElem.get(0).selectedIndex=i;}catch(e){};}else{break;}}else{try{this.optionsDOM[i].selected=false;}catch(e){};}}
if(choosen>0&&this.multiSel==1){break;}}
if(triggerEvent===true){this.fireEvent("change");}
if(choosen==vals.length&&choosen<=this.multiSel){return true;}else{return false;}},getValue:function(returnArray){var selVals=[];if(this.optionsDOM.length){for(var i=0;i<this.optionsDOM.length;i++){if(this.optionsDOM[i].selected)
selVals.push(this.optionsDOM[i].value)}}else if(this.valueElem.length){for(var i=0;i<this.valueElem.get(0).options.length;i++){if(this.valueElem.get(0).options[i].selected){selVals.push(this.valueElem.get(0).options[i].value);}}}
if(returnArray===true)
return selVals;if(selVals.length>1)
return selVals;else if(selVals.length==1)
return selVals[0];else
return"";},isEmpty:function(){var selVals=this.getValue();if(typeof selVals!='object')
return selVals==="";return false;},clearOptions:function(){var select=this.valueElem.get(0);for(var i=this.optionsDOM.length-1;i>-1;i--){select.remove(i);}},addOption:function(text,val){var opt=new Option(text,val);$(opt).html(text);this.valueElem.append(opt);},addOptionsArr:function(optionsArr){for(var i=0;i<optionsArr.length-1;i=i+2){this.addOption(optionsArr[i+1],optionsArr[i]);}},preload:function(vals,selectValue){this.clearOptions();if(this.multiSel==1){this.addOption(Runner.lang.constants.TEXT_PLEASE_SELECT,"");}
this.addOptionsArr(vals);if(this.optionsDOM.length==2){this.setValue([this.optionsDOM[1].value],false);}else if(this.optionsDOM.length>0){this.setValue([this.optionsDOM[0].value],false);}
if(this.multiSel==1){selectValue=[selectValue];}
this.setValue(selectValue,false);},reload:function(masterCtrlValue){var fName=this.fieldName,tName=this.table,rowId=this.id;if(masterCtrlValue&&!this.parentCtrl){return false;}
var ajaxParams={field:fName,value:(masterCtrlValue!==undefined?masterCtrlValue:''),isExistParent:(this.parentCtrl?1:0),type:this.valueElem[0].tagName,mode:this.mode,rndVal:(new Date().getTime())};var ctrl=this;$.get(this.shortTableName+"_autocomplete.php",ajaxParams,function(respObj,textStatus){if(respObj){respObj=JSON.parse(respObj);}else{respObj={data:{}};}
var data=respObj.data;ctrl.clearOptions();if(ctrl.multiSel==1){ctrl.addOption(Runner.lang.constants.TEXT_PLEASE_SELECT,"");}
ctrl.addOptionsArr(data);if(ctrl.optionsDOM.length==2&&ctrl.multiSel==1){ctrl.setValue([ctrl.optionsDOM[1].value],false);}else if(ctrl.optionsDOM.length==1&&ctrl.multiSel>1){ctrl.setValue([ctrl.optionsDOM[0].value],false);}
ctrl.fireEvent("change");ctrl.clearInvalid();});},setDisabled:function(){if(this.valueElem){this.valueElem.get(0).disabled=true;if(this.addNew){this.addNew.css('visibility','hidden');}
return true;}
return false;},setEnabled:function(){if(this.valueElem){this.valueElem.get(0).disabled=false;if(this.addNew){this.addNew.css('visibility','visible');}
return true;}else{return false;}},getForSubmit:function(){if(!this.valueElem.length){return[];}
var clone=this.valueElem.clone(),selVals=this.getValue(true);var cloneOpt=clone.get(0).options;for(var i=0;i<cloneOpt.length;i++){for(var j=0;j<selVals.length;j++){if(cloneOpt[i].value==selVals[j]){if(this.multiSel==1)
clone.get(0).selectedIndex=i;cloneOpt[i].selected=true;break;}
else
{cloneOpt[i].selected=false;}}}
return[clone];},"blur":Runner.emptyFn});Runner.controls.CheckBoxLookup=Runner.extend(Runner.controls.LookupWizard,{typeElemId:"",typeElem:null,checkBoxCount:0,checkBoxesArr:null,checkBoxNameAttr:"",constructor:function(cfg){this.checkBoxesArr=[];Runner.controls.CheckBoxLookup.superclass.constructor.call(this,cfg);this.inputType="checkbox";this.typeElemId="type_"+this.goodFieldName+"_"+this.id;this.typeElem=$("#"+this.typeElemId);this.dataCheckBoxId="data_"+this.valContId;if(($("#"+this.valContId)).length){var checkBox=$("#"+this.valContId);this.checkBoxesArr.push(checkBox);this.elemsForEvent.push(this.checkBoxesArr[0].get(0));}else{var checkBox,i=0;while(($("#"+this.valContId+"_"+i)).length){checkBox=$("#"+this.valContId+"_"+i);this.checkBoxesArr.push(checkBox);this.elemsForEvent.push(this.checkBoxesArr[i].get(0));i++;}}
if(cfg.disabled==true||cfg.disabled=="true"){this.setDisabled();}
this.addEvent(["click"]);this.init();this.defaultValue=this.getValue();this.checkBoxNameAttr='value_'+this.goodFieldName+'_'+this.id;this.valueElem=$('input[@name^='+this.checkBoxNameAttr+']');},setValue:function(valsArr,triggerEvent){var checkCount=0;for(var i=0;i<this.checkBoxesArr.length;i++){this.checkBoxesArr[i].get(0).checked=false;for(var j=0;j<valsArr.length;j++){if(this.checkBoxesArr[i].val()==valsArr[j]){this.checkBoxesArr[i].get(0).checked=true;checkCount++;break;}}}
if(triggerEvent===true){this.fireEvent("click");}
if(checkCount==valsArr.length&&checkCount<=this.checkBoxesArr.length&&valsArr.length<=this.checkBoxesArr.length){return true;}else{return false;}},getValue:function(){var checkedArr=this.getCheckedBoxes(),valsArr=[];for(var i=0;i<checkedArr.length;i++){valsArr.push(checkedArr[i].val());}
return valsArr;},getStringValue:function(){return this.getValue().join(",");},isEmpty:function(){if(this.getValue().length==0){return true;}else{return false;}},setDisabled:function(){for(var i=0;i<this.checkBoxesArr.length;i++){this.checkBoxesArr[i].get(0).disabled=true;}
return true;},setEnabled:function(){for(var i=0;i<this.checkBoxesArr.length;i++){this.checkBoxesArr[i].get(0).disabled=false;}
return true;},setDisabledShowCheckedBoxes:function()
{for(var i=0;i<this.checkBoxesArr.length;i++)
{if(this.checkBoxesArr[i].get(0).checked)
this.checkBoxesArr[i].get(0).disabled=true;else{var dataId=$('#'+this.dataCheckBoxId+'_'+i);this.checkBoxesArr[i].css("display","none");dataId.css("display","none");dataId.next().css("display","none");}}
return true;},getCheckedBoxes:function(){var chekedArr=[];for(var i=0;i<this.checkBoxesArr.length;i++){if(this.checkBoxesArr[i].get(0).checked){chekedArr.push(this.checkBoxesArr[i]);}}
return chekedArr;},getForSubmit:function(){var checkedArr=this.getCheckedBoxes(),cloneArr=[];for(var i=0;i<checkedArr.length;i++){var realCb=checkedArr[i];var cbClone=document.createElement('input');$(cbClone).attr('type','hidden');$(cbClone).attr('id',realCb.attr('id'));$(cbClone).attr('name',realCb.attr('name'));$(cbClone).val(realCb.val());cloneArr.push(cbClone);}
cloneArr.push(this.typeElem);return cloneArr;},clearCheckBoxes:function(){this.spanContElem.find('div').children().remove().append('<br>');this.checkBoxesArr=[];},addCheckBox:function(text,val){var newCheckBoxId=this.valContId+"_"+this.checkBoxesArr.length;var checkBox=document.createElement("INPUT");$(checkBox).attr("type","checkbox").attr("id",newCheckBoxId).attr("name",this.valContId+'[]').val(val);var label=document.createElement("B");$(label).attr("id","data_"+newCheckBoxId).html(text);this.spanContElem.find('div').append(checkBox).append("&nbsp;").append(label).append("<br/>");this.checkBoxesArr.push($("#"+newCheckBoxId));},addCheckBoxArr:function(optionsArr){for(var i=0;i<optionsArr.length-1;i=i+2){this.addCheckBox(optionsArr[i+1],optionsArr[i]);}},preload:function(vals,selectValue){this.clearCheckBoxes();this.addCheckBoxArr(vals);if(this.checkBoxesArr.length==1){this.setValue([this.checkBoxesArr[0].val()],false);}
this.setValue([selectValue],false);},reload:function(masterCtrlValue){var ctrl=this,fName=this.fieldName,tName=this.table,rowId=this.id;var ajaxParams={field:fName,value:masterCtrlValue,type:this.valueElem[0].tagName,rndVal:(new Date().getTime())};$.get(this.shortTableName+"_autocomplete.php",ajaxParams,function(respObj,textStatus){respObj=JSON.parse(respObj);var data=respObj.data;ctrl.clearCheckBoxes();var data=ctrl.parseContentToValues(txt);if(data===false){return false;}
ctrl.addOptionsArr(data);if(ctrl.checkBoxesArr.length==1){ctrl.setValue([ctrl.checkBoxesArr[0].val()],false);}
ctrl.fireEvent("change");ctrl.clearInvalid();});},"blur":Runner.emptyFn,"click":this["change"]});Runner.controls.TextFieldLookup=Runner.extend(Runner.controls.LookupWizard,{displayId:"",displayElem:null,constructor:function(cfg){Runner.controls.TextFieldLookup.superclass.constructor.call(this,cfg);this.displayId="display_"+this.valContId;this.displayElem=$("#"+this.displayId);this.inputType="text";this.elemsForEvent=[this.displayElem.get(0)];if(cfg.disabled==true||cfg.disabled=="true"){this.setDisabled();}
this.defaultValue=[this.getValue(),this.getDisplayValue()];if(this.preloadData){this.preload(this.preloadData.vals,this.preloadData.fVal);}},setDisplayValue:function(val){if(this.displayElem){return this.displayElem.val(val);}else{return false;}},getDisplayValue:function(){if(this.displayElem){return this.displayElem.val();}else{return false;}},setValue:function(dispVal,hiddVal,triggerEvent){var changed=false;if(this.valueElem.val()!=hiddVal)
changed=true;var isSetHiddVal=this.valueElem.val(hiddVal);if(isSetHiddVal===false){return false;}
if(this.getDisplayValue()!=dispVal)
changed=true;var isSetDispVal=this.setDisplayValue(dispVal);if(isSetDispVal===false){return false;}
if(changed&&triggerEvent===true){this.fireEvent("change");}
return changed;},getValue:function(){return this.valueElem.val();},reset:function(){this.setValue(this.defaultValue[1],this.defaultValue[0]);this.clearInvalid();return true;},setDisabled:function(){if(this.displayElem){this.displayElem.get(0).disabled=true;return true;}else{return false;}},setEnabled:function(){if(this.displayElem){this.displayElem.get(0).disabled=false;return true;}else{return false;}},setFocus:function(triggerEvent){if(this.displayElem.get(0)&&this.displayElem.get(0).disabled!=true){this.displayElem.get(0).focus();if(triggerEvent===true){this.fireEvent("focus");}
this.isSetFocus=true;return true;}else{this.isSetFocus=false;return false;}},removeCSS:function(className){this.displayElem.removeClass(className);},addCSS:function(className){this.displayElem.addClass(className);},getAttr:function(attrName){return this.displayElem.attr(attrName);},getDispElem:function(){return this.displayElem;},isEmpty:function(){return this.getDisplayValue().toString()=="";},preload:function(vals,selectValue){for(var i=0;i<vals.length-1;i=i+2){if(vals[i]==selectValue){this.setValue(vals[i+1],vals[i]);}}},reload:function(masterCtrlValue){var fName=this.fieldName,tName=this.table,rowId=this.id;if(masterCtrlValue&&!this.parentCtrl){return false;}
var ajaxParams={field:fName,value:masterCtrlValue,isExistParent:(this.parentCtrl?1:0),mode:this.mode,type:this.valueElem[0].tagName,rndVal:(new Date().getTime())};var ctrl=this;$.get(this.shortTableName+"_autocomplete.php",ajaxParams,function(respObj,reqStatus){if(!respObj){return;}
respObj=JSON.parse(respObj);var data=respObj.data;if(data.length==2){if(ctrl.getValue()!=data[0]){ctrl.setValue(data[1],data[0],true);}else{ctrl.setValue(data[1],data[0]);}}else{ctrl.setValue("","",true);}
ctrl.clearInvalid();});},initToolTip:function(text,pageObj){if(this.displayElem.addClass&&this.mode!=Runner.controls.constants.MODE_SEARCH){this.displayElem.addClass('titleHintBox').inputHintBox({div:$('#shiny_box'),div_sub:'.shiny_box_body',html:text,incrementLeft:5,pageObj:pageObj});this.initToolTip=Runner.emptyFn;return true;}else{return false;}}});Runner.controls.EditBoxLookup=Runner.extend(Runner.controls.TextFieldLookup,{focusState:false,cursor:-1,suggestValues:null,lookupValues:null,lookupDivId:"",lookupDiv:null,lookupIframeId:"",lookupIframe:null,freeInput:false,isError:false,constructor:function(cfg){this.lookupValues=[];this.suggestValues=[];Runner.controls.EditBoxLookup.superclass.constructor.call(this,cfg);this.lookupDivId='lookupSuggest_'+this.valContId;if(Runner.isIE6){this.lookupIframeId='iFrame_'+this.valContId;}
this.addEvent(["keyup","focus","keydown","blur"]);this.init();},setFrame:function(b){if(b&&this.getDisplayValue()!=""&&!this.freeInput){this.addCSS("highlight");this.isError=true;}else{this.removeCSS("highlight");this.isError=false;}},destructor:function(){Runner.controls.EditBoxLookup.superclass.destructor.call(this);this.destroyDiv();},isEmpty:function(){return Runner.controls.EditBoxLookup.superclass.isEmpty.call(this)||this.isError;},checkKeyCodeForRunSuggest:function(keyCode){return(((keyCode>=65)&&(keyCode<=90))||((keyCode>=48)&&(keyCode<=57))||((keyCode>=96)&&(keyCode<=105))||(keyCode==8)||(keyCode==46)||(keyCode==32)||(keyCode==222));},"keyup":{fn:function(e){if(this.getDisplayValue()==""){this.destroyDiv();this.setFrame(false);this.setValue("","",true);return;}
if(this.freeInput)
{var eventsFlag=(this.getDisplayValue()!=this.getValue());this.setValue(this.getDisplayValue(),this.getDisplayValue(),eventsFlag);}
if(e&&this.checkKeyCodeForRunSuggest(e.keyCode)){this.lookupAjax();}},options:{buffer:200}},"keydown":function(e){var keyCode=e.keyCode;switch(keyCode){case 38:this.moveUp();break;case 40:this.moveDown();break;case 13:this.destroyDiv();this.stopEvent(e);return false;break;}
return true;},showDiv:function(divsArr){this.destroyDiv();if(!divsArr.length)
return;this.lookupDiv=$(document.createElement("DIV"));this.lookupDiv.attr("id",this.lookupDivId).addClass("search_suggest").css("visibility","visible").appendTo(document.body);for(var i=0;i<divsArr.length;i++){this.lookupDiv.append(divsArr[i]);}
if(Runner.isIE6){$(document.body).append('<iframe src="javascript:false;" id="'+this.lookupIframeId+'" frameborder="1" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="background:white;position:absolute;display:block;opacity:0;filter:alpha(opacity=0);"></iframe>');this.lookupIframe=$("#"+this.lookupIframeId);}
this.setDivPos();},destroyDiv:function(){if(this.lookupDiv){this.lookupDiv.remove();}
if(Runner.isIE6&&this.lookupIframe){this.lookupIframe.remove();this.lookupIframe=null;}
this.cursor=-1;this.lookupDiv=null;},setDivPos:function(){if(!this.lookupDiv)
return;var coors=findPos(this.getDispElem().get(0));coors[1]+=coors[3];this.lookupDiv.css("top",coors[1]+"px");this.lookupDiv.css("left",coors[0]+"px");if(Runner.isIE){this.lookupDiv.css("zIndex",++zindex_max);}else{this.lookupDiv.css("z-index",++zindex_max);}
if(Runner.isIE6&&this.lookupIframe){this.lookupIframe.css("top",coors[1]+"px");this.lookupIframe.css("left",coors[0]+"px");this.lookupIframe.css("width",this.lookupDiv.css("width"));this.lookupIframe.css("height",this.lookupDiv.css("height"));}},suggestOver:function(divHovered){this.lookupDiv.find("div.suggest_link_over").each(function(){this.className='suggest_link';});divHovered.className='suggest_link_over';this.cursor=divHovered.id.substring(10);},suggestOut:function(divValue){divValue.className='suggest_link';},lookupAjax:function(){var table=this.table,recId=this.id,fName=this.fieldName,ctrl=this;var ajaxParams={mode:this.mode,table:this.shortTableName,searchFor:this.getDisplayValue(),searchField:this.goodFieldName,lookupValue:this.getValue(),category:(this.parentCtrl?this.parentCtrl.getValue():""),rndVal:(new Date().getTime()),editMode:this.mode}
$.get("lookupsuggest.php",ajaxParams,function(respObj,textStatus){respObj=JSON.parse(respObj);if(!respObj.success){ctrl.setFrame(true);ctrl.destroyDiv();return false;}
var data=respObj.data,dispVal=ctrl.getDisplayValue();ctrl.suggestValues=[];ctrl.lookupValues=[];var found=false;if(ctrl.freeInput){found=true;}
var divsArr=[];for(var i=0,j=0;i<data.length-1;i=i+2,j++)
{if(ctrl.focusState)
{(function(i,j){var suggestDiv=$(document.createElement("DIV")).attr("id","suggestDiv"+i).css("cursor","pointer").addClass("suggest_link").html(data[i+1]).bind("mouseover",function(){ctrl.suggestOver(this);}).bind("mouseout",function(){ctrl.suggestOut(this);}).bind("click",function(){ctrl.setFrame(false);ctrl.setValue(ctrl.suggestValues[j],data[i],true);ctrl.destroyDiv();});divsArr.push(suggestDiv);})(i,j);}
ctrl.suggestValues[j]=data[i+1];ctrl.lookupValues[j]=data[i];if(!found&&ctrl.suggestValues[j]==dispVal)
{var eventsFlag=(ctrl.lookupValues[j]!=ctrl.getValue());ctrl.setValue(ctrl.suggestValues[j],ctrl.lookupValues[j],true);found=true;}}
if(!ctrl.focusState)
{if(found)
{ctrl.setFrame(false);}
else
{ctrl.setFrame(true);var eventsFlag=(ctrl.getValue()!="");ctrl.setValue(dispVal,"",eventsFlag);}
return true;}
if(ctrl.lookupValues.length)
ctrl.setFrame(false);else
ctrl.setFrame(true);ctrl.showDiv(divsArr);ctrl.setDivPos();});},moveDown:function(){if(!this.lookupDiv)
return;if(this.lookupDiv.children().length>0&&this.cursor<this.lookupDiv.children().length){this.cursor++;for(var i=0;i<this.lookupDiv.children().length;i++){if(i==this.cursor){this.setFrame(false);this.lookupDiv.children().get(i).className="suggest_link_over";var suggestVal=this.suggestValues[this.cursor].replace(/\<(\/b|b)\>/gi,""),lookupVal=this.lookupValues[this.cursor];if(this.getValue()!=lookupVal){this.setValue(suggestVal,lookupVal,true);}else{this.setValue(suggestVal,lookupVal);}}
else{this.lookupDiv.children().get(i).className="suggest_link";}}
if(this.cursor==(this.lookupDiv.children().length)){this.cursor=-1;this.focus();}}},moveUp:function(){if(!this.lookupDiv)
return;if(this.lookupDiv.children().length>0&&this.cursor>=-1){this.cursor--;if(this.cursor==-2){this.cursor=this.lookupDiv.children().length-1;this.focus();}
for(var i=0;i<this.lookupDiv.children().length;i++){if(i==this.cursor){this.setFrame(false);this.lookupDiv.children().get(i).className="suggest_link_over";var suggestVal=this.suggestValues[this.cursor].replace(/\<(\/b|b)\>/gi,""),lookupVal=this.lookupValues[this.cursor];if(this.getValue()!=lookupVal){this.setValue(suggestVal,lookupVal,true);}else{this.setValue(suggestVal,lookupVal);}}
else{this.lookupDiv.children().get(i).className="suggest_link";}}}},setDisabled:function()
{var res=Runner.controls.EditBoxLookup.superclass.setDisabled.call(this);if(res){this.addNew.css('visibility','hidden');}
return res;},setEnabled:function()
{var res=Runner.controls.EditBoxLookup.superclass.setEnabled.call(this);if(res){this.addNew.css('visibility','visible');}
return res;},"blur":function(e){this.focusState=false;if(!this.freeInput)
{if(this.suggestValues.length)
{if(this.getDisplayValue()!=""&&!this.suggestValues.isInArray(this.getDisplayValue()))
this.setFrame(true);else
this.setFrame(false);}
this.lookupAjax();}
var ctrl=this;setTimeout(function()
{ctrl.destroyDiv();},250);Runner.controls.EditBoxLookup.superclass["blur"].call(this,e);},"focus":function(e){this.stopEvent(e);this.focusState=true;},setValue:function(dispVal,hiddVal,triggerEvent){var changed=Runner.controls.EditBoxLookup.superclass.setValue.call(this,dispVal,hiddVal,triggerEvent);if(changed&&triggerEvent===true){this.doAutoCompleteFields(hiddVal);this.changeTrigger(null);}},changeTrigger:function(e){Runner.controls.EditBoxLookup.superclass.constructor.superclass["change"].call(this,e);},"change":Runner.emptyFn});Runner.controls.ListPageLookup=Runner.extend(Runner.controls.TextFieldLookup,{selectLinkId:"",selectLinkElem:null,lookupVals:null,selectField:'',isLookupOpen:false,constructor:function(cfg){Runner.controls.ListPageLookup.superclass.constructor.call(this,cfg);this.init();this.selectLinkId="open_lookup_"+this.goodFieldName+"_"+this.id;this.selectLinkElem=$("#"+this.selectLinkId);if(cfg.disabled==true||cfg.disabled=="true"){this.setDisabled();}
var control=this,eventParams={tName:this.lookupTable,pageType:Runner.pages.constants.PAGE_LIST,pageId:this.pageId,lookupCtrl:this,destroyOnClose:true,modal:true,baseParams:{parId:this.id,field:this.fieldName,category:"",table:this.table,firstTime:1,mode:"lookup",editMode:this.mode}};this.selectLinkElem.bind("click",eventParams,function(e){Runner.Event.prototype.stopEvent(e);if(control.parentCtrl){e.data.baseParams.category=control.parentCtrl.getValue();}else{e.data.baseParams.category='';}
control.pageId=Runner.pages.PageManager.openPage(e.data);});},setDisabled:function(){var res=Runner.controls.ListPageLookup.superclass.setDisabled.call(this);if(res){if(this.selectLinkElem){this.selectLinkElem.css('visibility','hidden');}}
return res;},setEnabled:function(){var res=Runner.controls.ListPageLookup.superclass.setEnabled.call(this);if(res){if(this.selectLinkElem){this.selectLinkElem.css('visibility','visible');}}
return res;},setLookupVal:function(valInd){this.setValue(this.lookupVals[valInd].dispVal,this.lookupVals[valInd].linkVal,true);},addLookupVal:function(linkVal,dispVal){return(this.lookupVals.push({'linkVal':linkVal,'dispVal':dispVal})-1);},initLink:function(link,ind){var ctrl=this;link.bind('click',function(e){ctrl.stopEvent(e);ctrl.setLookupVal(ind);Runner.pages.PageManager.unregister(ctrl.lookupTable,ctrl.pageId);ctrl.setFocus();});},initLinks:function(winId){var links=$("a[@type='lookupSelect"+winId+"']");for(var i=0;i<links.length;i++){this.initLink($(links[i]),i);}}});Runner.namespace('Runner.util.inlineEditing');Runner.util.inlineEditing.InlineEditor=Runner.extend(Runner.util.Observable,{addArea:null,tName:"",shortTName:"",id:-1,rows:null,ajaxRequestUrl:null,lookupTable:"",categoryValue:"",lookupField:"",fNames:null,pageType:"",submitUrl:"",isUseInlineEdit:true,isUseIcons:true,isUseEdit:true,isUseCopy:true,isUseView:true,isUseResize:false,mTableName:"",mPageType:"",mStrKey:[],mPageId:0,showEditInPopup:false,showViewInPopup:false,saveAllButt:null,cancelAllButt:null,massRecButtEditMode:false,isUseFileUpload:true,hideRevertButt:false,hideSaveButt:false,baseParams:null,loadSettings:false,isVertLayout:false,constructor:function(cfg){this.rows=[];this.fNames=[];this.baseParams={};Runner.apply(this,cfg);Runner.util.inlineEditing.InlineEditor.superclass.constructor.call(this,cfg);this.initId=this.id;var permis=Runner.pages.PageSettings.getTableData(this.tName,"permissions",{});if(typeof cfg.isUseInlineEdit=="undefined"){this.isUseInlineEdit=Runner.pages.PageSettings.getTableData(this.tName,"isInlineEdit",false)&&permis['edit'];}
if(typeof cfg.isUseEdit=="undefined"){this.isUseEdit=permis['edit'];}
if(typeof cfg.isUseCopy=="undefined"){this.isUseCopy=Runner.pages.PageSettings.getTableData(this.tName,"copy",false)&&permis['add'];}
if(typeof cfg.isUseView=="undefined"){this.isUseView=Runner.pages.PageSettings.getTableData(this.tName,"view",false)&&permis['search'];}
if(typeof cfg.isUseResize=="undefined"){this.isUseResize=Runner.pages.PageSettings.getTableData(this.tName,"isUseResize",false);}
this.addEvents('rowsEdited','createControls','beforeSubmit','afterSubmit','submitFailed','beforeProcessNewRow',"revertRow","validationFailed","afterInit");this.on('rowsEdited',function(){this.toggleMassRecButt();this.calcTotals();},this);this.editAllButt=$("#edit_selected"+this.id);this.isUseIcons=Runner.pages.PageSettings.getTableData(this.tName,"listIcons");this.isVertLayout=Runner.pages.PageSettings.getTableData(this.tName,"isVertLayout");this.rowPref=this.isUseResize?"yui-rec":"gridRow";},initEvents:function(pageType){var events=Runner.pages.PageSettings.getTableData(this.tName,"events",{}),eventHnArr,i;var pageObj=Runner.pages.PageManager.getAt(this.tName,this.id);for(var pType in events){if(pType!=this.pageType){continue;}
for(var evName in events[pType]){if(evName!='afterInit'){continue;}
eventHnArr=events[pType][evName];for(i=0;i<eventHnArr.length;i++){this.on(evName,eventHnArr[i].hn,eventHnArr[i].scope||pageObj||this);}}}},init:function(){this.initButtons();this.initEvents();},reInit:function(id,gridRows){this.rows=gridRows;this.id=id;},initButtons:function(){this.saveAllButt=$("#saveall_edited"+this.id);this.cancelAllButt=$("#revertall_edited"+this.id);var inlineObj=this;this.saveAllButt.bind("click",function(e){inlineObj.saveAll();if(e.stopImmediatePropagation){e.stopImmediatePropagation();}});this.cancelAllButt.bind("click",function(e){if(inlineObj.mPageType&&inlineObj.mPageType==Runner.pages.constants.PAGE_ADD){window['dpInline'+inlineObj.id].inlineAddChangeContent=false;}
inlineObj.cancelAll();if(e.stopImmediatePropagation){e.stopImmediatePropagation();}});},parseForTotals:function(val,format){if(format=='Number'){return parseFloat(val);}else if(format=='Time'){var timeArr=val.split(":");if(timeArr.length!=3){return[0,0,0];}else{timeArr[0]=parseInt(timeArr[0],10);timeArr[1]=parseInt(timeArr[1],10);timeArr[2]=parseInt(timeArr[2],10);return timeArr;}}else{return val.toString().trim();}},calcTotalField:function(fName,format){var fVal,sec=0,s,m,h,d,totalVal=0;for(var i=0;i<this.rows.length;i++){if(typeof this.rows[i].data[fName]=="undefined"){this.getValuesFromSpan(this.rows[i]);}
fVal=this.parseForTotals(this.getValueFromSpan(this.rows[i],fName),format);if(!fVal)
continue;if(format=="Time")
{sec+=fVal[2]+fVal[1]*60+fVal[0]*3600;}
else
{var parsedVal=parseFloat(fVal);if(!isNaN(parsedVal))
{totalVal+=parsedVal;}}}
if(format=='Time'){s=sec%60;sec-=s;sec/=60;m=sec%60;sec-=m;sec/=60;h=sec%24;sec-=h;sec/=24;d=sec;totalVal=(d>0?d+'d ':'')+(h==0?'00':h)+':'+(m>9?m:(m==0?'00':'0'+m))+':'+(s>9?s:(s==0?'00':'0'+s));}
$("#total"+this.id+"_"+Runner.goodFieldName(fName)).html(''+totalVal);},calcCountField:function(fName,format){var fVal,totalVal=0;for(var i=0;i<this.rows.length;i++){if(typeof this.rows[i].data[fName]=="undefined"){this.getValuesFromSpan(this.rows[i]);}
fVal=this.rows[i].data[fName].toString().trim();if(fVal){totalVal++;}}
$("#total"+this.id+"_"+Runner.goodFieldName(fName)).html(''+totalVal);},calcAverageField:function(fName,format){var fVal,sec=0,s,m,h,d,totalVal=0;for(var i=0;i<this.rows.length;i++){if(typeof this.rows[i].data[fName]=="undefined")
{this.getValuesFromSpan(this.rows[i]);}
fVal=this.parseForTotals(this.getValueFromSpan(this.rows[i],fName),format);if(!fVal)
continue;if(format=="Time")
{sec+=fVal[2]+fVal[1]*60+fVal[0]*3600;}
else
{var parsedVal=parseFloat(fVal);if(!isNaN(parsedVal))
totalVal+=parsedVal;}}
if(format=='Time')
{sec=Math.round(sec/this.rows.length);s=sec%60;sec-=s;sec/=60;m=sec%60;sec-=m;sec/=60;h=sec%24;sec-=h;sec/=24;d=sec;totalVal=(d>0?d+'d ':'')+(h==0?'00':h)+':'+(m>9?m:(m==0?'00':'0'+m))+':'+(s>9?s:(s==0?'00':'0'+s));}
else
{totalVal=Math.round((totalVal/this.rows.length)*100)/100;}
$("#total"+this.id+"_"+Runner.goodFieldName(fName)).html(''+totalVal);},calcTotals:function(){for(var i=0;i<this.totalFields.length;i++){if(this.totalFields[i].type=="TOTAL"){this.calcTotalField(this.totalFields[i].fName,this.totalFields[i].format);}else if(this.totalFields[i].type=="COUNT"){this.calcCountField(this.totalFields[i].fName,this.totalFields[i].format);}else if(this.totalFields[i].type=="AVERAGE"){this.calcAverageField(this.totalFields[i].fName,this.totalFields[i].format);}};var totalsTr=$('tr[@rowid=totals]',getTableObj(this.id));if($(totalsTr).css('display')=='none')
$(totalsTr).css('display','');},initForm:function(row){if(row.basicForm){row.basicForm.fieldControls=Runner.controls.ControlManager.getAt(this.tName,row.id);row.basicForm.id=row.id;row.basicForm.fields=this.fNames;}else{var inlineObj=this;var baseParams={a:'added',editType:'inline',id:row.id};if(inlineObj.mPageType!=Runner.pages.constants.PAGE_ADD&&inlineObj.mTableName){baseParams['mastertable']=inlineObj.mTableName;}
if(inlineObj.mPageType!=Runner.pages.constants.PAGE_ADD&&inlineObj.mStrKey.length){for(var i=0;i<inlineObj.mStrKey.length;i++){baseParams['masterkey'+(i+1)]=inlineObj.mStrKey[i];}}
row.basicForm=new Runner.form.BasicForm({fields:this.fNames,fieldControls:Runner.controls.ControlManager.getAt(this.tName,row.id),isFileUpload:this.isUseFileUpload,standardSubmit:false,submitUrl:this.submitUrl,method:'POST',id:row.id,baseParams:Runner.apply(this.baseParams,baseParams),successSubmit:{fn:function(respObj,formObj,fieldControls){if(!respObj.success){this.fireEvent("submitFailed",respObj,this,formObj,fieldControls);inlineObj.makeError(respObj.message,row);}else{this.afterSubmit(row,respObj);}},scope:this},submitFailed:{fn:function(respObj,formObj,fieldControls){if(respObj.success===false){this.makeError(respObj.message,row);}else{this.makeError(respObj,row);}
this.fireEvent("submitFailed",{},this,formObj,fieldControls);},scope:this},beforeSubmit:{fn:function(formObj){this.fireEvent("beforeSubmit",row,this,formObj);},scope:this},validationFailed:{fn:function(formObj,fieldControls){this.fireEvent("validationFailed",formObj,fieldControls);},scope:this}});}},cancelAll:function(){for(var i=0;i<this.rows.length;i++){if(!this.rows[i].submitted){if(this.rows[i].isAdd){Runner.util.inlineEditing.InlineAdd.prototype.cancelButtonHn.call(this,this.rows[i]);i--;}else{Runner.util.inlineEditing.InlineEdit.prototype.cancelButtonHn.call(this,this.rows[i]);}}}
this.toggleMassRecButt();},submit:function(row){this.initForm(row);row.basicForm.submit();},cancelButtonHn:function(){$('div.shiny_box').hide();},getControls:function(row,hideRevertButt,hideSaveButt){var inlineObject=this;var reqParams={rndval:Math.random(),editType:"inline",id:row.id,isNeedSettings:!Runner.pages.PageSettings.checkSettings(this.tName)||this.loadSettings,table:Runner.pages.PageSettings.getShortTName(this.lookupTable),field:Runner.goodFieldName(this.lookupField),category:this.categoryValue};if(inlineObject.mPageType!=Runner.pages.constants.PAGE_ADD&&inlineObject.mTableName){reqParams['mastertable']=inlineObject.mTableName;}
if(inlineObject.mPageType!=Runner.pages.constants.PAGE_ADD&&inlineObject.mStrKey.length){for(var i=0;i<inlineObject.mStrKey.length;i++){reqParams['masterkey'+(i+1)]=inlineObject.mStrKey[i];}}
if(row.keys){var i=0;for(var key in row.keys){i++;reqParams['editid'+i]=escape(row.keys[key]);}}
$.getJSON(this.ajaxRequestUrl,reqParams,function(ctrlsJSON){if(ctrlsJSON.success||ctrlsJSON.success!==false){if(inlineObject.loadSettings&&ctrlsJSON.settings){Runner.pages.PageSettings.addSettings(inlineObject.tName,ctrlsJSON.settings,false);}
inlineObject.makeRowEditable(row,ctrlsJSON);}else{inlineObject.makeError(ctrlsJSON.message,row);}
inlineObject.initLocking(row,ctrlsJSON);inlineObject.getEditBlock(row,hideRevertButt,hideSaveButt);var pageObj=Runner.pages.PageManager.getAt(inlineObject.tName,inlineObject.id);inlineObject.fireEvent('afterInit',pageObj,row.id);});},initLocking:function(row,ctrlsJSON){if(this.pageType!=Runner.pages.constants.PAGE_EDIT)
return;var enableCtrls=ctrlsJSON.enableCtrls;if(enableCtrls==undefined){enableCtrls=ctrlsJSON.settings['tableSettings'][this.tName]['enableCtrls'];}
var confirmTime=ctrlsJSON.confirmTime;if(confirmTime==undefined){confirmTime=ctrlsJSON.settings['tableSettings'][this.tName]['confirmTime'];}
if(Runner.pages.PageSettings.getTableData(this.tName,"locking",false)&&enableCtrls){var sKeys=this.getKeysForLocking(row);var inlineObj=this;window['timeid'+this.id]=setInterval(function(){ConfirmLock(Runner.pages.PageSettings.getShortTName(inlineObj.tName)+'_'+inlineObj.pageType+'.php',inlineObj.tName,sKeys,inlineObj.id,1);},confirmTime*1000);}},makeRowEditable:function(row,ctrlsJSON){for(var i=0;i<this.fNames.length;i++){$('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).html(ctrlsJSON['html'][this.fNames[i]]);}
var ctrlsMap=ctrlsJSON.controlsMap[this.tName][this.pageType][row.id].controls,ctrlsArr=[];for(var i=0;i<ctrlsMap.length;i++){if(!this.fNames.isInArray(ctrlsMap[i].fieldName)){continue;}
ctrlsMap[i].table=this.tName;ctrlsArr.push(Runner.controls.ControlFabric(ctrlsMap[i]));}
for(var i=0;i<ctrlsArr.length;i++){if(!ctrlsArr[i].isLookupWizard){continue;}
if(ctrlsArr[i].parentFieldName&&ctrlsArr[i].skipDependencies!==true){var parentCtrl=Runner.controls.ControlManager.getAt(this.tName,row.id,ctrlsArr[i].parentFieldName);ctrlsArr[i].setParentCtrl(parentCtrl);if(parentCtrl&&parentCtrl.isLookupWizard){parentCtrl.addDependentCtrls([ctrlsArr[i]]);}}}
var pageObj=Runner.pages.PageManager.getAt(this.tName,this.initId);if(!pageObj&&this.mTableName&&this.mPageId){pageObj=Runner.pages.PageManager.getAt(this.mTableName,this.mPageId);}
Runner.pages.RunnerPage.prototype.initToolTips.call(pageObj,ctrlsJSON.controlsMap[this.tName][this.pageType][row.id].toolTips,this.tName);this.fireEvent('createControls',row,ctrlsArr);},getSaveLink:function(row,hideSaveButt){if(row.saveLink&&row.saveLink.length&&hideSaveButt!==true){row.saveLink.show();return row.saveLink;}else if(hideSaveButt===true){return false;}
var link=document.createElement('A');$(link).attr('title',Runner.lang.constants.TEXT_SAVE).addClass('saveEditing').attr('href','').attr('id','saveLink'+row.id);if(hideSaveButt===true){$(link).css('display','none');}
var imgButt=document.createElement('IMG');$(imgButt).attr('src',"images/ok.gif").attr('border','0').appendTo(link);$(imgButt).bind("click",{inlineObj:this,row:row},function(e){Runner.Event.prototype.stopEvent(e);var row=e.data.row,inlineObj=e.data.inlineObj;$('div.shiny_box').hide();inlineObj.submit(row);inlineObj.toggleMassRecButt();});return row.saveLink=$(link);},getCancelLink:function(row,hideRevertButt){if(row.cancelLink&&row.cancelLink.length&&hideRevertButt!==true){row.cancelLink.show();return row.cancelLink;}else if(hideRevertButt===true){return false;}
var link=document.createElement('A');$(link).attr('title',Runner.lang.constants.TEXT_CANCEL).addClass('revertEditing').attr('href','').attr('id','revertLink'+row.id);if(hideRevertButt===true){$(link).css('display','none');}
var imgButt=document.createElement('IMG');$(imgButt).attr('src',"images/cancel.gif").attr('border','0').appendTo(link).bind("click",{inlineObj:this,row:row},function(e){Runner.Event.prototype.stopEvent(e);var inlineObj=e.data.inlineObj;inlineObj.cancelButtonHn(e.data.row);inlineObj.toggleMassRecButt();if(Runner.pages.PageSettings.getTableData(inlineObj.tName,"locking",false)){var sKeys=inlineObj.getKeysForLocking(row);UnlockRecordInline(Runner.pages.PageSettings.getShortTName(inlineObj.tName)+'_'+Runner.pages.constants.PAGE_EDIT+'.php',sKeys,inlineObj.id);}});return row.cancelLink=$(link);},getEditBlock:function(row,hideRevertButt,hideSaveButt){if(!row.saveLink||!row.saveLink.length||!row.cancelLink||!row.cancelLink.length){if(row.iEditLink.length){row.iEditLink.after(this.getCancelLink(row,hideRevertButt)).after(this.getSaveLink(row,hideSaveButt));}else{var span;for(var i=0;i<this.fNames.length;i++){span=$('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i]));if(span.length){span.prepend(this.getCancelLink(row,hideRevertButt)).prepend(this.getSaveLink(row,hideSaveButt));break;}}}}else{this.getCancelLink(row,hideRevertButt);this.getSaveLink(row,hideSaveButt);}},getKeysForLocking:function(row){var sKeys="";for(var key in row.keys){sKeys+=row.keys[key]+"&";}
sKeys=sKeys.substring(0,sKeys.length-1);return sKeys;},revertRow:function(row){Runner.controls.ControlManager.unregister(this.tName,row.id);this.fireEvent('revertRow',row);},removeRowData:function(row,ind){if(row.basicForm&&row.basicForm.destructor){row.basicForm.destructor();}
if(row.row)
row.row.remove();return this.rows.splice(ind||this.getRowInd(row),1);},getRowInd:function(row){for(var i=0;i<this.rows.length;i++){if(this.rows[i].id===row.id){return i;}}
return-1;},getRowById:function(rowId){for(var i=0;i<this.rows.length;i++){if(this.rows[i].id===rowId){return this.rows[i];}}
return false;},makeError:function(msg,row){if(!row.errorDiv){var root=getTableObj(this.id);if(!root){return false;}
var span=$("span[@id^=edit"+row.id+"_]:eq(0)",root);span.append("<div class=error><a href=# id=\"error_"+row.id+"\" style=\"white-space:nowrap;\">"+Runner.lang.constants.TEXT_INLINE_ERROR+" >></a></div>");row.errorDiv=span.find("div");if(!this.errCont){$(document.body).append("<div class=\"inline_error error\"></div>");this.errCont=$("div.inline_error").hide();}
var inlineObj=this;$("#error_"+row.id).bind("mouseover",function(e){inlineObj.errCont.bind("mouseover",function(e){$(this).show();});var coors=findPos(this);coors[0]+=coors[2];coors[1]+=coors[3];inlineObj.errCont.css("top",coors[1]+"px").show().css("left",coors[0]+"px").css("z-index",100);});$("#error_"+row.id).bind("mouseout",function(e){inlineObj.errCont.hide();});}
this.errCont.html(msg);},afterSubmit:function(row,newData){this.fireEvent("beforeProcessNewRow",row,newData.vals,newData.fields,newData.keys);row.data=Runner.apply({},newData.vals);row.keys=newData.keys;row.rowVals=newData.rawVals;Runner.controls.ControlManager.unregister(this.tName,row.id);if(row.checkBox.length&&!newData.noKeys){var checkBoxVal="";for(var key in newData.keys){checkBoxVal+=newData.keys[key]+"&";}
checkBoxVal=checkBoxVal.substring(0,checkBoxVal.length-1);row.checkBox.val(checkBoxVal).show();row.checkBox[0].checked=false;this.changeLinksKeys(row);}
this.setValuesIntoSpans(row);if(newData.noKeys!==true){this.showRowButtons(row);}
row.submitted=true;row.isAdd=false;this.fireEvent('afterSubmit',newData.vals,newData.fields,newData.keys,row.id,newData);if(row.basicForm){setTimeout(function(){row.basicForm.destructor();row.basicForm=null;},0);}
if(this.rows.length==1){$("span[@name=notfound_message"+this.id+"]").remove();}
if(Runner.pages.PageSettings.getTableData(this.tName,"isUseIbox",false)){init_ibox();}},setValuesIntoSpans:function(row){this.fireEvent("beforeSetVals",row,this.fNames,row.data);for(var i=0;i<this.fNames.length;i++){if(typeof row.data[this.fNames[i]]=='undefined'){row.data[this.fNames[i]]="";}
$('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).html(row.data[this.fNames[i]]);if(Runner.pages.PageSettings.getFieldData(this.tName,this.fNames[i],'viewFormat')!=Runner.controls.constants.FORMAT_MAP){var images=$('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).find('img'),src;for(var j=0;j<images.length;j++){src=$(images[j]).attr('src');if(src&&src.indexOf('?')!=-1){$(images[j]).attr('src',(src+"&rndVal="+Math.random()));}else{$(images[j]).attr('src',(src+"?rndVal="+Math.random()));}}}
if($(row.data[this.fNames[i]]).attr('type')=="video/flash"){flowplayer($(row.data[this.fNames[i]]).attr('id'),"include/video/flowplayer-3.2.3.swf",{clip:{autoPlay:false,autoBuffering:false,url:escape($(row.data[this.fNames[i]]).attr("href"))}});}
if($('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).find('a[@type="audio/mpeg"]').length){var audioLink=$('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).find('a[@type="audio/mpeg"]'),link="";var lastInd=document.location.href.lastIndexOf("/");var addHref=document.location.href.substr(0,lastInd+1);if(addHref.substr(7,9)=='localhost'){addHref=addHref.replace('localhost','127.0.0.1');}
link=audioLink.attr("href");if(link.substr(0,4)!="http"){audioLink.attr("href",(addHref+link));}else if(Runner.isIE&&link.substr(0,4)=="http"){link=link.replace('localhost','127.0.0.1');audioLink.attr("href",(link));}
YAHOO.MediaPlayer.addTracks($('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).get(0),null,false);}}
return row.data;},getValuesFromSpan:function(row){row.data={};for(var i=0;i<this.fNames.length;i++){row.data[this.fNames[i]]=$('#edit'+row.id+'_'+Runner.goodFieldName(this.fNames[i])).html();}
return row.data;},getValueFromSpan:function(row,fName){if(row.rowVals){val=row.rowVals[fName];}else{var val=$('#edit'+row.id+'_'+Runner.goodFieldName(fName)).attr('val');if(!val){val=row.data[fName];}}
return val;},initCopyLink:function(link,row){if(Runner.pages.PageSettings.getTableData(this.tName,"showAddInPopup",false)){var editObj=this;$(link).bind("click",function(e){var eventParams={tName:editObj.tName,pageType:Runner.pages.constants.PAGE_ADD,pageId:-1,destroyOnClose:true,parentPage:editObj,modal:true,keys:row.keys,keyPref:"copyid",baseParams:{parId:editObj.id,table:editObj.tName,editType:Runner.pages.constants.ADD_POPUP},afterSave:{fn:function(respObj,formObj,fieldControls,page){if(respObj.success){this.addRowToGrid(respObj);}else{$('#message_block'+page.id+' div.message').html(respObj.message);return false;}},scope:editObj}};Runner.Event.prototype.stopEvent(e);Runner.pages.PageManager.openPage(eventParams);});}
return link;},changeLinksKeys:function(row){var newUrl=Runner.pages.getUrl(this.tName,Runner.pages.constants.PAGE_VIEW,row.keys,'editid')
$(row.viewLink).attr('href',newUrl);var newUrl=Runner.pages.getUrl(this.tName,Runner.pages.constants.PAGE_EDIT,row.keys,'editid')
$(row.editLink).attr('href',newUrl);var newUrl=Runner.pages.getUrl(this.tName,Runner.pages.constants.PAGE_ADD,row.keys,'copyid')
$(row.copyLink).attr('href',newUrl);},initViewLink:function(link,row){if(this.showViewInPopup){var inlineObj=this;$(link).bind("click",function(e){Runner.Event.prototype.stopEvent(e);var eventParams={tName:inlineObj.tName,pageType:Runner.pages.constants.PAGE_VIEW,pageId:-1,destroyOnClose:true,keys:row.keys,modal:true,baseParams:{parId:inlineObj.id,table:escape(inlineObj.tName)}};Runner.pages.PageManager.openPage(eventParams);});}
return link;},initEditLink:function(link,row){if(this.showEditInPopup){var inlineObj=this;$(link).bind("click",function(e){Runner.Event.prototype.stopEvent(e);var eventParams={tName:inlineObj.tName,pageType:Runner.pages.constants.PAGE_EDIT,pageId:-1,destroyOnClose:true,keys:row.keys,modal:true,baseParams:{parId:inlineObj.id,rowId:row.id,table:escape(inlineObj.tName),editType:Runner.pages.constants.EDIT_POPUP},afterSave:{fn:function(respObj,formObj,fieldControls,page){if(respObj.success){this.afterSubmit(row,respObj);}else if(respObj.lockMessage){$('#system_div'+page.id).html(respObj.lockMessage).css('display','block');return false;}else{$('#message_block'+page.id+' div.message').html(respObj.message);$('div.bd').animate({scrollTop:0});return false;}},scope:inlineObj}};Runner.pages.PageManager.openPage(eventParams);});}
return link;},initInlineEditLink:function(link,row){var newUrl=Runner.pages.getUrl(this.tName,Runner.pages.constants.PAGE_EDIT,row.keys,'editid')
$(link).attr('href',newUrl);link.bind("click",{inlineObj:this,row:row},function(e){Runner.Event.prototype.stopEvent(e);var row=e.data.row,inlineObj=e.data.inlineObj;if(inlineObj.inlineEditObj){inlineObj.inlineEditObj.inlineEdit(row);}else{inlineObj.inlineEdit(row);}});return link;},toggleMassRecButt:function(){if(!this.isRowsEditing()){this.saveAllButt.hide().parent().hide();this.cancelAllButt.hide().parent().hide();this.massRecButtEditMode=false;}else{this.saveAllButt.show().parent().show();this.cancelAllButt.show().parent().show();this.massRecButtEditMode=true;}},isRowsEditing:function(){for(var i=0;i<this.rows.length;i++){if(this.rows[i].submitted!=undefined&&!this.rows[i].submitted){return true;}}
return false;},validate:function(){var ctrls,vRes=true;for(var i=0;i<this.rows.length;i++){ctrls=Runner.controls.ControlManager.getAt(this.tName,this.rows[i].id);for(var j=0;j<ctrls.length;j++){if(!ctrls[j].validate().result){vRes=false;}}}
return vRes;},addRowToGrid:function(data){var newAddRow=this.prepareRow(data.vals,true);this.getEditBlock(newAddRow);this.afterSubmit(newAddRow,data);},initRow:function(row){row.submitted=true;row.data={};row.checkBox=$('#check'+this.id+'_'+row.id);row.copyLink=this.initCopyLink($('#copyLink'+row.id),row);row.iEditLink=this.initInlineEditLink($('#iEditLink'+row.id),row);row.editLink=this.initEditLink($('#editLink'+row.id),row);row.viewLink=this.initViewLink($('#viewLink'+row.id),row);},hideRowButtons:function(row){row.viewLink.hide();row.copyLink.hide();row.editLink.hide();row.iEditLink.hide();row.checkBox.hide();},showRowButtons:function(row){row.viewLink.show();row.copyLink.show();row.editLink.show();row.iEditLink.show();row.checkBox.show();if(row.saveLink){row.saveLink.hide();}
if(row.cancelLink){row.cancelLink.hide();}},prepareRow:function(vals,submitted){if(this.rows.length===0){$(getTableObj(this.id)).show();$("#gridHeaderTr"+this.id).show();$("#gridFooterTr"+this.id).show();this.editAllButt.parent().show();this.saveAllButt.parent().show();this.cancelAllButt.parent().show();$("#print_selected"+this.id).parent().show();$("#export_selected"+this.id).parent().show();$("#delete_selected"+this.id).parent().show();}
var newAddRow={row:$("#addarea"+this.id).clone(true),id:Runner.genId(),data:vals,isAdd:true};var pageId=this.id;$("*",newAddRow.row).each(function(j){if(this.id=="editLink_add"+pageId){this.id="editLink"+newAddRow.id;$(this).hide();}else if(this.id=="copyLink_add"+pageId){this.id="copyLink"+newAddRow.id;$(this).hide();}else if(this.id=="check_add"+pageId){this.id="check"+pageId+"_"+newAddRow.id;$(this).hide();}else if(this.id=="viewLink_add"+pageId){this.id="viewLink"+newAddRow.id;$(this).hide();}else if(this.id=="inlineEdit_add"+pageId){this.id="iEditLink"+newAddRow.id;$(this).hide();}else if(this.id.substr(0,7)=="master_"&&this.id.substr(this.id.length-4-pageId.toString().length)=="_add"+pageId){this.id=this.id.substr(0,this.id.length-4-pageId.toString().length)+newAddRow.id;$(this).hide();}else if(this.id.substr(this.id.length-8-pageId.toString().length)=="_preview"+pageId){this.id=this.id.substr(0,this.id.length-pageId.toString().length)+newAddRow.id;var cntDet=$(this).find('span[id^=cntDet]');if($(cntDet).length){var cntDetId=$(cntDet).attr('id');cntDetId+=newAddRow.id;$(cntDet).attr('id',cntDetId);}
$(this).hide();}else if(this.id.substr(0,4+pageId.toString().length)=="add"+pageId+"_"){this.id="edit"+newAddRow.id+'_'+this.id.substr(4+pageId.toString().length);}});this.rows.push(newAddRow);newAddRow.row.attr("id","addArea"+newAddRow.id);newAddRow.row.insertAfter($("#addarea"+this.id));if(!newAddRow.row.next().hasClass("shade")){newAddRow.row.addClass("shade");}
newAddRow.row.show();this.initRow(newAddRow);newAddRow.submitted=false||submitted;return newAddRow;}});Runner.util.inlineEditing.InlineAdd=Runner.extend(Runner.util.inlineEditing.InlineEditor,{constructor:function(cfg){this.pageType='add';Runner.util.inlineEditing.InlineAdd.superclass.constructor.call(this,cfg);this.pageType=Runner.pages.constants.PAGE_ADD;this.ajaxRequestUrl=this.shortTName+"_"+Runner.pages.constants.PAGE_ADD+".php";this.submitUrl=this.shortTName+'_'+Runner.pages.constants.PAGE_ADD+".php";this.addEvents("beforeSetVals");},init:function(){Runner.util.inlineEditing.InlineAdd.superclass.init.call(this);this.initAddButton();},initAddButton:function(){$("#inlineAdd"+this.id).bind("click",{inlineAddObj:this},function(e){Runner.Event.prototype.stopEvent(e);e.data.inlineAddObj.inlineAdd();});},cancelButtonHn:function(row){if(this.mPageType&&this.mPageType==Runner.pages.constants.PAGE_ADD){window['dpInline'+this.id].inlineAddChangeContent=false;}
this.removeRowData(row);Runner.util.inlineEditing.InlineAdd.superclass.cancelButtonHn.call(this);},revertRow:function(row){Runner.util.inlineEditing.InlineAdd.superclass.revertRow.call(this,row);this.removeRowData(row);},saveAll:function(){for(var i=0;i<this.rows.length;i++){if(!this.rows[i].submitted&&this.rows[i].isAdd){this.submit(this.rows[i]);}}},afterSubmit:function(row,newData){Runner.util.inlineEditing.InlineAdd.superclass.afterSubmit.call(this,row,newData);if(row.cancelLink){row.cancelLink.remove();row.cancelLink=null;}
if(row.saveLink){row.saveLink.remove();row.saveLink=null;}
var allVals=[],allKeys=[],allRowIds=[];for(var i=0;i<this.rows.length;i++){allVals.push(this.rows[i].data);allKeys.push(this.rows[i].keys);allRowIds.push(this.rows[i].id);if(this.rows[i].submitted===false){return;}}
this.fireEvent('rowsEdited',allVals,newData.fields,allKeys,allRowIds);},inlineAdd:function(hideRevertButt,hideSaveButt){if(this.mPageType&&this.mPageType==Runner.pages.constants.PAGE_ADD){window['dpInline'+this.id].inlineAddChangeContent=true;}
if(typeof hideRevertButt=="undefined"){hideRevertButt=this.hideRevertButt;}
if(typeof hideSaveButt=="undefined"){hideSaveButt=this.hideSaveButt;}
if(this.rows.length==0){$("span[@name=notfound_message"+this.id+"]").remove();}
var newAddRow=this.prepareRow({},false);this.toggleMassRecButt();this.hideRowButtons(newAddRow);this.getControls(newAddRow,hideRevertButt,hideSaveButt);},linksAfterInlineAdd:function(id,detKeys,mTable)
{if(!mTable)
mTable=this.mTableName;var dTables=Runner.pages.PageSettings.getTableData(mTable,"detailTables",{});for(var t in dTables){if(parseInt(dTables[t]['hideChild']))
continue;var gt=Runner.pages.PageSettings.getShortTName(t),master=$("#master_"+gt+id)[0],preview=$("#"+gt+"_preview"+id)[0],onClick=false,detLink=false;if(master!=undefined){detLink=master;}else if(preview!=undefined){detLink=preview;onClick=true;}else{return false;}
var href=detLink.href,pos=href.indexOf("?");detLink.href=href.substr(0,pos+1)+detKeys[gt];if(onClick){inlineAdd=this;detLink.onclick=this.closure(t,id);}
if($(detLink).css('display')=='none'){$(detLink).show();}}},closure:function(t,id){return function(){window['dpInline'+inlineAdd.id].showDPInline(t,id,this);return false;};}});Runner.util.inlineEditing.InlineEdit=Runner.extend(Runner.util.inlineEditing.InlineEditor,{constructor:function(cfg){Runner.util.inlineEditing.InlineEdit.superclass.constructor.call(this,cfg);this.ajaxRequestUrl=this.shortTName+"_"+Runner.pages.constants.PAGE_EDIT+".php";this.pageType=Runner.pages.constants.PAGE_EDIT;this.submitUrl=this.shortTName+'_'+Runner.pages.constants.PAGE_EDIT+".php";this.addEvents("beforeEditRow");},init:function(){Runner.util.inlineEditing.InlineEdit.superclass.init.call(this);this.initRows();},initRows:function(){for(var i=0;i<this.rows.length;i++){this.initRow(this.rows[i]);}},initInlineRowEditors:function(){for(var i=0;i<this.rows.length;i++){this.getInlineButtBlock(this.rows[i]);}},initButtons:function(){Runner.util.inlineEditing.InlineEdit.superclass.initButtons.call(this);this.initEditAll();},initEditAll:function(id){if(typeof id=="undefined"){id=this.id;}
var inlineObj=this;this.editAllButt.unbind("click").bind("click",function(e){var selBoxes=$('input[@type=checkbox][@checked][@id^=check'+id+'_]'),row,checkBox;for(var i=0;i<selBoxes.length;i++){for(var j=0;j<inlineObj.rows.length;j++){checkBox=inlineObj.rows[j].checkBox;if($(checkBox[0]).attr('id')==$(selBoxes[i]).attr('id')){row=inlineObj.rows[j];inlineObj.inlineEdit(row);}}}
inlineObj.toggleMassRecButt();});},reInit:function(id,gridRows){Runner.util.inlineEditing.InlineEdit.superclass.reInit.call(this,id,gridRows);this.initEditAll(id);this.initRows();this.cancelAll();},inlineEdit:function(row,hideRevertButt,hideSaveButt){if(typeof hideRevertButt=="undefined"){hideRevertButt=this.hideRevertButt;}
if(typeof hideSaveButt=="undefined"){hideSaveButt=this.hideSaveButt;}
this.fireEvent("beforeEditRow",row);row.submitted=false;this.toggleMassRecButt();this.getValuesFromSpan(row);this.hideRowButtons(row);this.getControls(row,hideRevertButt,hideSaveButt);},editRecByInd:function(ind){var row=false;for(var i=0;i<this.rows.length;i++){if(this.rows[i].id==ind){row=this.rows[i];break;}}
if(row){this.inlineEdit(row);return true;}
return false;},editAllRecs:function(){for(var i=0;i<this.rows.length;i++){this.inlineEdit(this.rows[i]);}},getRecsId:function(){var recsId={};for(var i=0;i<this.rows.length;i++){recsId[i+1]=this.rows[i].id;}
return recsId;},revertRow:function(row){row.submitted=true;row.errorDiv=false;if(row.checkBox.length){row.checkBox[0].checked=false;}
Runner.util.inlineEditing.InlineEdit.superclass.revertRow.call(this,row);this.showRowButtons(row);this.setValuesIntoSpans(row);row.checkBox.show();},initForm:function(row){Runner.util.inlineEditing.InlineEdit.superclass.initForm.call(this,row);row.basicForm.baseParams={a:'edited',editType:'inline',id:row.id};var i=0;for(var key in row.keys){i++;row.basicForm.baseParams["editid"+i]=row.keys[key];}},cancelButtonHn:function(row){this.revertRow(row);Runner.util.inlineEditing.InlineEdit.superclass.cancelButtonHn.call(this);},toggleMassRecButt:function(){Runner.util.inlineEditing.InlineEdit.superclass.toggleMassRecButt.call(this);if(this.massRecButtEditMode){this.editAllButt.hide().parent().hide();}else{this.editAllButt.show().parent().show();}},afterSubmit:function(row,newData){Runner.util.inlineEditing.InlineEdit.superclass.afterSubmit.call(this,row,newData);var allVals=[],allKeys=[],allRowIds=[];for(var i=0;i<this.rows.length;i++){allVals.push(this.rows[i].data);allKeys.push(this.rows[i].keys);allRowIds.push(this.rows[i].id);if(this.rows[i].submitted===false){return;}}
this.fireEvent('rowsEdited',allVals,newData.fields,allKeys,allRowIds);},saveAll:function(){for(var i=0;i<this.rows.length;i++){if(!this.rows[i].submitted&&!this.rows[i].isAdd){this.submit(this.rows[i]);}}}});