var bootbox=window.bootbox||function(){function i(n,t){return null==t&&(t=u),"string"==typeof r[t][n]?r[t][n]:t!=f?i(n,f):n}var u="en",f="en",e=!0,t={},n={},r={en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"}};return n.setLocale=function(n){for(var t in r)if(t==n){u=n;return}throw Error("Invalid locale: "+n);},n.addLocale=function(n,t){"undefined"==typeof r[n]&&(r[n]={});for(var i in t)r[n][i]=t[i]},n.setIcons=function(n){t=n;("object"!=typeof t||null==t)&&(t={})},n.alert=function(){var r="",f=i("OK"),u=null;switch(arguments.length){case 1:r=arguments[0];break;case 2:r=arguments[0];"function"==typeof arguments[1]?u=arguments[1]:f=arguments[1];break;case 3:r=arguments[0];f=arguments[1];u=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}return n.dialog(r,{label:f,icon:t.OK,callback:u},{onEscape:u})},n.confirm=function(){var u="",f=i("CANCEL"),e=i("CONFIRM"),r=null;switch(arguments.length){case 1:u=arguments[0];break;case 2:u=arguments[0];"function"==typeof arguments[1]?r=arguments[1]:f=arguments[1];break;case 3:u=arguments[0];f=arguments[1];"function"==typeof arguments[2]?r=arguments[2]:e=arguments[2];break;case 4:u=arguments[0];f=arguments[1];e=arguments[2];r=arguments[3];break;default:throw Error("Incorrect number of arguments: expected 1-4");}return n.dialog(u,[{label:f,icon:t.CANCEL,callback:function(){"function"==typeof r&&r(!1)}},{label:e,icon:t.CONFIRM,callback:function(){"function"==typeof r&&r(!0)}}])},n.prompt=function(){var f="",e=i("CANCEL"),s=i("CONFIRM"),r=null,u,o;switch(arguments.length){case 1:f=arguments[0];break;case 2:f=arguments[0];"function"==typeof arguments[1]?r=arguments[1]:e=arguments[1];break;case 3:f=arguments[0];e=arguments[1];"function"==typeof arguments[2]?r=arguments[2]:s=arguments[2];break;case 4:f=arguments[0];e=arguments[1];s=arguments[2];r=arguments[3];break;default:throw Error("Incorrect number of arguments: expected 1-4");}u=$("<form><\/form>");u.append("<input autocomplete=off type=text />");o=n.dialog(u,[{label:e,icon:t.CANCEL,callback:function(){"function"==typeof r&&r(null)}},{label:s,icon:t.CONFIRM,callback:function(){"function"==typeof r&&r(u.find("input[type=text]").val())}}],{header:f});o.on("shown",function(){u.find("input[type=text]").focus();u.on("submit",function(n){n.preventDefault();o.find(".btn-primary").click()})});return o},n.modal=function(){var i,r,t,u={onEscape:null,keyboard:!0,backdrop:!0};switch(arguments.length){case 1:i=arguments[0];break;case 2:i=arguments[0];"object"==typeof arguments[1]?t=arguments[1]:r=arguments[1];break;case 3:i=arguments[0];r=arguments[1];t=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}return u.header=r,t="object"==typeof t?$.extend(u,t):u,n.dialog(i,[],t)},n.dialog=function(n,t,i){var s=null,h="",a=[],i=i||{},r,f,l,o,u;for(null==t?t=[]:"undefined"==typeof t.length&&(t=[t]),r=t.length;r--;){var f=null,c=null,v="",y=null;if("undefined"==typeof t[r].label&&"undefined"==typeof t[r]["class"]&&"undefined"==typeof t[r].callback){f=0;l=null;for(o in t[r])if(l=o,1<++f)break;1==f&&"function"==typeof t[r][o]&&(t[r].label=l,t[r].callback=t[r][o])}"function"==typeof t[r].callback&&(y=t[r].callback);t[r]["class"]?c=t[r]["class"]:r==t.length-1&&2>=t.length&&(c="btn-primary");f=t[r].label?t[r].label:"Option "+(r+1);t[r].icon&&(v="<i class='"+t[r].icon+"'><\/i> ");h+="<a data-handler='"+r+"' class='btn "+c+"' href='#'>"+v+""+f+"<\/a>";a[r]=y}t=["<div class='bootbox modal'>"];i.header&&(r="",("undefined"==typeof i.headerCloseButton||i.headerCloseButton)&&(r="<a href='#' class='close'>&times;<\/a>"),t.push("<div class='modal-header'>"+r+"<h3>"+i.header+"<\/h3><\/div>"));t.push("<div class='modal-body'><\/div>");h&&t.push("<div class='modal-footer'>"+h+"<\/div>");t.push("<\/div>");u=$(t.join("\n"));("undefined"==typeof i.animate?e:i.animate)&&u.addClass("fade");$(".modal-body",u).html(n);u.bind("hidden",function(){u.remove()});u.bind("hide",function(){"escape"==s&&"function"==typeof i.onEscape&&i.onEscape()});$(document).bind("keyup.modal",function(n){27==n.which&&(s="escape")});u.bind("shown",function(){$("a.btn-primary:last",u).focus()});u.on("click",".modal-footer a, a.close",function(n){var t=$(this).data("handler"),t=a[t],i=null;"function"==typeof t&&(i=t());!1!==i&&(n.preventDefault(),s="button",u.modal("hide"))});return null==i.keyboard&&(i.keyboard="function"==typeof i.onEscape),$("body").append(u),u.modal({backdrop:i.backdrop||!0,keyboard:i.keyboard}),u},n.hideAll=function(){$(".bootbox").modal("hide")},n.animate=function(n){e=n},n}();$(function(){$("a.ConfirmSend").click(function(n){n.preventDefault();var t=$(this).attr("href");bootbox.confirm("Are you sure you want to do that?","Oops no thanks!","Yes, go ahead!",function(n){n&&(window.location=t)})});$("form.ConfirmForm").submit(function(n){n.preventDefault();var t=this;bootbox.confirm("Are you sure you want to do that?","Oops no thanks!","Yes, go ahead!",function(n){n&&t.submit()})});$("form.ConfirmBatchForm").submit(function(n){var t,i,r,u;n.preventDefault();t=this;i=$("#selectedaction").val();i==="scoping"?(r={},u=$('input[name="batchids"]:checked').map(function(){return $(this).val()}).get().join(","),$("#myModal form #selectedBatches").val(u),$("#myModal").modal(r)):bootbox.confirm("Are you sure you want to do that?","Oops no thanks!","Yes, go ahead!",function(n){n&&t.submit()})});$("a.EmailRequired").click(function(n){n.preventDefault();var i=$(this).attr("href"),t='<form action="'+i+'" class="well form-inline" method="post">';t+='<input class="span4" name="emailAddress" type="text" value="" placeholder="Email address"> ';t+='<button id="send_email" type="submit" class="btn btn-primary" name="submit">Send email<\/button><\/form>';t+='<p class="muted">Email will not be recorded.<\/p>';bootbox.modal(t,"Who do you want to send this to?",null)})})