﻿var WixHtmlComponentManager=function(){this.htmlComponents={};this.createHtmlComponent=function(b){var a=null,d=b.handle,c=this.config.PREFIX_HANDLE+d,j=getFlashAppInstance(),i={x:j.width/this.config.DOCUMENT_WIDTH,y:j.height/this.config.DOCUMENT_HEIGHT},f=Math.round(b.width*i.x),e=Math.round(b.height*i.y);b.width=f;b.height=e;setTimeout("wixHtmlComponentManager.setFrameParams('"+d+"',"+b.x+","+b.y+","+b.width+","+b.height+")",0);var h=b.verticalScroll=="yes"?"auto":"no";try{a=window.document.createElement('<iframe id="'+c+'"'+' name="'+c+'"'+' width="'+f+'"'+' height="'+e+'"'+' src="'+this.getFrameURL(b)+'"'+' scrolling="'+h+'" marginwidth="0" marginheight="0" frameborder="0" framespacing="0" allowtransparency="true" hspace="0" vspace="0">'+"</iframe>")}catch(k){a=window.document.createElement("iframe");a.setAttribute("id",c);a.setAttribute("name",c);a.setAttribute("width",f);a.setAttribute("height",e);a.setAttribute("scrolling",h);a.setAttribute("margin","0");a.setAttribute("marginwidth","0");a.setAttribute("marginheight","0");a.setAttribute("frameborder","0");a.setAttribute("framespacing","0");a.setAttribute("hspace","0");a.setAttribute("vspace","0");a.setAttribute("src",this.getFrameURL(b))}a.style.position="absolute";a.style.margin="0px !important";var g=this.getHtmlComponentComputedPosition(b,{x:1,y:1});a.style.left=g.x+"px";a.style.top=g.y+"px";window.document.body.appendChild(a);addListener(a.contentWindow,"load",function(){wixHtmlComponentManager.frameOnLoad(d)})};this.getFrameURL=function(a){var b=[],c=false;if(a.horizontalAlign!="left"||a.verticalAlign!="top"||a.verticalScroll=="yes")c=true;b.push("wrap="+(c?"yes":"no"));b.push("gzip="+a.gzip);b.push("bg="+a.backgroundColor);if(c){b.push("halign="+a.horizontalAlign);b.push("valign="+a.verticalAlign)}return this.config.HTML_SERVER_URL+a.guid+"?"+b.join("&")};this.getHtmlComponentComputedPosition=function(b,c){var a=findFlashAppInstancePosition();return {x:a.x+b.x*c.x,y:a.y+b.y*c.y}};this.updateFrameSize=function(c){var b=document.getElementById(this.config.PREFIX_HANDLE+c);if(b){var a=b.contentWindow||b.contentDocument;if(a.document)a=a.document;if(a.body.scrollWidth>0)b.width=a.body.scrollWidth;if(a.body.scrollHeight>0)b.height=a.body.scrollHeight}};this.frameOnLoad=function(a){if(this.getFrameParams(a).extendable)this.updateFrameSize(a)};this.getFrameParams=function(a){return this.htmlComponents["_"+a]};this.setFrameParams=function(a,d,e,c,b){this.htmlComponents["_"+a]={handle:a,x:d,y:e,width:c,height:b}};this.docPageUpdated=function(){if(this.config.INITIAL_WIX_APP_WIDTH>0&&this.config.INITIAL_WIX_APP_HEIGHT>0){var a=getFlashAppInstance();this.config.INITIAL_WIX_APP_WIDTH=a.width;this.config.INITIAL_WIX_APP_HEIGHT=a.height}};this.updateHtmlComponent=function(a,c){var b=document.getElementById(this.config.PREFIX_HANDLE+a.handle);if(b)if(c){var d=this.getHtmlComponentComputedPosition(a,c);b.style.left=d.x+"px";b.style.top=d.y+"px";b.style.width=a.width*c.x+"px";b.style.height=a.height*c.y+"px";b.setAttribute("width",a.width*c.x);b.setAttribute("height",a.height*c.y)}else{if(a.width){b.setAttribute("width",a.width);b.style.width=a.width+"px"}if(a.height){b.setAttribute("height",a.height);b.style.height=a.height+"px"}}};this.showHtmlComponent=function(b){var a=document.getElementById(this.config.PREFIX_HANDLE+b.handle);if(a)a.style.display="block"};this.hideHtmlComponent=function(b){var a=document.getElementById(this.config.PREFIX_HANDLE+b.handle);if(a)a.style.display="none"};this.removeHtmlComponent=function(b){var a=document.getElementById(this.config.PREFIX_HANDLE+b.handle);if(a)a.parentNode.removeChild(a)}};WixHtmlComponentManager.prototype.config={PREFIX_HANDLE:"htmlComponentFrame",HTML_SERVER_URL:null,DOCUMENT_WIDTH:0,DOCUMENT_HEIGHT:0,INITIAL_WIX_APP_WIDTH:0,INITIAL_WIX_APP_HEIGHT:0};var wixHtmlComponentManager=new WixHtmlComponentManager,MARGIN_WIDTH=12,MARGIN_HEIGHT=12,FOOTER_HEIGHT=31,IS_BEST_FIT=false;function handleUserServerResponse(e,d,b,a,c,f){var g=getFlashAppInstance();g.handleUserServerResponse(e,d,b,a,c,f)}function addListener(a,b,c){if(a.addEventListener)a.addEventListener(b,c,false);else if(a.attachEvent)a.attachEvent("on"+b,c);else a["on"+b]=c}function openUrl(a){var b=window.open(a,"_blank");b.focus();return true}function openUrlNoMenu(f,d){var b=false,c=getPhysicalScreenDimensions(),a=window.open(f,"_blank","resizable=yes,menubar=no,status=no,titlebar=no,toolbar=no,channelmode=yes,width="+c.width+",height="+c.height);if(!a||a.closed||typeof a.closed=="undefined")b=true;else a.focus();if(d){var e=getFlashAppInstance();e.popupFailure(b)}return true}function isIE(){return navigator.appName.indexOf("Microsoft")!=-1}function getPhysicalScreenDimensions(){var b=1024,a=768;if(isIE()){b=document.body.width;a=document.body.height}else{b=screen.width;a=screen.height}return {width:b,height:a}}function getScreenDimensions(){var b=0,a=0;if(!window.innerWidth)if(!(document.documentElement.clientWidth==0)){b=document.documentElement.clientWidth;a=document.documentElement.clientHeight}else{b=document.body.clientWidth;a=document.body.clientHeight}else{b=window.innerWidth;a=window.innerHeight}return {width:b-2*MARGIN_WIDTH,height:a-(2*MARGIN_HEIGHT+(getFooter()?FOOTER_HEIGHT:0))}}function getScrollOffset(){var a=0,b=0;if(self.pageYOffset){a=self.pageXOffset;b=self.pageYOffset}else if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollLeft;b=document.documentElement.scrollTop}else if(document.body){a=document.body.scrollLeft;b=document.body.scrollTop}return {x:a,y:b}}function getViewport(){var d=getFlashAppInstance(),a=getScreenDimensions(),b=findFlashAppInstancePosition(),c=getScrollOffset();return {x:c.x,y:c.y,width:Math.min(a.width-b.x,d.clientWidth),height:Math.min(a.height-b.y,d.clientHeight)}}function findFlashAppInstancePosition(){return findElementPosition(getFlashAppInstance())}function findElementPosition(a){if(typeof a.offsetParent!="undefined"){for(var b=0,c=0;a;a=a.offsetParent){b+=a.offsetLeft;c+=a.offsetTop}return {x:b,y:c}}else return {x:a.x,y:a.y}}function getScreenSize(){var a=getScreenDimensions();return a.width+","+a.height}function setTitle(a){document.title=a}function getFlashAppInstance(){return swfobject.getObjectById("app")}function getFooter(){return document.getElementById("wixfooter")}function setFooterWidth(b){try{var a=getFooter();if(a)a.style.width=b+"px"}catch(c){}}function setSize(b,a){setFooterWidth(b);var d=getFlashAppInstance();d.width=b;d.height=a;var e=getScreenDimensions();document.body.style.marginTop=a>e.height?"8px":"0";if(wixHtmlComponentManager.config.INITIAL_WIX_APP_WIDTH==0&&wixHtmlComponentManager.config.INITIAL_WIX_APP_HEIGHT==0){wixHtmlComponentManager.config.INITIAL_WIX_APP_WIDTH=b;wixHtmlComponentManager.config.INITIAL_WIX_APP_HEIGHT=a}else{var c,f={x:b/wixHtmlComponentManager.config.INITIAL_WIX_APP_WIDTH,y:a/wixHtmlComponentManager.config.INITIAL_WIX_APP_HEIGHT};if(wixHtmlComponentManager)for(var g in wixHtmlComponentManager.htmlComponents){c=wixHtmlComponentManager.htmlComponents[g];wixHtmlComponentManager.updateHtmlComponent(c,f)}}}function createStyles(c,e,d){IS_BEST_FIT=c=="fitScreen";var a=[];a.push('<style type="text/css">');if(IS_BEST_FIT)a.push("body {overflow:hidden !important}");else{var b=getScreenDimensions();if(d>b.height)a.push("body {margin-top:8px}")}a.push("</style>");document.write(a.join(""))}function doGooglitics(a){pageTracker._trackPageview(a);if(hasGoogleAnalytics)pageTrackerUser._trackPageview(a)}function doGoogliticsWix(a){pageTracker._trackPageview(a)}function doGoogliticsUser(a){if(null!=userGoogleAnalytics&&""!=userGoogleAnalytics)if(hasGoogleAnalytics)pageTrackerUser._trackPageview(a)}function gaSSDSLoad(e){var d="https:"==document.location.protocol?"https://ssl.":"http://www.",c,a;a=document.createElement("script");a.src=d+"google-analytics.com/ga.js";a.type="text/javascript";a.onloadDone=false;function b(){c=_gat._getTracker(e);c._trackPageview();if(hasGoogleAnalytics){pageTrackerUser=_gat._getTracker(userGoogleAnalytics);pageTrackerUser._initData();pageTrackerUser._trackPageview()}}a.onload=function(){a.onloadDone=true;b()};a.onreadystatechange=function(){if(("loaded"===a.readyState||"complete"===a.readyState)&&!a.onloadDone){a.onloadDone=true;b()}};document.getElementsByTagName("head")[0].appendChild(a)}function pageOnLoad(){gaSSDSLoad(wixGoogleAnalytics)}function pageOnResize(){var a=getScreenDimensions(),b=getFlashAppInstance();if(b!=null)try{b.onScreenResize(a.width,a.height)}catch(c){}return false}function setHistoryFrame(c,a){try{var b=c.substr(8,c.indexOf(",")-8);if(a!=null&&a.length>0)b=b+"_"+a;b=b+".html";var d=document.getElementById("historyframe");if(d!=null)d.src="/siteBackHtml?adress="+c+"&additionalInfo="+a}catch(e){var d=document.getElementById("historyframe");if(d!=null)d.src="/siteBackFiles/siteBack.html?adress="+c+"&additionalInfo="+a}}function onHistoryFrameLoaded(c,b){var a=getFlashAppInstance();if(a!=null)try{a.onHistoryFrameLoaded(c,b)}catch(d){}}addListener(window,"load",function(){pageOnLoad()});addListener(window,"resize",function(){pageOnResize()})
