                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                if(!window.__td){window.__MT=100;window.__ti=0;window.__td=[];window.__td.length=window.__MT;window.__noTrace=false;}


if(typeof(vp)=="undefined")
{
var vp={};
}

if(!vp.widget)
{
vp.widget={};
}

vp.widget.dialogButtons={};



var VP_WIDGET_DIALOG_BUTTON_ID_OK="okButton";
var VP_WIDGET_DIALOG_BUTTON_ID_CANCEL="cancelButton";
var VP_WIDGET_DIALOG_BUTTON_ID_NEXT="nextButton";
var VP_WIDGET_DIALOG_BUTTON_ID_BACK="backButton";
var VP_WIDGET_DIALOG_BUTTON_ID_DONE="doneButton";






vp.widget.dialogButtons.enable=function $vpfn_7iOUZGqttYvQnB6lg1J10A29$33(vButton,bEnable)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oContainer=vp.widget.dialogButtons.getButtonContainer(vButton);

if(oContainer._isDisabled==!bEnable)
{
return;
}

oContainer._isDisabled=!bEnable;


jQuery(oContainer).find("[dialog-button-type='link']").toggle(bEnable);


jQuery(oContainer).find("[dialog-button-type='disabled']").toggle(!bEnable);
};

vp.widget.dialogButtons.toggle=function $vpfn_lsYVH4HSV$srz1H07WVDmg47$33(vButton)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oContainer=vp.widget.dialogButtons.getButtonContainer(vButton);
vp.widget.dialogButtons.enable(oContainer,oContainer._isDisabled);
};

vp.widget.dialogButtons.swapButtons=function $vpfn_lbGHg6fC9q7N0qiKZvgu6g53$38(vButtonToHide,vButtonToShow)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oButtonToHide=vp.widget.dialogButtons.getButtonContainer(vButtonToHide);
var oButtonToShow=vp.widget.dialogButtons.getButtonContainer(vButtonToShow);
oButtonToHide.style.display="none";
oButtonToShow.style.display="";
};

vp.widget.dialogButtons.get=function $vpfn_RQBVb_dcD601WX6xTIIXaA61$30(vButtonOrID)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oContainer=vp.widget.dialogButtons.getButtonContainer(vButtonOrID);
if(!oContainer)
{
return null;
}

return jQuery(oContainer).find("[dialog-button-type='link']")[0];
};

vp.widget.dialogButtons.getButtonContainer=function $vpfn_yZePpwvApDCBr50hFj8$1g72$45(vButtonOrID)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

if(vButtonOrID&&vButtonOrID.tagName)
{
return vButtonOrID;
}


var oDialog;
var isIFrameDialog=false;

try
{
oDialog=vp.dialog.getCurrent();
isIFrameDialog=oDialog.dialogType==DIALOG_TYPE_IFRAME;
}
catch(ex)
{
if(ex.message==VP_DIALOG_XDOMAIN_ERR)
{
isIFrameDialog=true;
}
else
{
throw ex;
}
}

var oButtons;
if(isIFrameDialog)
{
oButtons=vp.widget.dialogButtons.getButtonsForIFrameDialog();
}
else
{
if(!oDialog)
{
throw new Error("The button "+vButtonOrID+" could not be found because there was no current active dialog.");
}

oButtons=vp.widget.dialogButtons.getButtonsForNodeDialog(oDialog);
}

return oButtons.buttons[vButtonOrID]||null;
};

vp.widget.dialogButtons.getButtonsParentElement=function $vpfn_9Zjl91Ym61HhETojPpodjw119$50(oDialog)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oContentNode=document.body;
var bIsIFrameDialog=true;
if(oDialog)
{
oContentNode=oDialog.getContentNode();
if(oDialog.dialogType==DIALOG_TYPE_NODE)
{
bIsIFrameDialog=false;
}
}

var $candidate=jQuery(oContentNode).find("div.dialogButtons");

if(bIsIFrameDialog)
{
$candidate=$candidate.filter(":not([dialogid])");
}
else
{
$candidate=$candidate.filter("[dialogid='"+oDialog.id.replace("_dialog","")+"']");
}

return $candidate[0];
};

vp.widget.dialogButtons._resetIFrameFooter=function $vpfn_Id0thz0LUiA2O8fYreIOsw146$45(oFooter)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oBody=oFooter.ownerDocument.body;


if(oFooter.parentNode!=oBody)
{
oFooter.parentNode.removeChild(oFooter);
oBody.appendChild(oFooter);
}

vp.ui.setStyle(oFooter,{top:0,left:0,display:"block",position:"relative"});
};

vp.widget.dialogButtons._iframePositioningCount=0;

vp.widget.dialogButtons._inPositioningMethod=false;

vp.widget.dialogButtons.positionDialogButtonsForIFrame=function $vpfn_mSVJQa84y1sUGiYm5uuItg164$57()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}



