var popupWindow=null,WINDOW_CONTAINER_WIDTH=Utils.getViewportWidth(),WindowModal=function(a){if(a){this.ctrl=a;this.content=a.href;a.onclick=function(){return false};a.onclick=this.activate.bind(this);popupWindow=this;this.popupAjaxRequestProperties={popupLoadingTimeout:2E4,popupAjaxRequest:null,popupLoadingTimeoutID:false,popupLoadingRequestAborted:false,popupLoadingProgressShown:false};this.ajaxLoadingEffect=null}};
WindowModal.prototype=Object.extend(new CCnfDialog("cnf-container"),{getPage:function(){if(document.getElementsByTagName("body")[0]){if(this.ajaxLoadingEffect==null)this.ajaxLoadingEffect=new AjaxLoadingEffect({containerId:document.getElementsByTagName("body")[0]});this.ajaxLoadingEffect.setLoadingEffect()}var a=this.content;if(this.ctrl.rel=="showSeko")a=this.content+getUrlParamsForSekoSynergy();this.popupAjaxRequestProperties.popupAjaxRequest=new Ajax.Request(a,{onCreate:this.onCreateTabLoading.bind(this),
onFailure:this.onFailureTabLoading.bind(this),onSuccess:this.successLoading.bind(this)})},onTabLoadingTimeout:function(){var a=this.popupAjaxRequestProperties.popupAjaxRequest;if(Utils.callInProgress(a.transport)){this._abortTabAjaxRequest(a);a.options.onFailure&&a.options.onFailure(a.transport,a.json)}},onFailureTabLoading:function(){var a=Utils.getViewportWidth(),b=Utils.getViewportHeight();a=parseInt(a/2);b=parseInt(b/2);this.okAlertButtonTitle="Close";this.displayDialog($("window"),a-120,b-50,
{title:LOC_CNF_AJAX_TIMEOUT,rel:"alert",ok:this.onFailureokCnf.bind(this)});window.clearTimeout(this.popupAjaxRequestProperties.popupLoadingTimeoutID);popupWindow.deactivate()},onFailureokCnf:function(){$("overlay").removeClassName("errLoadingProgress");this.deactivate();this.hideCnf();return false},_abortTabAjaxRequest:function(a){this.popupAjaxRequestProperties.popupLoadingRequestAborted=true;a.transport.abort()},onCreateTabLoading:function(){this.popupAjaxRequestProperties.popupLoadingTimeoutID=
window.setTimeout(this.onTabLoadingTimeout.bind(this),this.popupAjaxRequestProperties.popupLoadingTimeout)},_onTabLoadingSuccess:function(){if(this.popupAjaxRequestProperties.popupLoadingRequestAborted)return this.popupAjaxRequestProperties.popupLoadingRequestAborted=false;this.popupAjaxRequestProperties.popupLoadingTimeoutID&&window.clearTimeout(this.popupAjaxRequestProperties.popupLoadingTimeoutID);return true},successLoading:function(a){var b=Utils.getViewportWidth(),c=Utils.getViewportHeight();
parseInt(b/2);parseInt(c/2);b=$("window");if(arguments.length>2){new Insertion.Bottom($("lbContent"),a.responseText.stripScripts());c=$("lbContent").down(0);c.style.visibility="hidden";c.setStyle({visibility:"hidden",left:arguments[1],top:arguments[2]})}else{b.update("<div id='lbContent'>"+a.responseText.stripScripts()+"</div>");c=$("lbContent").down(0);c.style.visibility="hidden";b.className="done";this.updatePosition(c)}c.style.visibility="visible";a.responseText.extractScripts().each(function(d){Utils.evalGlobally(d)});
this.actions();this.ajaxLoadingEffect!=null&&this.ajaxLoadingEffect.removeLoadingEffect()},updatePosition:function(a){var b=Utils.getViewportWidth(),c=Utils.getViewportHeight();b=parseInt(b/2);c=parseInt(c/2);a.style.left=b-$(a).getWidth()/2+"px";a.style.top=c-$(a).getHeight()/2>0?c-$(a).getHeight()/2+"px":"5px"},activate:function(){if(Prototype.Browser.IE){this.prepareIE();this.hideSelects("hidden")}window.addEventListener&&window.addEventListener("DOMMouseScroll",wheel,false);window.onmousewheel=
document.onmousewheel=wheel;window.scrollTo(0,0);this.hideShowBodyScroll("hidden");this.displayWindow("block");return false},hideShowBodyScroll:function(a){document.body.style.overflow=a},prepareIE:function(){bod=document.getElementsByTagName("body")[0];$("overlay").style.height=bod.scrollHeight+"px"},hideSelects:function(a){selects=document.getElementsByTagName("select");for(i=0;i<selects.length;i++)selects[i].style.visibility=a},displayWindow:function(a){$("overlay").style.display=a;$("window").style.display=
a;$("window").innerHTML="";a!="none"&&this.getPage()},actions:function(){var a=document.getElementsByTagName("A");for(i=0;i<a.length;i++)if(a[i].rel=="deactivate")a[i].onclick=this.deactivate.bind(this)},deactivate:function(){if(Prototype.Browser.IE){this.prepareIE();this.hideSelects("visible")}window.removeEventListener&&window.removeEventListener("DOMMouseScroll",wheel,false);window.onmousewheel=document.onmousewheel=null;this.hideShowBodyScroll("");this.displayWindow("none");return false}});
function initializeWindow(){if(arguments.length>0){if($(arguments[0])){var a=$(arguments[0]).getElementsByTagName("a");for(i=0;i<a.length;i++)a[i].rel=="showWindow"&&new WindowModal(a[i]);var b=$(arguments[0]).getElementsByTagName("a");alert(2);for(i=0;i<b.length;i++)b[i].rel=="showSeko"&&new WindowModal(b[i])}}else{a=$$('a[rel="showWindow"]');b=$$('a[rel="showSeko"]');for(i=0;i<a.length;i++)new WindowModal(a[i]);for(i=0;i<b.length;i++)new WindowModal(b[i])}}
function addWindowModal(){bod=document.getElementsByTagName("body")[0];if(!$("overlay")){overlay=document.createElement("div");overlay.id="overlay";var a=document.createElement("div");a.id="window";a.className="loading";bod.appendChild(overlay);bod.appendChild(a)}}Event.observe(document,"dom:loaded",addWindowModal);
function wheel(a){var b=0;if(!a)a=window.event;if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera)b=-b}else if(a.detail)b=-a.detail/3;b&&handle(b);a.preventDefault&&a.preventDefault();a.returnValue=false}function handle(){};
