
var dpCntParse;function detailsPreviewInline(params){this.prm=params;this.dpCntParse=null;this.allRecordsSaved=false;this.submitFailed=false;this.isShowErrorHappend=true;this.getRowId=function(rPrm){var tr=this.getCurrentTr(rPrm);if(!tr){return false;}
if($(tr).attr("rowid")){return $(tr).attr("rowid");}else{return $(tr).attr("id").substring(7);}}
this.getCurrentTr=function(rPrm){var trParents=$(rPrm.linkId,this.prm.table).parents("tr");if(!trParents.length){if(this.isShowErrorHappend){this.showErrorHappend(rPrm,"Couldn't get parent elements TR for clicked link preview");}
return;}
for(var i=0;i<trParents.length;i++){if($(trParents[i]).attr("rowid")||$(trParents[i]).attr("id")){break;}}
if(i==trParents.length){if(this.isShowErrorHappend){this.showErrorHappend(rPrm,"Couldn't find parent element TR for clicked link preview");}
return;}
return trParents[i];}
this.cloneTRforPreview=function(rPrm)
{var rowId=this.getRowId(rPrm);if(!rowId){return false;}
var colsCount=new Array();var start=0,myplace=0,myPlaceFound=false;var tr=this.getCurrentTr(rPrm);if(!tr){return false;}
var trChildren=$(tr).children("td");var tdParents=$(rPrm.linkId,this.prm.table).parents("td");if(!tdParents.length){if(this.isShowErrorHappend){this.showErrorHappend(rPrm,"Couldn't get parent elements TD for clicked link preview");}
return false;}
for(var i=0;i<trChildren.length;i++){if(!myPlaceFound){for(var j=0;j<tdParents.length;j++){if(tdParents[j]==trChildren[i]){myPlace=colsCount.length;myPlaceFound=true;break;}}}
if($(trChildren[i]).attr("colid")=="endrecord"){colsCount[colsCount.length]=i-start;start=i+1;}}
colsCount[colsCount.length]=i-start;var previewTr=$(tr).clone();$(previewTr).attr("id","dpreviewrow_"+this.prm.mSTable+"_"+rowId);$(previewTr).insertAfter(tr);previewTr=$("#dpreviewrow_"+this.prm.mSTable+"_"+rowId)[0];$("td[@colid!=endrecord]",previewTr).remove();trChildren=$(previewTr).children("td");var recId=parseInt(rPrm.recId);for(var i=0;i<trChildren.length;i++){$(trChildren[i]).before("<td id=\"dpreview_"+this.prm.mSTable+"_"+(recId+i-myPlace)+"\" valign=\"top\" colspan="+colsCount[i]+"></td>");}
if(i){$(trChildren[i-1]).after("<td id=\"dpreview_"+this.prm.mSTable+"_"+(recId+i-myPlace)+"\" valign=\"top\" colspan="+colsCount[i]+"></td>");}else{$(previewTr).html("<td id=\"dpreview_"+this.prm.mSTable+"_"+(recId+i-myPlace)+"\" valign=\"top\" colspan="+colsCount[i]+"></td>");}
return true;}
this.createPreviewTr=function(rPrm){var rowId=this.getRowId(rPrm);if(!rowId){return false;}
if(!$("#dpreviewrow_"+this.prm.mSTable+"_"+rowId,this.prm.table)[0]){if(!this.cloneTRforPreview(rPrm)){return false;}}else{var dpInline=this;var dTables=Runner.pages.PageSettings.getTableData(dpInline.prm.mTable,"detailTables",{});$("a[id$=_preview"+rPrm.recId+"]",dpInline.prm.table).each(function(){if(this!=$(rPrm.linkId,dpInline.prm.table)[0]){var pos=this.id.lastIndexOf("_preview");if(pos<0){return false;}
var dShortTNameLink=this.id.substring(0,pos);for(var t in dTables){var dShortTName=Runner.pages.PageSettings.getShortTName(t);if(dShortTName==dShortTNameLink){this.onclick=function(){dpInline.showDPInline(t,rPrm.recId,this);return false;};break;}}}});}
return true;}
this.showDPInline=function(dTable,recId,link){var table=getTableObj(this.prm.pageId);if(!table){return false;}
this.prm.table=table;var linkId="#"+link.id;var dCaption=$(link).attr('caption');var id=Runner.genId();var dShortTable=Runner.pages.PageSettings.getShortTName(dTable);var rPrm={'id':id,'recId':recId,'link':link,'linkId':linkId,'dTable':dTable,'dShortTable':dShortTable,'dCaption':dCaption,'firstTime':1};if(!this.createPreviewTr(rPrm)){return;}
var tdPreview=$("#dpreview_"+this.prm.mSTable+"_"+recId,this.prm.table)[0];var mData=this.getMasterData(link);if(!mData){if(this.isShowErrorHappend){this.showErrorHappend(rPrm,"Couldn't get master's data");}
return false;}
var url=dShortTable+"_list.php"+mData.query;tdPreview.style.borderWidth="1px";tdPreview.style.borderStyle="solid";tdPreview.style.borderColor="darkgray";$(tdPreview).css('text-align','left');$(tdPreview).parent().attr('class','');$(tdPreview).empty();runLoading(id,tdPreview,3);this.setLinkForHide(rPrm,rPrm.linkId);$(tdPreview).ajaxError(function(event,request,settings){$(this).html("<span class='error'>Error requesting page "+settings.url+"</span>");});var dpInline=this;$.get(url,{id:id,mode:"listdetails",counter:0,firsttime:1,masterid:dpInline.prm.pageId,masterpagetype:dpInline.prm.mPageType,mainmasterpagetype:dpInline.prm.mainMPageType,rndVal:(new Date().getTime())},function(xml){var pos=xml.indexOf("<jscode>");var pos1=xml.indexOf("</jscode>");var js="";if(pos>=0&&pos1>=0){js=slashdecode(xml.substr(pos+8,pos1-pos-8));txt=xml.substr(pos1+9);}
dpInline.DisplayPreview(txt,js,rPrm);});}
this.DisplayPreview=function(html,js,rPrm){var hide="";if(this.prm.mode=='list_details_edit_add'||rPrm.mode=='list_details_edit_add'){var dPreview=$("#detailPreview"+this.prm.pageId)[0];if(!dPreview){return;}}else if(this.prm.mode=='list_details'){var dPreview=$("#dpreview_"+this.prm.mSTable+"_"+rPrm.recId,this.prm.table)[0];if(dPreview){hide=this.getHtmlForHide(rPrm);var tdPreview=dPreview;var io=this.createPreviewIframe(rPrm);var form=this.createPreviewForm(rPrm);}else{if(this.isShowErrorHappend){this.showErrorHappend(rPrm,"Couldn't find element TD for preview content");}
return;}}else{if($("#dpreview_"+this.prm.mSTable+"_"+rPrm.recId,this.prm.table).length){this.prepareForHide(rPrm);}
if(this.isShowErrorHappend){this.showErrorHappend(rPrm,"Undefined type of mode for showing preview");}
return;}
var id=(rPrm&&rPrm.id?rPrm.id:this.prm.pageId);var loadedContent=$('#loaded_content'+id);if($(loadedContent).length){dPreview=loadedContent;}
$(dPreview).empty();$(dPreview).html(html);if(this.prm.mode=='list_details'){var dpRecords=$("#dpRecords"+id)[0];if(dpRecords&&dpRecords.offsetWidth>tdPreview.offsetWidth){$(tdPreview).attr('width',dpRecords.offsetWidth+(dpRecords.offsetWidth-tdPreview.offsetWidth));}}
if(hide){$(dPreview).prepend(hide);this.setLinkForHide(rPrm,"#dpClose"+rPrm.id);}
var delInd=js.indexOf('/del/');if(delInd!=-1){var delRec=js.substr(delInd+5);this.updateCntRecsDetail(rPrm,parseInt(delRec),'delete');var jscode=js.substr(0,delInd);if(jscode.length){eval(jscode);}}else if(js.length){eval(js);}
this.setdpCntParse();if(rPrm){this.init(rPrm);}}
this.setdpCntParse=function(){if(dpCntParse!==null&&dpCntParse!==undefined){this.dpCntParse=dpCntParse;dpCntParse=null;}}
this.init=function(rPrm){if(rPrm.firstTime){this.initDetails(rPrm);}else if(this.prm.mainMPageType!=Runner.pages.constants.PAGE_ADD){this.initResize(rPrm.id,rPrm.dTable,0);if(this.prm.mainMPageType!=Runner.pages.constants.PAGE_ADD)
this.initMaps(rPrm.id,rPrm.dTable);this.preInitMedia(rPrm.dTable,rPrm.id,rPrm.mTableName,rPrm.mPageType,rPrm.mId);}
if(this.prm.mainMPageType!=Runner.pages.constants.PAGE_VIEW)
this.initInline(rPrm);if(this.prm.mainMPageType!=Runner.pages.constants.PAGE_ADD)
this.initPagination(rPrm);}
this.initPagination=function(rPrm){var mpt="";var query="&id="+rPrm.id+"&mode=listdetails";if(this.prm.mainMPageType==Runner.pages.constants.PAGE_VIEW){query+="&mainmasterpagetype="+this.prm.mainMPageType;}
if(rPrm.link){var mData=this.getMasterData(rPrm.link);query=mData.query+query;if(this.prm.mainMPageType==Runner.pages.constants.PAGE_VIEW||this.prm.mainMPageType==Runner.pages.constants.PAGE_EDIT){mpt="&masterpagetype="+this.prm.mPageType;}else{mpt+="&masterid="+this.prm.pageId;}}else{var strKey=Runner.pages.PageSettings.getTableData(rPrm.dTable,"strKey",new Array());query="?mastertable="+rPrm.mTableName+query;if(this.prm.mainMPageType==Runner.pages.constants.PAGE_VIEW||this.prm.mainMPageType==Runner.pages.constants.PAGE_EDIT){mpt+="&masterpagetype="+rPrm.mPageType;}else{mpt+="&masterid="+rPrm.mId;}
for(var i=0;i<strKey.length;i++){query+="&masterkey"+(i+1)+"="+strKey[i];}}
query+=mpt;$("table[@name=paginationTable"+rPrm.id+"]").bind("click",function(e){Runner.Event.prototype.stopEvent(e);var target=Runner.Event.prototype.getTarget(e);if(target.nodeName!="A"){return false;}
var pageNum=$(target).attr("pageNum");var url=Runner.pages.getUrl(rPrm.dTable,Runner.pages.constants.PAGE_LIST,{})+query+"&goto="+pageNum;window.frames['flyframe'+rPrm.id].location=url;});}
this.preInitMedia=function(dTable,id,mTableName,mPageType,mId){if(!mPageType)
mPageType=this.prm.mainMPageType;if(mPageType==Runner.pages.constants.PAGE_EDIT||mPageType==Runner.pages.constants.PAGE_VIEW)
this.initMedia(dTable,id,mTableName,mPageType,mId);else if(mPageType==Runner.pages.constants.PAGE_LIST)
this.initMedia(dTable,id);}
this.initMedia=function(dTable,dId,mTableName,mPageType,mId){this.initAudio(dTable,dId);this.initVideo(dTable,dId,mTableName,mPageType,mId);}
this.initVideo=function(dTable,dId,mTableName,mPageType,mId){if(!Runner.pages.PageSettings.getTableData(dTable,"isUseVideo",false)){return false;}
var videoMap=new Array();if(this.dpCntParse!=null){videoMap=this.dpCntParse[dTable][this.prm.mPageType][dId]['video'];}else{mMap=Runner.pages.PageControlsMap.getMap(mTableName,mPageType,mId);if(mMap['dControlsMap'][dTable])
videoMap=mMap['dControlsMap'][dTable]['video'];}
for(var i=0;i<videoMap.length;i++){if($('#'+videoMap[i]).length){flowplayer(videoMap[i],"include/video/flowplayer-3.2.3.swf",{clip:{autoPlay:false,autoBuffering:false,url:escape($("#"+videoMap[i]).attr("href"))}});}}}
this.initAudio=function(dTable,dId){if(!Runner.pages.PageSettings.getTableData(dTable,"isUseAudio",false)){return false;}
this.preprocessAudioLinks();if(!YAHOO.mediaplayer.loadPlayerScript.bCalled){YAHOO.mediaplayer.loadPlayerScript();}else if(dId){if($("#fields_block"+dId).length>0){YAHOO.MediaPlayer.addTracks($("#fields_block"+dId).get(0));}else if($("#grid_block"+dId).length>0){YAHOO.MediaPlayer.addTracks($("#grid_block"+dId).get(0));}}}
this.preprocessAudioLinks=function(){var audioLinks=$(".htrack");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');}
for(var i=0;i<audioLinks.length;i++){var link=$(audioLinks[i]).attr("href");if(link.substr(0,4)=="http"){var fixedLink=link.replace('http://localhost','http://127.0.0.1');if(link!=fixedLink){$(audioLinks[i]).attr("href",fixedLink);}}
else{$(audioLinks[i]).attr("href",(addHref+link));}}
return audioLinks.length;}
this.initForGrid=function(id){this.initHeaderCheckBox(id);this.initSelectAll(id);$(getParentTableObj(id)).bind("click",this.gridClickHn.createDelegate(this,[],true,id));}
this.initHeaderCheckBox=function(id){var pageId=id;$('#chooseAll_'+id).bind("click",function(e){var selBoxes=$('input[@type=checkbox][@id^=check'+pageId+'_]');for(var i=0;i<selBoxes.length;i++){selBoxes[i].checked=$(this).attr('checked');}
if(e.stopImmediatePropagation){e.stopImmediatePropagation();}});}
this.initSelectAll=function(id){var pageId=id,selectAll=$('#select_all'+id);if(!$('#select_all'+id).length){return false;}
$('#select_all'+id)[0].checkAllStatus=false;$('#select_all'+id).bind("click",function(e){this.checkAllStatus=!this.checkAllStatus;var selBoxes=$('input[@type=checkbox][@id^=check'+pageId+'_]');for(var i=0;i<selBoxes.length;i++){selBoxes[i].checked=this.checkAllStatus;}
if(e.stopImmediatePropagation){e.stopImmediatePropagation();}});}
this.gridClickHn=function(e,id){this.largeTextOpenerDelegate(e,id);}
this.largeTextOpenerDelegate=function(e,id){var target=Runner.Event.prototype.getTarget(e);if(target.nodeName!="A"||!$(target).attr("query")){return false;}
Runner.Event.prototype.stopEvent(e);var query=$(target).attr("query");var winId=Runner.genId();var fullTextWin=new YAHOO.widget.Panel("fullText"+winId,{draggable:true,height:"400px",width:"500px",fixedcenter:true});$.get(query,{id:id,rndVal:Math.random()},function(respObj){respObj=JSON.parse(respObj);if(respObj.success){fullTextWin.setBody(respObj.textCont);}else{fullTextWin.setBody(respObj.error||"Server error");}
fullTextWin.render(document.body);fullTextWin.bringToTop();fullTextWin.subscribe('drag',function(eventName,args,newScope){this.bringToTop();});var resize=new YAHOO.util.Resize("fullText"+winId,{handles:["br"],autoRatio:false,minWidth:300,minHeight:100,status:false});resize.on("startResize",function(args){if(this.cfg.getProperty("constraintoviewport")){var D=YAHOO.util.Dom;var clientRegion=D.getClientRegion();var elRegion=D.getRegion(this.element);resize.set("maxWidth",clientRegion.right-elRegion.left-YAHOO.widget.Overlay.VIEWPORT_OFFSET);resize.set("maxHeight",clientRegion.bottom-elRegion.top-YAHOO.widget.Overlay.VIEWPORT_OFFSET);}else{resize.set("maxWidth",null);resize.set("maxHeight",null);}},fullTextWin,true);resize.on("resize",function(args){var panelHeight=args.height;this.cfg.setProperty("height",panelHeight+"px");var panelWidth=args.width;this.cfg.setProperty("width",panelWidth+"px");},fullTextWin,true);});fullTextWin.setHeader("&nbsp;");fullTextWin.setFooter("&nbsp;");}
this.initDetails=function(rPrm){if(Runner.pages.PageSettings.getTableData(rPrm.dTable,"isUseDP",false)){var mPageType=Runner.pages.constants.PAGE_LIST;window["dpInline"+rPrm.id]=new detailsPreviewInline({'pageId':rPrm.id,'mSTable':rPrm.dShortTable,'mTable':rPrm.dTable,'mPageType':mPageType,'mainMPageType':Runner.pages.PageSettings.getTableData(rPrm.dTable,"mainMPageType",mPageType),'mode':'list_details','ext':Runner.pages.PageSettings.getGlobalData('ext',"")});}}
this.initResize=function(id,dTable,firstTime){if(Runner.pages.PageSettings.getTableData(dTable,"isUseResize",false)){var permis=Runner.pages.PageSettings.getTableData(dTable,"permissions",{});var recId=Runner.pages.PageSettings.getTableData(dTable,"recIdStart",0);prepareForCreateTable({'id':id,'recId':recId,'tName':Runner.pages.PageSettings.getShortTName(dTable),'firstTime':firstTime,'useInlineAdd':(Runner.pages.PageSettings.getTableData(dTable,"isInlineAdd",false)?1:0),'showAddInPopup':(Runner.pages.PageSettings.getTableData(dTable,"showAddInPopup",false)?1:0),'permisAdd':(permis.add?1:0),'numRows':(Runner.pages.PageSettings.getTableData(dTable,"numRows",0)?1:0)});}
this.initForGrid(id);}
this.initMaps=function(id,dTable,mTableName,mPageType,mId){if(!window.google||!window.google.maps){var table=getTableObj(id);$(table).find('div[@id^=littleMap_]').each(function(){$(this).css('width','0px');$(this).css('height','0px');});return false;}
var dpInline=this;if(!mPageType)
mPageType=Runner.pages.constants.PAGE_LIST;var gMaps=null;if(this.dpCntParse!=null){gMaps=this.dpCntParse[dTable][mPageType][id]['gMaps'];}else{var mMap=Runner.pages.PageControlsMap.getMap(mTableName,mPageType,mId);if(mMap['dControlsMap'][dTable])
gMaps=mMap['dControlsMap'][dTable]['gMaps'];mPageType=mPageType;}
if(!gMaps||!gMaps.isUseGoogleMap){return false;}
this.mapManager=new Runner.controls.MapManager(gMaps);this.mapManager.init();var permis=Runner.pages.PageSettings.getTableData(dTable,"permissions",{});if(Runner.pages.PageSettings.getTableData(dTable,"isInlineEdit",false)&&permis['edit']&&this.inlineEdit){this.inlineEdit.on('afterSubmit',function(vals,fields,keys,recId){for(var i=0;i<fields.length;i++){if(this.isFieldIsMap(fields[i])){var mapDiv=this.getMapDiv("FIELD_MAP",recId,fields[i]);var span=$("#edit"+recId+"_"+fields[i]);$(mapDiv).appendTo(span);this.initMap(mapDiv.id);}else if(this.isFieldCenterLink(fields[i])){var mapCenterLink=this.getCenterLink(recId,vals[fields[i]],this.isFieldCenterLink(fields[i]));var span=$("#edit"+recId+"_"+fields[i]);$(mapCenterLink).appendTo(span);this.initCenterLink($(mapCenterLink));}}
this.updateAfterEdit(recId,vals);},this.mapManager);}
if(Runner.pages.PageSettings.getTableData(dTable,"isInlineAdd",false)&&permis['add']&&this.inlineAdd){this.inlineAdd.on('afterSubmit',function(vals,fields,keys,recId){var j=0,viewQuery="";for(key in keys){j++;viewQuery+="editid"+i+"="+keys[key];}
var recordVals={viewKey:viewQuery,recId:recId};Runner.apply(recordVals,vals);this.updateAfterAdd(recId,vals);for(var i=0;i<fields.length;i++){if(this.isFieldIsMap(fields[i])){var mapDiv=this.getMapDiv("FIELD_MAP",recId,fields[i]);var span=$("#edit"+recId+"_"+fields[i]);$(mapDiv).appendTo(span);this.initMap(mapDiv.id);this.refreshMaps(recId,viewQuery);}else if(this.isFieldCenterLink(fields[i])){var mapCenterLink=this.getCenterLink(recId,vals[fields[i]],this.isFieldCenterLink(fields[i]));var span=$("#edit"+recId+"_"+fields[i]);$(mapCenterLink).appendTo(span);this.initCenterLink($(mapCenterLink));}}},this.mapManager);}}
this.initInline=function(rPrm)
{var dpInline=this;var mPageType=Runner.pages.constants.PAGE_LIST;var permis=Runner.pages.PageSettings.getTableData(rPrm.dTable,"permissions",{});if(!Runner.pages.PageSettings.getTableData(rPrm.dTable,"isInlineEdit",false)&&!permis['edit']&&!Runner.pages.PageSettings.getTableData(rPrm.dTable,"isInlineAdd",false)&&!permis['add']){return;}
if(this.dpCntParse!=null){var gridRows=this.dpCntParse[rPrm.dTable][mPageType][rPrm.id]['gridRows'];}else{var mMap=Runner.pages.PageControlsMap.getMap(rPrm.mTableName,rPrm.mPageType,rPrm.mId);var gridRows=mMap['dControlsMap'][rPrm.dTable]['gridRows'];mPageType=rPrm.mPageType;}
if(mPageType!=Runner.pages.constants.PAGE_ADD&&Runner.pages.PageSettings.getTableData(rPrm.dTable,"isInlineEdit",false)&&permis['edit']){this.inlineEdit=new Runner.util.inlineEditing.InlineEdit({tName:rPrm.dTable,shortTName:rPrm.dShortTable,id:rPrm.id,mTableName:(rPrm.mTableName?rPrm.mTableName:dpInline.prm.mTable),mPageType:(rPrm.mPageType?rPrm.mPageType:dpInline.prm.mPageType),mPageId:(rPrm.mId?rPrm.mId:dpInline.prm.pageId),mStrKey:Runner.pages.PageSettings.getTableData(rPrm.dTable,"strKey",new Array()),fNames:Runner.pages.PageSettings.getTableData(rPrm.dTable,"listFields",{}),rows:gridRows,totalFields:Runner.pages.PageSettings.getTableData(rPrm.dTable,"totalFields",[]),isUseInlineEdit:true,isUseEdit:false,isUseCopy:false,isUseView:false,recordsSaved:true});this.inlineEdit.init();this.inlineEdit.on("beforeSubmit",function(e){this.inlineEdit.recordsSaved=false;if(this.submitFailed){this.submitFailed=false;}},this);this.inlineEdit.on("rowsEdited",function(e){this.inlineEdit.recordsSaved=true;if(this.inlineAdd){if(this.inlineAdd.recordsSaved){this.allRecordsSaved=true;}}
else
this.allRecordsSaved=true;},this);this.inlineEdit.on("validationFailed",function(formObj,fieldControls){this.submitFailed=true;},this);this.inlineEdit.on("submitFailed",function(respObj,inlineObj,formObj,fieldControls){this.submitFailed=true;},this);}
if(Runner.pages.PageSettings.getTableData(rPrm.dTable,"isInlineAdd",false)&&permis['add']){this.inlineAdd=new Runner.util.inlineEditing.InlineAdd({tName:rPrm.dTable,shortTName:rPrm.dShortTable,id:rPrm.id,mTableName:(rPrm.mTableName?rPrm.mTableName:dpInline.prm.mTable),mPageType:(rPrm.mPageType?rPrm.mPageType:dpInline.prm.mPageType),mPageId:(rPrm.mId?rPrm.mId:dpInline.prm.pageId),mStrKey:Runner.pages.PageSettings.getTableData(rPrm.dTable,"strKey",new Array()),fNames:Runner.pages.PageSettings.getTableData(rPrm.dTable,"listFields",{}),rows:gridRows,inlineEditObj:this.inlineEdit,totalFields:Runner.pages.PageSettings.getTableData(rPrm.dTable,"totalFields",[]),isUseInlineEdit:Runner.pages.PageSettings.getTableData(rPrm.dTable,"isInlineEdit",true),isUseEdit:false,isUseCopy:false,isUseView:false,recordsSaved:true,hideSaveButt:mPageType==Runner.pages.constants.PAGE_ADD});this.inlineAdd.init();if(this.inlineEdit){this.inlineEdit.inlineAddObj=this.inlineAdd;}
this.inlineAdd.on("beforeSubmit",function(e){this.inlineAdd.recordsSaved=false;if(this.submitFailed){this.submitFailed=false;}},this);this.inlineAdd.on("rowsEdited",function(e){this.inlineAdd.recordsSaved=true;if(this.inlineEdit){if(this.inlineEdit.recordsSaved){this.allRecordsSaved=true;}}else{this.allRecordsSaved=true;}},this);this.inlineAdd.on("validationFailed",function(formObj,fieldControls){this.submitFailed=true;},this);this.inlineAdd.on("afterSubmit",function(vals,fields,keys,id,response){if(response.noKeys!==true){this.inlineAdd.linksAfterInlineAdd(id,response.detKeys,rPrm.dTable);}
if(response.success==true){this.updateCntRecsDetail(rPrm,0,'add');}},this);this.inlineAdd.on("submitFailed",function(respObj,inlineObj,formObj,fieldControls){this.submitFailed=true;},this);}}
this.processPreviewReturn=function(doc,rPrm){if($("#data",doc).length){txt=$("#data",doc).text();}else{txt="error"+doc.body.innerHTML;}
if(txt.substr(0,5)=='decli'){txt=txt.substr(5);$("#data",doc).remove();this.DisplayPreview($("#html",doc).text(),txt,rPrm);}else{txt=txt.substr(5);this.DisplayPreview(txt,"",rPrm);}}
this.getHtmlForHide=function(rPrm){if(!$('#dpHide'+rPrm.id).length){return'<div id="dpHide'+rPrm.id+'" align="left" style="float:left;"><img id="dpClose'+rPrm.id+'" src="images/search/closeRed.gif" valign="middle" style="cursor:pointer;margin-right:10px;">'+'<a href="'+$(rPrm.linkId,this.prm.table).attr('href')+'">'+Runner.lang.constants.TEXT_PROCEED_TO+' '+rPrm.dCaption+'</a></div>';}else{return false;}}
this.setLinkForHide=function(rPrm,linkId){var dpInline=this;$(linkId,this.prm.table)[0].onclick=function(){dpInline.hideDPInline(rPrm);return false;};}
this.hideShowDetailPreview=function(elem){var dpInline=this;var dPreview=$("#detailPreview"+this.prm.pageId)[0];if(!dPreview){if(this.isShowErrorHappend){this.showErrorHappend('',"Couldn't find element detailPreview"+this.prm.pageId+" for show or hide detail Preview");}
return;}
if(!elem){if(this.isShowErrorHappend){this.showErrorHappend('',"Undefined element dpShowHide"+this.prm.pageId+" for show or hide detail preview");}
return;}
var img=$(elem).find('img.dpImg:first')[0];if(!img){if(this.isShowErrorHappend){this.showErrorHappend('',"Undefined image dpImg for show or hide detail preview");}
return;}
if(img.id=='dpMinus'+this.prm.pageId){img.id="dpPlus"+this.prm.pageId;img.src="include/img/plus.gif";$(dPreview).hide();}else{img.id="dpMinus"+this.prm.pageId;img.src="include/img/minus.gif";$(dPreview).show();}}
this.hideDPInline=function(rPrm){var tdPreview=$("#dpreview_"+this.prm.mSTable+"_"+rPrm.recId,this.prm.table);if(!tdPreview){if(this.isShowErrorHappend)
this.showErrorHappend(rPrm,"Couldn't get preview content");return;}
$(tdPreview).empty();$(tdPreview).css('border','none');var trParents=$(tdPreview).parents("tr");if(!trParents.length){if(this.isShowErrorHappend)
this.showErrorHappend(rPrm,"Couldn't get parent elements TR for clicked link hide");return;}
var previewTr=trParents[0];var trPreviewRemove=true;var trChildren=$(previewTr).children("td[id^=dpreview_"+this.prm.mSTable+"_]");if(!trChildren.length){if(this.isShowErrorHappend)
this.showErrorHappend(rPrm,"Couldn't find all child TD preview elements for hide TR preview element");return;}
for(var i=0;i<trChildren.length;i++){if(trChildren[i].innerHTML.length){trPreviewRemove=false;break;}}
var dpInline=this;$(rPrm.linkId,this.prm.table)[0].onclick=function(){dpInline.showDPInline(rPrm.dTable,rPrm.recId,this);return false;};if(trPreviewRemove){$(previewTr).remove();var frameId=this.getIdForIframe(rPrm);removeFlyFrame=$("#"+frameId)[0];removeForm=$("#frmAdmin"+rPrm.id)[0];setTimeout('$(removeFlyFrame).remove(); $(removeForm).remove();',100);}}
this.getIdForIframe=function(rPrm){if(this.prm.mode=='list_details_edit_add'||(rPrm&&rPrm.mode=='list_details_edit_add')){id=this.prm.pageId;}else if(rPrm){id=rPrm.id;}
return'flyframe'+id;}
this.createPreviewIframe=function(rPrm){var frameId=this.getIdForIframe(rPrm);if($('#'+frameId).length){delete $('#'+frameId).loadCount;return;}
if(window.ActiveXObject){var iframetxt='<iframe src="javascript:false;" style = "position:absolute;" id = "'+frameId+'" name = "'+frameId+'" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no"/>';var io=document.createElement(iframetxt);}else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
var dpInline=this;$(io).bind('load',function(e){if(typeof this.loadCount=='undefined'){this.loadCount=0;return;}
if(rPrm.firstTime)
rPrm.firstTime=0;var ioDocument=window.frames[frameId].document;dpInline.processPreviewReturn(ioDocument,rPrm);});io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);return io;}
this.createPreviewForm=function(rPrm){var frameId=this.getIdForIframe(rPrm);var id=(rPrm&&rPrm.id?rPrm.id:this.prm.pageId);var mTable=(rPrm&&rPrm.mTable?rPrm.mTable:this.prm.mTable);var formId='frmAdmin'+id;if($('#'+formId).length){return;}
var server_url=rPrm.dShortTable+'_list.'+this.prm.ext;var form=$('<form method="POST" action="'+server_url+'" name="'+formId+'" id="'+formId+'" ></form>');$('<input type="hidden" id="a'+id+'" name="a" value="delete">').appendTo(form);$('<input type="hidden" name="mode" value="listdetails">').appendTo(form);$('<input type="hidden" name="id" value="'+id+'">').appendTo(form);if(rPrm&&rPrm.id&&this.prm.pageId&&rPrm.id!=this.prm.pageId){$('<input type="hidden" name="masterid" value="'+this.prm.pageId+'">').appendTo(form);}
if(rPrm&&rPrm.mPageType){$('<input type="hidden" name="masterpagetype" value="'+htmlSpecialChars(rPrm.mPageType)+'">').appendTo(form);}
$('<input type="hidden" name="mastertable" value="'+htmlSpecialChars(mTable)+'">').appendTo(form);var mKeys=new Array();if(rPrm.mKeys){mKeys=rPrm.mKeys;}else{var mData=this.getMasterData($(rPrm.linkId,this.prm.table)[0]);mKeys=mData.keys;}
for(var i=0;i<mKeys.length;i++){$('<input type="hidden" name="masterkey'+(i+1)+'" value="'+htmlSpecialChars(mKeys[i])+'">').appendTo(form);}
$(form).css('position','absolute');$(form).css('left','-10000px');$(form).attr('target',frameId);$(form).appendTo('body');return form;}
this.getMasterData=function(link){pos=link.href.indexOf("?");if(pos<0){return false;}
var masterData={};masterData.query=link.href.substr(pos);arr=masterData.query.split("&");masterData.keys=[];for(var i=1;i<arr.length;i++){arr1=arr[i].split("=");masterData.keys[i-1]=unescape(arr1[1]);}
return masterData;}
this.submitPreviewForm=function(id){var id=(id?id:this.prm.pageId);var table=getTableObj(id);if($('input[@type=checkbox][@checked][@id^=check'+id+'_]',table).length&&confirm(Runner.lang.constants.TEXT_DELETE_CONFIRM)){var form=$('#frmAdmin'+id);$('input[@type=checkbox][@id^=check'+id+'_]',form).each(function(){$(this).remove();});$('input[@type=checkbox][@checked][@id^=check'+id+'_]',table).each(function(){var clone=$(this).clone();var id=$(clone).attr('id');$(clone).appendTo(form);$('#'+id,form).attr('checked','checked');});$(form).submit();}
return false;}
this.updateCntRecsDetail=function(rPrm,recDels,type){var dTable=rPrm.dShortTable;if(!rPrm.rowId){var id=rPrm.id;if(!id||!dTable||!type)
return;var loadCont=$('#loaded_content'+id);var tdPreview=$(loadCont).parent();if(!$(tdPreview).length)
return;var tdId=$(tdPreview).attr('id');var pos=tdId.lastIndexOf('_'),pos1=0,pos2=0;var recId=tdId.substring(pos+1,tdId.length);}else{recId=rPrm.rowId;}
var cntDet=$('#cntDet_'+dTable+'_'+recId),cntOld=0,cntNew=0;if($(cntDet).length){var dots='';cntOld=$(cntDet).html();pos1=cntOld.indexOf('(');pos2=cntOld.indexOf(')');if(pos2==-1&&pos2==-1){$(cntDet).html('(1)');return;}else{cntOld=parseInt(cntOld.substring(pos1+1,pos2));if(isNaN(cntOld))
return;}
if(type=="add"){cntNew='('+dots+(cntOld+1)+')';}else if(type=="delete"&&recDels>0){cntNew=cntOld-recDels;if(cntNew==0)
cntNew='';else
cntNew='('+cntNew+')';}else
return;$(cntDet).html(cntNew);}else
return;}
this.showErrorHappend=function(rPrm,txt){txt='<b>Error</b>: '+txt;var dPreview=$("#dpreview_"+this.prm.mSTable+"_"+rPrm.recId,this.prm.table)[0];var detPreview=$("#detailPreview"+this.prm.pageId)[0];if(!dPreview&&!detPreview){if(rPrm.link)
this.createError(rPrm.link,rPrm.recId,txt);}else if(dPreview){$(dPreview).html('<div class="error">'+txt+'</div>');}else if(detPreview){var link=$("a[@name=dt"+this.prm.pageId+"]")[0]
if(link){this.createError(link,this.prm.pageId,txt);}}}
this.createError=function(link,id,txt){var error=$("#dperror"+id);if(!$(error).length){$(document.body).append("<div id=\"dperror"+id+"\" class=\"inline_error error\">"+txt+"</div>");error=$("#dperror"+id);}else{$(error).empty();$(error).html(txt);}
var coors=findPos(link);coors[0]+=coors[2];coors[1]+=coors[3];$(error).css("top",coors[1]+"px");$(error).css("left",coors[0]+"px");$(error).css("z-index",100);$(error).show();setTimeout('$("#dperror'+id+'").fadeOut(1000); ',2000);setTimeout('$("#dperror'+id+'").remove(); ',3000);}}
function dpInlineOnAddEdit(dpParams){this.Opts=dpParams;this.dpParFromM=Runner.pages.PageSettings.getTableData(this.Opts.mTableName,"dpParams",new Array());this.saveHnE=false;this.isSbmMaster=false;this.closeMaster=false;this.mKeys=new Array();this.initDetails=function(dTable,dId){window["dpInline"+dId]=new detailsPreviewInline({'pageId':dId,'mSTable':Runner.pages.PageSettings.getShortTName(dTable),'mTable':dTable,'mPageType':Runner.pages.constants.PAGE_LIST,'mainMPageType':this.Opts.mPageType,'mode':'list_details','ext':Runner.pages.PageSettings.getGlobalData('ext',"")});}
this.init=function(){var doInit=function()
{var dpObj=window.dpObj;var ids=dpObj.dpParFromM['ids'];var tNames=dpObj.dpParFromM['tableNames'];for(var i=0;i<ids.length;i++){var dpId=ids[i];var dpTable=tNames[i];var strKey=Runner.pages.PageSettings.getTableData(dpTable,"strKey",new Array());var isUseDP=Runner.pages.PageSettings.getTableData(dpTable,"isUseDP",false);var dpSTable=Runner.pages.PageSettings.getShortTName(dpTable);var isUseInlineJs=(isUseInlineAdd||isUseInlineEdit);var isUseInlineAdd=Runner.pages.PageSettings.getTableData(dpTable,"isInlineAdd",false);var isUseInlineEdit=Runner.pages.PageSettings.getTableData(dpTable,"isInlineEdit",false);var firstTime=Runner.pages.PageSettings.getTableData(dpTable,"firstTime",1);if(!firstTime)
continue;var permis=Runner.pages.PageSettings.getTableData(dpTable,"permissions",{});if(dpObj.Opts.mPageType==Runner.pages.constants.PAGE_ADD&&!isUseInlineAdd&&!permis['add']){continue;}
var rPrm={'id':dpId,'dTable':dpTable,'dShortTable':dpSTable,'mTableName':dpObj.Opts.mTableName,'mPageType':dpObj.Opts.mPageType,'mId':dpObj.Opts.mId,'firstTime':0}
if(isUseDP){dpObj.initDetails(dpTable,dpId);rPrm['mode']='list_details_edit_add';}else{window['dpInline'+dpId]=new detailsPreviewInline({'pageId':dpId,'mTable':dpObj.Opts.mTableName,'mPageType':dpObj.Opts.mPageType,'mainMPageType':dpObj.Opts.mPageType,'mode':'list_details_edit_add','ext':Runner.pages.PageSettings.getGlobalData('ext',"")});}
var dpInlObj=window['dpInline'+dpId];dpInlObj.createPreviewIframe(rPrm);if(dpObj.Opts.mPageType==Runner.pages.constants.PAGE_EDIT){dpInlObj.createPreviewForm({'id':dpId,'dShortTable':Runner.pages.PageSettings.getShortTName(dpTable),'mTable':dpObj.Opts.mTableName,'mKeys':strKey,'mPageType':Runner.pages.constants.PAGE_EDIT});rPrm['rowId']=dpObj.Opts.rowId;}
dpInlObj.initResize(dpId,dpTable,firstTime);dpInlObj.initMedia(dpTable,dpId,dpObj.Opts.mTableName,dpObj.Opts.mPageType,dpObj.Opts.mId);dpInlObj.initPagination(rPrm);dpObj.Opts.dCaptions[dpId]=Runner.pages.PageSettings.getTableData(dpTable,"strCaption","");if(dpObj.Opts.mPageType!=Runner.pages.constants.PAGE_VIEW){dpInlObj.initInline(rPrm);}
if(dpObj.Opts.mPageType!=Runner.pages.constants.PAGE_ADD){dpInlObj.initMaps(rPrm.id,rPrm.dTable,rPrm.mTableName,rPrm.mPageType,rPrm.mId);}
if(dpObj.Opts.mPageType==Runner.pages.constants.PAGE_ADD)
{dpInlObj.inlineAdd.inlineAdd(true,true);var inlineAddObj=dpInlObj.inlineAdd;inlineAddObj.on("createControls",function(row,ctrlsArr){this.inlineAddChangeContent=false;var cntrlType,eventName='change',delay=0;var revertShowHn=function(e,row){inlineAddObj.getEditBlock(row,false,true)
this.inlineAddChangeContent=true;};for(var i=0;i<ctrlsArr.length;i++){cntrlType=ctrlsArr[i].getControlType();eventName='change';if(cntrlType=='checkbox'||cntrlType=='radio'){eventName='click';}else if(cntrlType=='text'||cntrlType=='password'||cntrlType=='textarea'){eventName='keyup';}else if(cntrlType=='RTE'){eventName='blur';}
ctrlsArr[i].on(eventName,revertShowHn,{single:true,args:[row]},this);}},dpInlObj,{single:true});}}};if(this.Opts.showMasterInPopup)
{var ids=this.dpParFromM['ids'];var tNames=this.dpParFromM['tableNames'];for(var i=0;i<ids.length;i++)
{var dpId=ids[i];var dpTable=tNames[i];var isUseInlineAdd=Runner.pages.PageSettings.getTableData(dpTable,"isInlineAdd",false);var firstTime=Runner.pages.PageSettings.getTableData(dpTable,"firstTime",1);if(!firstTime){continue;}
var permis=Runner.pages.PageSettings.getTableData(dpTable,"permissions",{});if(this.Opts.mPageType==Runner.pages.constants.PAGE_ADD&&!isUseInlineAdd&&!permis['add']){continue;}
if(this.Opts.mPageType!=Runner.pages.constants.PAGE_ADD){if(Runner.pages.PageSettings.getTableData(dpTable,"isUseIbox",false)){Runner.util.ScriptLoader.addJS(["include/ibox.js"]);Runner.util.ScriptLoader.loadCSS(["include/ibox"]);}
if(Runner.pages.PageSettings.getTableData(dpTable,"isUseVideo",false)){Runner.util.ScriptLoader.addJS(["include/video/flowplayer-3.2.3.min.js"]);}
if(Runner.pages.PageSettings.getTableData(dpTable,"isUseAudio",false)){Runner.util.ScriptLoader.addJS(["http://mediaplayer.yahoo.com/js"]);}}
if(Runner.pages.PageSettings.getTableData(dpTable,"isUseResize",false)){Runner.util.ScriptLoader.addJS(["include/resizebleGrid.js"]);Runner.util.ScriptLoader.loadCSS(["include/stylesheets"]);}
if(Runner.pages.PageSettings.getTableData(dpTable,"isUseToolTips",false)){Runner.util.ScriptLoader.addJS(["include/jquery.dimensions.js"]);Runner.util.ScriptLoader.addJS(["include/jquery.inputhintbox.js"],"include/jquery.dimensions.js");Runner.util.ScriptLoader.loadCSS(["include/tooltip"]);}
var fSett=Runner.pages.PageSettings.getTableData(dpTable,"fieldSettings",{});for(var fName in fSett){if(fSett[fName].timePick){Runner.util.ScriptLoader.addJS(["include/ui.js"]);Runner.util.ScriptLoader.addJS(["include/jquery.utils.js"],"include/ui.js");Runner.util.ScriptLoader.addJS(["include/ui.dropslide.js"],"include/jquery.utils.js");Runner.util.ScriptLoader.addJS(["include/ui.timepickr.js"],"include/ui.dropslide.js");Runner.util.ScriptLoader.loadCSS(["include/ui.dropslide"]);}
if(fSett[fName].editFormat==Runner.controls.constants.EDIT_FORMAT_DATE&&(fSett[fName].dateEditType==Runner.controls.constants.EDIT_DATE_SIMPLE_DP||fSett[fName].dateEditType==Runner.controls.constants.EDIT_DATE_DD_DP))
{if(Runner.pages.PageSettings.getGlobalData("debugMode",false))
Runner.util.ScriptLoader.addJS(["include/yui/calendar.js"],"include/yui/container.js","include/yui/event.js");Runner.util.ScriptLoader.loadCSS(["include/yui/calendar"]);Runner.util.ScriptLoader.loadCSS(["include/yui/calendar-skin"]);Runner.util.ScriptLoader.loadCSS(["include/yui/container"]);Runner.util.ScriptLoader.loadCSS(["include/yui/container-skin"]);Runner.util.ScriptLoader.loadCSS(["include/yui/resize"]);}}}
var det=this;Runner.util.ScriptLoader.on('filesLoaded',function(){doInit();},this,{single:true});Runner.util.ScriptLoader.load();}
else
doInit();}
this.saveAllDetail=function(e,respObj){this.saveHnE=e;if(respObj)
this.respObj=respObj;var ids=this.dpParFromM['ids'];for(var i=0;i<ids.length;i++){this.saveAll(ids[i],i);}}
this.saveAll=function(dpId,i){this.Opts.mMessage='';this.Opts.dMessages='';if(this.Opts.mPageType==Runner.pages.constants.PAGE_EDIT){this.saveAllOnEdit(dpId);}else if(this.Opts.mPageType==Runner.pages.constants.PAGE_ADD){this.saveAllOnAdd(dpId,i);}}
this.saveAllOnAdd=function(dpId,i){var obj=window['dpInline'+dpId];if(!obj){this.prepareForSubmit();}else{obj.inlineAdd.readySbmMaster=false;if(!obj.inlineAddChangeContent){obj.inlineAdd.readySbmMaster=true;this.prepareForSubmit();}else{Runner.apply(obj.inlineAdd.baseParams,this.mKeys[this.dpParFromM['tableNames'][i]]);Runner.apply(obj.inlineAdd.baseParams,{'mastertable':this.Opts.mTableName});obj.inlineAdd.saveAll();setTimeout('window.dpObj.isAllRecordsSave('+dpId+')',1000);}}}
this.saveAllOnEdit=function(dpId){var obj=window['dpInline'+dpId];if(!obj||(!obj.inlineEdit&&!obj.inlineAdd)){this.prepareForSubmit();}else{if(obj.inlineEdit&&obj.inlineAdd){obj.inlineEdit.readySbmMaster=false;obj.inlineAdd.readySbmMaster=false;if(!obj.inlineEdit.isRowsEditing()&&!obj.inlineAdd.isRowsEditing()){obj.inlineEdit.readySbmMaster=true;obj.inlineAdd.readySbmMaster=true;this.prepareForSubmit();}else{obj.inlineEdit.saveAll();obj.inlineAdd.saveAll();setTimeout('window.dpObj.isAllRecordsSave('+dpId+')',1000);}}else if(obj.inlineEdit){obj.inlineEdit.readySbmMaster=false;if(!obj.inlineEdit.isRowsEditing()){obj.inlineEdit.readySbmMaster=true;this.prepareForSubmit();}else{obj.inlineEdit.saveAll();setTimeout('window.dpObj.isAllRecordsSave('+dpId+')',1000);}}else if(obj.inlineAdd){obj.inlineAdd.readySbmMaster=false;if(!obj.inlineAdd.isRowsEditing()){obj.inlineAdd.readySbmMaster=true;this.prepareForSubmit();}else{obj.inlineAdd.saveAll();setTimeout('window.dpObj.isAllRecordsSave('+dpId+')',1000);}}}}
this.isAllRecordsSave=function(dpId){var obj=window['dpInline'+dpId];if(!obj.allRecordsSaved&&!obj.submitFailed){setTimeout('window.dpObj.isAllRecordsSave('+dpId+')',1000);}
if(obj.submitFailed){this.prepareMessage(dpId);}
if(obj.allRecordsSaved&&!obj.submitFailed){if(obj.inlineEdit){obj.inlineEdit.readySbmMaster=true;}
if(obj.inlineAdd){obj.inlineAdd.readySbmMaster=true;}
this.prepareForSubmit();}}
this.showDP=function(pageid){var div=$('#dpShowHide'+pageid)[0];if($('#dpPlus'+pageid)[0]){window['dpInline'+pageid].hideShowDetailPreview(div);}}
this.prepareMessage=function(dpId){this.createTextMessage(dpId);if(this.Opts.mPageType==Runner.pages.constants.PAGE_ADD&&this.isSbmMaster){var arrCntrl=Runner.controls.ControlManager.getAt(this.Opts.mTableName);for(var i=0;i<arrCntrl.length;i++){arrCntrl[i].spanContElem.empty().html(this.Opts.mSavedValues[arrCntrl[i].goodFieldName]);}}
this.showMessage();this.showDP(dpId);window.scroll(0,0);}
this.createTextMessage=function(dpId){var url=document.URL,txt="";var pos=url.indexOf("#dt"+dpId);if(pos==-1){url=url+"#dt"+dpId;}
var msg=(new String(Runner.lang.constants.TEXT_DETAIL_NOT_SAVED)).replace('%s',this.Opts.dCaptions[dpId]);txt="<div class='message mes_not'><<< "+msg+" >>> <br><a href='"+url+"' >"+Runner.lang.constants.TEXT_DETAIL_GOTO+" "+this.Opts.dCaptions[dpId]+"</a></div>";this.Opts.dMessages+=txt;}
this.showMessage=function(){var mes=$("div[@id^=message_block]");var mtb=$("div.main_table_border");var txt="";if(this.Opts.mMessage){txt=this.Opts.mMessage;}
if(!this.isAllReadySbmMaster()){txt=txt+this.Opts.dMessages;}
if($(mes).length){$(mes).empty().html(txt);}else{$(mtb).prepend('<div id="message_block" class="downedit">'+txt+'</div>');}}
this.showHideInvalidCaptcha=function(type){var captchaSpan=$('#edit1_captcha_0');if($(captchaSpan).length){var error=$(captchaSpan).find('div.error');if(type=='hide'&&$(error).length){$(error).remove();}else if($(error).length&&type=='show'){$(error).empty().html(Runner.lang.constants.TEXT_INVALID_CAPTCHA_CODE);}else if(!$(error).length&&type=='show'){$(captchaSpan).append('<div class=\"error\">'+Runner.lang.constants.TEXT_INVALID_CAPTCHA_CODE+'</div>');}}}
this.hideCaptcha=function(){var captchaBlock=$('.captcha_block');if($(captchaBlock).length){$(captchaBlock).remove();}}
this.prepareForSubmit=function(){if(this.isAllReadySbmMaster()&&!this.closeMaster){this.submitMasterForm();if(this.Opts.showMasterInPopup&&this.Opts.mPageType==Runner.pages.constants.PAGE_ADD){this.closeMaster=true;}}}
this.submitMasterForm=function(){if(this.Opts.mPageType=="edit"){Runner.pages.EditPage.superclass.saveHn.call(this,this.saveHnE);}else if(this.Opts.mPageType==Runner.pages.constants.PAGE_ADD){if(!this.Opts.showMasterInPopup){window.location=this.Opts.mShortTableName+'_add.php';}else{var parPage=Runner.pages.PageManager.getAt(this.Opts.mTableName,this.Opts.parId);var addPage=Runner.pages.PageManager.getAt(this.Opts.mTableName,this.Opts.mId);parPage.inlineAdd.addRowToGrid(this.respObj);this.closeMaster=false;addPage.close();}}}
this.isAllReadySbmMaster=function(){var readySbmAll=true;var ids=this.dpParFromM['ids'];for(var i=0;i<ids.length;i++){var obj=window['dpInline'+ids[i]];if(!obj)
continue;if(this.Opts.mPageType=="edit"){if((obj.inlineEdit&&!obj.inlineEdit.readySbmMaster)||(obj.inlineAdd&&!obj.inlineAdd.readySbmMaster)){readySbmAll=false;}}else if(this.Opts.mPageType=="add"){if(!obj.inlineAddChangeContent){continue;}
if(!obj.inlineAdd.readySbmMaster){readySbmAll=false;}}}
return readySbmAll;}}