if(vp.widget.dialogButtons._inPositioningMethod)
{
return;
}





if(vp.widget.dialogButtons._iframePositioningCount>=4)
{
if(vp.widget.dialogButtons._iframePositioningCount==4)
{
setTimeout(function $vpfn_yIdzQr5RpSiVKo$FT00zxA182$23()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.widget.dialogButtons._iframePositioningCount=0;
},
2000);
}

return;
}

vp.widget.dialogButtons._iframePositioningCount++;

vp.widget.dialogButtons._inPositioningMethod=true;

try
{

jQuery(".dialog-content-container").each(function $vpfn_yIdzQr5RpSiVKo$FT00zxA199$49(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}vp.ui.ensureMaxHeight(this);});


var oFooter=vp.widget.dialogButtons.getButtonsParentElement();
vp.widget.dialogButtons._resetIFrameFooter(oFooter);




var sOverflow=window.document.documentElement.style.overflow;
window.document.documentElement.style.overflow="hidden";






var oBodyRect=vp.ui.getContentSize(window);
var oSize=vp.ui.getViewportSize(window,true);


window.document.documentElement.style.overflow=sOverflow;



oSize.top=0;
oSize.left=0;
oSize.bottom=oSize.height;
oSize.right=oSize.width;




oSize.bottom=Math.max(oSize.bottom,oBodyRect.height);
oSize.right=Math.max(oSize.right,oBodyRect.width);




if(vp.ui.getCurrentStyle(window.document.body,"position")=="relative")
{
var oBodyPos=vp.ui.getRect(document.body);
oSize.bottom-=oBodyPos.top;
oSize.right-=oBodyPos.left;
}



oSize.height=oSize.bottom-oSize.top;
oSize.width=oSize.right-oSize.left;

var iBottomMargin=0;

vp.ui.setStyle(oFooter,
{
left:0,
top:(oSize.bottom-(oFooter.offsetHeight))-iBottomMargin,
visibility:"visible",
position:"absolute"
});

vp.widget.dialogButtons.compensateForDialogContentMargins(oFooter,oSize);



var footerBottom=vp.ui.getRect(oFooter).bottom;
var viewportHeight=vp.ui.getViewportSize(window).height;

if(vp.browser.isMobileSafari||vp.browser.isAndroid)
{





try
{
var iFrame=vp.ui.getIFrameForDocument(document);
viewportHeight=$(iFrame.parentNode).height();
}
catch(ex)
{
}
}

if(footerBottom>viewportHeight)
{
vp.dialog.resizeCurrentToContentSize(0,footerBottom,true);
}
}
finally
{
vp.widget.dialogButtons._inPositioningMethod=false;
}
};

vp.widget.dialogButtons.compensateForDialogContentMargins=function $vpfn_0ScxrqtUftV30OdcCfX$8g295$60(oFooter,oSize)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}



var oDialog;

try
{
oDialog=vp.dialog.getCurrent();
}
catch(ex)
{
if(ex.message!=VP_DIALOG_XDOMAIN_ERR)
{
throw ex;
}
}

if(!oDialog)
{
return;
}

var MARGIN=10;

var iDiffLeft=MARGIN-oDialog.options.contentLeftMargin;
var iDiffRight=MARGIN-oDialog.options.contentRightMargin;
if(iDiffLeft>0||iDiffRight>0)
{
oFooter.style.marginLeft=iDiffLeft+"px";
oFooter.style.marginRight=iDiffRight+"px";
oFooter.style.width=(oSize.width-(iDiffLeft+iDiffRight))+"px";
}
};




vp.core.markAsClosure(vp.widget.dialogButtons.positionDialogButtonsForIFrame);

vp.widget.dialogButtons.initForIFrameDialog=function $vpfn_PePeIxt$Og1oTSsF2dFCZQ336$46()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oDialog;

try
{
oDialog=vp.dialog.getCurrent();
}
catch(ex)
{
if(ex.message!=VP_DIALOG_XDOMAIN_ERR)
{
throw ex;
}
}

var onBeforeResizeHandler=function $vpfn_9NieLGPSubjrGKxwlV_jxQ352$32()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(vp.widget.dialogButtons._inPositioningMethod)
{
return;
}

var oButtonGroup=vp.widget.dialogButtons.getButtonsParentElement(oDialog);
if(oButtonGroup)
{
vp.widget.dialogButtons._resetIFrameFooter(oButtonGroup);
}
};

vp.core.markAsClosure(onBeforeResizeHandler);

vp.events.addOnDOMLoadHandler(vp.widget.dialogButtons.positionDialogButtonsForIFrame);

var ensureInited=function $vpfn_$lqwY2rKX74563TKZcgfIg370$23()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(arguments.callee._wasCalled)
{
return;
}

arguments.callee._wasCalled=true;

vp.widget.dialogButtons.positionDialogButtonsForIFrame();

