function AjaxAction(){this.request=null;this.before=function(){};this.after=function(){}}
function ElementDisable(b,c){this.loading=this.currentEvents=this.element=null;this.before=function(){this.element=$(b);if(null!=c&&""!=c){this.currentEvents=[];var a=this.element.attr("on"+c);if(null!=a&&""!=a)this.currentEvents.push(a),this.element.removeAttr("on"+c);else{var d=this.element.data("events"),e=a=null;for(e in d)if(e==c){a=d[c];break}if(null!=a&&0<a.length)for(d=0;d<a.length;d++)this.currentEvents.push(a[d].handler);this.element.unbind()}}this.loading=$(".loadingCursor");if(0==this.loading.length){this.loading=
$('<table class="loadingCursor" style="display:none;"><td class="loadingCursorImg"></td><td class="loadingCursorText" style="display:none;">'+NextWay.Localization.pleaseWaitText+"</td></table>");$("body").append(this.loading);var g=this.loading,f=!1;$(document).bind("mousemove.ajaxActions",function(a){setNextToCursor($(".loadingCursor"),a.pageX,a.pageY);f||(f=!0,g.fadeIn())})}null!=c&&this.element.bind(c+".waitmessage",function(a){$(".loadingCursorText").fadeIn();setTimeout("$('.loadingCursorText').fadeOut()",
2E3)})};this.after=function(){null!=this.loading&&0<this.loading.length&&cleanUpLoadingCursor(this.loading);this.element.unbind(c);if(null!=this.currentEvents&&0<this.currentEvents.length)for(var a=0;a<this.currentEvents.length;a++)this.element.bind(c,this.currentEvents[a])}}ElementDisable.prototype=AjaxAction;
function BlockUI(b){this.beforeInternal=function(){4!=this.request.state&&$.blockUI({message:'<h1><img src="busy.gif" /> Just a moment...</h1><span class="PleaseWait" style="display:none;color:Red;">Your request its still being processed.</span>',onBlock:function(){$(document).bind("click.block",function(){$(".PleaseWait").fadeIn();setTimeout("$('.PleaseWait').fadeOut()",5E3)})}})};this.after=function(){$.unblockUI()}}BlockUI.prototype=AjaxAction;
function setNextToCursor(b,c,a){c-=$(document).scrollLeft();a-=$(document).scrollTop();b.css({top:a+15+"px",left:c+15+"px"})}function cleanUpLoadingCursor(b){$(document).unbind("mousemove.ajaxActions");b.fadeOut(function(){b.remove()})}
function VortalBlockUI(){function b(){$(".loadingCursorText").fadeIn()}function c(){var a=0;isNaN(window.innerWidth)?document.documentElement&&document.documentElement.clientWidth?a=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(a=document.body.clientWidth):a=window.innerWidth;return a}function a(){isNaN(window.innerHeight)?document.documentElement&&document.documentElement.clientHeight?width=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&
(width=document.body.clientHeight):width=window.innerHeight;return width}function d(){var b=$(".loadingCursor");if(0==b.length){b=$('<table class="loadingCursor" style="display:none;z-index:9999;"><tr><td class="loadingCursorImg"></td><td class="loadingCursorText" style="display:none;">'+NextWay.Localization.pleaseWaitText+"</td></tr></table>");$("body").append(b);var k=Math.floor(c()/2),e=Math.floor(a()/2);setNextToCursor(b,k,e);b.fadeIn();$(document).bind("mousemove.ajaxActions",function(a){setNextToCursor($(".loadingCursor"),
a.pageX,a.pageY)})}}var e=0,g,f;this.setTimeouts=function(){f=setTimeout(d,300);g=setTimeout(b,1E3)};this.clearTimeouts=function(){clearTimeout(f);clearTimeout(g)};this.removeWheel=function(){var a=$(".loadingCursor");null!=a&&0<a.length&&cleanUpLoadingCursor(a)};VortalBlockUI.prototype.blockUI=function(){0==e&&($.blockUI({message:null,css:{backgroundColor:"#fff",opacity:0,cursor:"auto"},overlayCSS:{backgroundColor:"#fff",opacity:0,cursor:"auto"}}),this.setTimeouts());e++};VortalBlockUI.prototype.unblockUI=
function(){e--;0==e&&($.unblockUI(),this.clearTimeouts(),this.removeWheel())}}(function(b){b.vortalBlockUI=b.vortalBlockUI||new VortalBlockUI})(jQuery);function NextWayAjaxActionConfig(){function b(c){if(void 0!=c)if("function"==typeof c)c();else if($.isArray(c)&&0<c.length)for(var a=0,d=c.length;a<d;a++)b(c[a])}this.Sucess=this.Error=null;NextWayAjaxActionConfig.prototype.OnError=function(){b(this.Error)};NextWayAjaxActionConfig.prototype.OnSucess=function(){b(this.Sucess)}}
function postForm(b,c,a,d,e,g){var f=null;if(window.tinyMCE)for(tinyMCE.triggerSave(),i=0;i<tinyMCE.editors.length;i++)f=document.getElementById(tinyMCE.editors[i].editorId),null!=f&&(v=f.value,null!=v&&""!=v&&(v=v.replace(/&amp;amp;/gi,"&amp;"),f.value=v));b=$("#"+b).parents("form:first");var h="";b.children("input[name=Post_Back_Action_Name_Hidden]:first").val(c);b.children("input[name=Post_Back_Arguments_Hidden]:first").val(a);b.find("select[arl=true]").each(function(){$("#"+this.id).selectOptions(/./);
null==$("#"+this.id).val()&&(h+="&"+this.name+"=")});c=b.nextWaySerializer();e&&(e=jQuery.param(e),void 0!==e&&""!==e&&(c+="&"+e));c+=h;g?$.ajax({url:d,data:c,type:"POST",cache:!1,timeout:0,beforeSend:function(){$.vortalBlockUI.blockUI()},error:function(a,b,c){$.vortalBlockUI.unblockUI();-1!=d.indexOf("SendChunk")&&(null!=c?document.certificateApplet.DebugInfo(["Ajax error textStatus: ",b," -- errorThrown.Name: ",c.name," -- errorThrown.Number: ",c.number," -- errorThrown.Description: ",c.description,
" -- errorThrown.Message: ",c.message,"\n"].join("")):document.certificateApplet.DebugInfo(["Ajax error textStatus: ",b,"\n"].join("")))},success:function(a){-1!=d.indexOf("SendChunk")&&document.certificateApplet.DebugInfo(["Ajax received data=",a,"\n"].join(""));if(1<a.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var b=document.createElement("html");b.innerHTML=a;formElement=b.getElementsByTagName("form");$.ajax({url:getFormAction(formElement),data:serilizeForm(formElement),
type:"POST",cache:!1,timeout:0,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},success:function(a){$.vortalBlockUI.unblockUI();$.ajax(currentajax)}})}else-1==a.indexOf("AtLoginPage")?($.vortalBlockUI.unblockUI(),parseAjaxElementReturn(a)):($.vortalBlockUI.unblockUI(),openTimeoutBlockUI())},complete:function(){var a=arguments[0];!0!==this.async&&"undefined"!=typeof this.async||"undefined"==typeof a||("unknown"!=typeof a.onreadystatechange&&(a.onreadystatechange=null),"unknown"!=
typeof a.abort&&(a.abort=null));"function"==typeof complete&&complete.apply(this,arguments)},dataType:"html"}):$.ajax({url:d,data:c,type:"POST",cache:!1,timeout:0,error:function(a,b,c){-1!=d.indexOf("SendChunk")&&(null!=c?document.certificateApplet.DebugInfo(["Ajax error textStatus: ",b," -- errorThrown.Name: ",c.name," -- errorThrown.Number: ",c.number," -- errorThrown.Description: ",c.description," -- errorThrown.Message: ",c.message,"\n"].join("")):document.certificateApplet.DebugInfo(["Ajax error textStatus: ",
b,"\n"].join("")))},success:function(a){-1!=d.indexOf("SendChunk")&&document.certificateApplet.DebugInfo(["Ajax received data=",a,"\n"].join(""));if(1<a.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var b=document.createElement("html");b.innerHTML=a;formElement=b.getElementsByTagName("form");$.ajax({url:getFormAction(formElement),data:serilizeForm(formElement),type:"POST",cache:!1,timeout:0,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},success:function(a){$.vortalBlockUI.unblockUI();
$.ajax(currentajax)}})}else-1==a.indexOf("AtLoginPage")?parseAjaxElementReturn(a):openTimeoutBlockUI()},complete:function(){var a=arguments[0];!0!==this.async&&"undefined"!=typeof this.async||"undefined"==typeof a||("unknown"!=typeof a.onreadystatechange&&(a.onreadystatechange=null),"unknown"!=typeof a.abort&&(a.abort=null));"function"==typeof complete&&complete.apply(this,arguments)},dataType:"html"});b.find("select[arl=true]").each(function(){$("#"+this.id).selectOptions(/zzzzz/,!0)})}
function postAction(b,c,a,d){a?$.ajax({url:b,data:c,type:"POST",cache:!1,beforeSend:function(){$.vortalBlockUI.blockUI()},error:function(){$.vortalBlockUI.unblockUI()},success:function(a){if(1<a.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var b=document.createElement("html");b.innerHTML=a;formElement=b.getElementsByTagName("form");$.ajax({url:getFormAction(formElement),data:serilizeForm(formElement),type:"POST",cache:!1,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},
success:function(a){$.vortalBlockUI.unblockUI();$.ajax(currentajax)}})}else-1==a.indexOf("AtLoginPage")?($.vortalBlockUI.unblockUI(),parseAjaxElementReturn(a)):($.vortalBlockUI.unblockUI(),openTimeoutBlockUI());void 0!==d&&d&&"function"===typeof d&&d()},dataType:"html"}):$.ajax({url:b,data:c,type:"POST",cache:!1,success:function(a){if(1<a.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var b=document.createElement("html");b.innerHTML=a;formElement=b.getElementsByTagName("form");
$.ajax({url:getFormAction(formElement),data:serilizeForm(formElement),type:"POST",cache:!1,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},success:function(a){$.vortalBlockUI.unblockUI();$.ajax(currentajax)}})}else-1==a.indexOf("AtLoginPage")?parseAjaxElementReturn(a):openTimeoutBlockUI();void 0!==d&&d&&"function"===typeof d&&d()},dataType:"html"})}
function getActionAutoRefresh(b,c){!1==window.disableAutoRefresh&&$.ajax({url:b,type:"GET",cache:!1,success:function(a){if(1<a.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var b=document.createElement("html");b.innerHTML=a;formElement=b.getElementsByTagName("form");$.ajax({url:getFormAction(formElement),data:serilizeForm(formElement),type:"POST",cache:!1,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},success:function(a){$.vortalBlockUI.unblockUI();$.ajax(currentajax)}})}else-1==
a.indexOf("AtLoginPage")?(a=parseAjaxElementReturnAutoRefresh(a),void 0!=c&&"function"==typeof c&&null!==a&&void 0!==a&&""!=a&&c(a)):openTimeoutBlockUI()},dataType:"html"})}
function getAction(b,c,a,d,e){if(800<=b.length){b=b.split("&");for(var g=b[0],f=1;f<b.length;f++){var h=b[f].split("=");1<h.length&&""===h[1]||(g+="&"+b[f])}b=g}c?$.ajax({url:b,type:"GET",cache:!1,beforeSend:function(){$.vortalBlockUI.blockUI()},error:function(){$.vortalBlockUI.unblockUI();d&&d.OnError()},success:function(b){if(1<b.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var c=document.createElement("html");c.innerHTML=b;formElement=c.getElementsByTagName("form");$.ajax({url:getFormAction(formElement),
data:serilizeForm(formElement),type:"POST",cache:!1,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},success:function(a){$.vortalBlockUI.unblockUI();$.ajax(currentajax)}})}else-1==b.indexOf("AtLoginPage")?($.vortalBlockUI.unblockUI(),parseAjaxElementReturn(b),void 0!=a&&"function"==typeof a&&a(),d&&d.OnSucess()):($.vortalBlockUI.unblockUI(),openTimeoutBlockUI());void 0!==e&&e&&"function"===typeof e&&e()},dataType:"html"}):$.ajax({url:b,type:"GET",cache:!1,success:function(b){if(1<
b.indexOf("RequestSecurityTokenResponseCollection")){currentajax=this;var c=document.createElement("html");c.innerHTML=b;formElement=c.getElementsByTagName("form");$.ajax({url:getFormAction(formElement),data:serilizeForm(formElement),type:"POST",cache:!1,error:function(a,b,c){$.vortalBlockUI.unblockUI();openTimeoutBlockUI()},success:function(a){$.vortalBlockUI.unblockUI();$.ajax(currentajax)}})}else-1==b.indexOf("AtLoginPage")?(parseAjaxElementReturn(b),void 0!=a&&"function"==typeof a&&a()):openTimeoutBlockUI();
void 0!==e&&e&&"function"===typeof e&&e()},dataType:"html"})}function showGetVideoTutorial(b,c){var a=$("#"+b);void 0==a||null==a.html()?getAction(c,!1,function(){$("#"+b).bPopup("open")}):$("#"+b).bPopup("open")}function hideVideoTutorial(b){var c=$("#"+b);c.bPopup("close");setInterval(function(){c.remove()},1E3)}function getFormAction(b){return b[0].attributes.action.nodeValue}
function serilizeForm(b){data={};items=b[0].getElementsByTagName("input");$.each(items,function(b,a){"wctx"==a.name?(wctxSplitted=a.value.split("&"),locationSplitted=window.location.pathname.split("/"),data[a.name]=wctxSplitted[0]+"&"+wctxSplitted[1]+"&ru="+encodeURI("/"+locationSplitted[1]+"/"+locationSplitted[2]+"/"+locationSplitted[3]+"/Noop")):data[a.name]=a.value});return data};