vp.dialog.addOnBeforeResizeHandlerToCurrent(onBeforeResizeHandler);
vp.dialog.addOnResizeHandlerToCurrent(vp.widget.dialogButtons.positionDialogButtonsForIFrame);
};

vp.dialog.Dialog.onbeforefirstresize.addHandler(ensureInited);

vp.events.add(window,"load",ensureInited);
};

vp.widget.dialogButtons._getDialog=function $vpfn_9f4he4zPStGhKPHaKF6Ybw390$37(vDialogOrId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oDialog=vDialogOrId;
if(typeof(vDialogOrId)=="string")
{
oDialog=vp.dialog.get(vDialogOrId);
}

return oDialog;
};

vp.widget.dialogButtons._collectButtonElements=function $vpfn_cZ4IUe3bDcUU1jjprbPqGA401$49(oContainer)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oButtonElements={};

oButtonElements.buttons=oContainer?vp.ui.collectElementsByAttribute(oContainer,"dialog-button-id"):{};
oButtonElements.buttonElements=oContainer?vp.ui.collectElementsByAttribute(oContainer,"dialog-button-node"):{};
oButtonElements.document=document;

return oButtonElements;
};






vp.widget.dialogButtons.getButtonsForNodeDialog=function $vpfn_pJWMzus6ejcLvu9ua906cw417$50(oDialog)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oDialog._buttons||oDialog._buttons.document!==document)
{
var oButtonContainer=vp.widget.dialogButtons.getButtonsParentElement(oDialog);

var oDialogNode=oDialog.getContentNode();
vp.widget.dialogButtons._ensureButtonContainerInCorrectParent(oButtonContainer,oDialogNode);

oDialog._buttons=vp.widget.dialogButtons._collectButtonElements(oButtonContainer);
}

return oDialog._buttons;
};

vp.widget.dialogButtons.getButtonsForIFrameDialog=function $vpfn_$cS7sCVlkfRaQOlzGhEgXQ432$52()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!window._dialogButtonElements)
{
window._dialogButtonElements={};

var oButtonContainer=vp.widget.dialogButtons.getButtonsParentElement();

vp.widget.dialogButtons._ensureButtonContainerInCorrectParent(oButtonContainer,document.body);

window._dialogButtonElements=vp.widget.dialogButtons._collectButtonElements(document.body);
}

return window._dialogButtonElements;
};

vp.widget.dialogButtons._ensureButtonContainerInCorrectParent=function $vpfn_BToIHiINiESO6jjQBqXFRg448$64(oButtonContainer,oParent)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oButtonContainer||!oParent)
{
return;
}

if(oButtonContainer.parentNode!=oParent)
{
oButtonContainer.parentNode.removeChild(oButtonContainer);
oParent.appendChild(oButtonContainer);
}
};

vp.widget.dialogButtons.resetButtonsForNodeDialog=function $vpfn_zcs5uIiwyn6UDVAENRjWWw462$52(oDialog)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oButtons=vp.widget.dialogButtons.getButtonsForNodeDialog(oDialog);
var oFooter=oButtons.buttonElements.container;
oFooter.style.marginTop=0;
};

vp.widget.dialogButtons.initForNodeDialog=function $vpfn_tLsACKyT3klUgISNMpcAiw469$44(sDialogID)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oDialog=vp.widget.dialogButtons._getDialog(sDialogID);
var oButtons=vp.widget.dialogButtons.getButtonsForNodeDialog(oDialog);

var fnPositionButtons=function $vpfn_sx5dfSu9BbJpPk7HtBsndg474$28(e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oFooter=oButtons.buttonElements.container;
vp.widget.dialogButtons.resetButtonsForNodeDialog(oDialog);

var oContentNode=oDialog.getContentContainer();

var oButtonsRect=vp.ui.getRect(oFooter);
var oDialogRect=vp.ui.getRect(oContentNode.parentNode);
var oContentRect=vp.ui.getRect(oContentNode);

var oIdealRect=vp.core.shallowCopy(oDialogRect);

oIdealRect.bottom=Math.max(oDialogRect.bottom,oContentRect.bottom);
oIdealRect.right=Math.max(oDialogRect.right,oContentRect.right);
oIdealRect.height=oDialogRect.bottom-oDialogRect.top;
oIdealRect.width=oDialogRect.right-oDialogRect.left;


var iDiff=oIdealRect.bottom-oButtonsRect.bottom;
if(iDiff>0)
{
oFooter.style.marginTop=iDiff+"px";
}

oButtonsRect=vp.ui.getRect(oFooter);
iDiff=oDialogRect.bottom-oButtonsRect.bottom;
if(iDiff<0)
{
oDialog.resizeToFitContent(false);
}

vp.widget.dialogButtons.compensateForDialogContentMargins(oFooter,oDialogRect);
};

oDialog.onopen.addHandler(fnPositionButtons);
};

