{var buble={"cont":null,"loader":null,"showTimer":null,"hideTimer":null,"x":0,"y":0,"hide":function(){function closeBuble(){window.clearTimeout(buble.showTimer);buble.showTimer=null;if(buble.loader!=null){buble.cont.removeChild(buble.loader);buble.loader=null;}}buble.hideTimer=window.setTimeout(closeBuble,200);return false;},"show":function(o,url,e){if(!e){e=window.event;};this.x=e.clientX;this.y=e.clientY;sX=!document.documentElement.scrollTop?document.body.scrollLeft:document.documentElement.scrollLeft;sY=!document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;this.x=this.x+sX;this.y=this.y+sY+5;buble.cont=document.getElementsByTagName("body")[0];function getData(){window.status="* "+url+" *";SZN.xmlhttpPost(url,buble.makeOutput);};buble.showTimer=window.setTimeout(getData,500);},"cancelHide":function(){window.clearTimeout(buble.hideTimer);buble.hideTimer=null;},"makeOutput":function(data){var c=buble.cont;var l=buble.loader=document.createElement("div");var text=data.content;var title=data.title;var imgURL=data.pictureURL;var imgW=data.pictureW?"width=\""+data.pictureW+"\"":"";var imgH=data.pictureH?"height=\""+data.pictureH+"\"":"";var imgAlt=data.pictureAlt?"alt=\""+data.pictureAlt+"\"":"alt=\"\"";var html="<div id=\"buble-cnt\" onmouseover=\"return buble.cancelHide();\" onmouseout=\"return buble.hide();\" style=\"top:"+buble.y+"px; left:"+buble.x+"px;\"><div id=\"buble\">";html+="<div class=\"close\">";html+="\t<a href=\"#\" onclick=\"return buble.hide();\">Zavřít okno</a> ";html+="\t<a href=\"#\" onclick=\"return buble.hide();\"><img src=\"/static/images/bubble-X.gif\" alt=\"zavřít\" title=\"zavřít\" width=\"16\" height=\"16\" /></a>";html+="</div>";html+="<h4>"+title+"</h4>";html+="<p>";if(imgURL){html+="<img src=\""+imgURL+"\" width=\""+imgW+"\" height=\""+imgH+"\" alt=\""+imgAlt+"\" />";}html+=text+"</p>";html+="<div class=\"clear\"></div></div></div>";l.innerHTML=html;c.appendChild(l);}};var playerBuble={"cont":null,"loader":null,"showTimer":null,"hideTimer":null,"x":0,"y":0,"hide":function(){function closeBuble(){window.clearTimeout(playerBuble.showTimer);playerBuble.showTimer=null;if(playerBuble.loader!=null){playerBuble.cont.removeChild(playerBuble.loader);playerBuble.loader=null;}}playerBuble.hideTimer=window.setTimeout(closeBuble,200);return false;},"show":function(o,url,e){if(!e){e=window.event;};this.x=e.clientX;this.y=e.clientY;sX=!document.documentElement.scrollTop?document.body.scrollLeft:document.documentElement.scrollLeft;sY=!document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;this.x=this.x+sX;this.y=this.y+sY+5;playerBuble.cont=document.getElementsByTagName("body")[0];function getData(){window.status="* "+url+" *";SZN.xmlhttpPost(url,playerBuble.makeOutput);};playerBuble.showTimer=window.setTimeout(getData,500);},"cancelHide":function(){window.clearTimeout(playerBuble.hideTimer);playerBuble.hideTimer=null;},"makeOutput":function(data){var c=playerBuble.cont;var l=playerBuble.loader=document.createElement("div");if(data.pictureUrl!="---"){var playerPicture="<img src=\""+data.pictureUrl+"\" alt=\""+data.name+" "+data.surname+"\" class=\"photo\" />";}else{var playerPicture="<img src=\"/static/images/no_player.gif\" alt=\"Fotografie není k dispozici.\" class=\"photo\" width=\"150\" height=\"190\" />";}var NONE="---";var content="<div id=\"buble-cnt\" class=\"playerPopUp\" onmouseover=\"return playerBuble.cancelHide();\" onmouseout=\"return playerBuble.hide();\" style=\"top:"+playerBuble.y+"px; left:"+playerBuble.x+"px;\">";content+=""+"<div class=\"top\"><a href=\"#\" onclick=\"return playerBuble.hide();\">Zavři kartu hráče</a></div>"+"<div class=\"content\">"+playerPicture+"<h4>"+data.name+" "+data.surname+"</h4>"+"<dl class=\"typ1\">"+"<dt>Klub:</dt> <dd>"+data.team+"</dd>"+"<dt>Datum narození:</dt> <dd>"+data.birthday+"</dd>"+"<dt>Výška / Váha:</dt> <dd>"+data.height+" / "+data.weight+"</dd>"+"<dt>Post / číslo dresu:</dt> <dd>"+data.position+" / "+data.number+"</dd>"+"<dt>Ligové starty / góly:</dt> <dd>"+data.historyCount+" / "+data.historyGoal+"</dd>"+"<dt>Repr. starty / góly:</dt> <dd>"+data.repreCount+" / "+data.repreGoal+"</dd>"+"<dt>Počet gólů:</dt> <dd>"+data.goals+"</dd>"+"<dt>Karet v sezóně:</dt> <dd>"+data.cards+"</dd>"+"<dt>Počet střídání:</dt> <dd>"+data.changes+"</dd>"+"</dl>"+"<dl class=\"typ3\">"+"<dt>Kariéra:</dt> <dd>"+data.career+"</dd>"+"</dl>"+"<div class=\"cleaner\"></div>"+"</div>"+"<div class=\"bottom\"></div>";content+="</div>";l.innerHTML=content;c.appendChild(l);}};Celebrity=SZN.ClassMaker.makeClass({"NAME":"Celebrity","VERSION":"1.4","CLASS":"class"});Celebrity.prototype.$constructor=function(mainImg,linkClass,paging){this.selectedPhoto=[0,0];this.paging=paging;this.mainImg=SZN.gEl(mainImg);SZN.Events.addListener(this.mainImg,"click",this,"next");this.ec=[];this.linkClass=linkClass;this.pageNum=0;this.init(0);};Celebrity.prototype.init=function(n){this.pageNum=n;for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}this.links=SZN.Dom.getElementsByClass(this.linkClass,false,"a");for(var i=0;i<this.links.length;i++){if(this.selectedPhoto[0]==n&&this.selectedPhoto[1]==i){SZN.Dom.addClass(this.links[i],"selected");}this.links[i].photo_number=[n,i];this.ec.push(SZN.Events.addListener(this.links[i],"click",this,"_click",true));var u=0;while(u<this.links[i].childNodes.length){if(this.links[i].childNodes[u].nodeType==1){this.links[i].par_text=this.links[i].childNodes[u].alt;break;}u++;}}};Celebrity.prototype.next=function(e,elm){var i=this.selectedPhoto[1];if(this.pageNum!=this.selectedPhoto[0])i=-1;if(this.links.length==i+1&&this.paging){if(!this.paging.stepNext){this.paging.start(e);this._click(e,this.links[0]);}else{this.paging.next(e);this._click(e,this.links[0]);}}else{if(this.links.length==i+1){this._click(e,this.links[0]);}else{this._click(e,this.links[i+1]);}}};Celebrity.prototype._click=function(e,elm){this.selectedPhoto=elm.photo_number;for(var i=0;i<this.links.length;i++){SZN.Dom.removeClass(this.links[i],"selected");}SZN.Dom.addClass(elm,"selected");this.mainImg.src=elm.href;SZN.gEl("photo-desc").innerHTML=elm.par_text;SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);elm.blur();return true;};SZN.EmailNotice=SZN.ClassMaker.makeClass({"NAME":"SZN.EmailNotice","VERSION":"1.0","CLASS":"class"});SZN.EmailNotice.prototype.$constructor=function(emailForm,emailId,emailFrom,emailTo,emailSubmit){this.emailForm=emailForm;this.emailId=emailId;this.emailFrom=emailFrom;this.emailTo=emailTo;this.emailSubmit=emailSubmit;SZN.Events.addListener(this.emailSubmit,"click",this,"click",false,true);};SZN.EmailNotice.prototype.click=function(e,elm){SZN.Events.cancelDef(e);var from=encodeURIComponent(this.emailFrom.value);var to=encodeURIComponent(this.emailTo.value);var post="id="+this.emailId.value+"&ajax=yes&from="+from+"&to="+to;var rq=new SZN.HTTPRequest();rq.setMethod("post");rq.setFormat("txt");rq.setMode("async");rq.setPostData(post);rq.send(this.emailForm.action,this,"_sent");};SZN.EmailNotice.prototype._sent=function(txt,status){eval("data="+txt+";");if(data.status==1){this.emailFrom.value="";this.emailTo.value="";alert("E-mail byl úspěšně odeslán na "+data.to);}else{errors="Některé položky jsou špatně vyplněny:\n";for(i=0;i<data.errors.length;i++)errors+=data.errors[i].message+"\n";alert(errors);}};Inquiry=SZN.ClassMaker.makeClass({"NAME":"Inquiry","VERSION":"1.0","CLASS":"class"});Inquiry.prototype.$constructor=function(id,colors){this.ID=id;this.colors=colors;};Inquiry.prototype.fetch=function(){var rq=new SZN.HTTPRequest();rq.setMethod("post");rq.setFormat("txt");rq.setMode("async");rq.send("/inquiry/screen?inquiryIds="+this.ID,this,"show");};Inquiry.prototype.vote=function(inquiryId,answerId){var rq=new SZN.HTTPRequest();rq.setMethod("post");rq.setFormat("txt");rq.setMode("async");rq.send("/inquiry/vote?inquiryId="+inquiryId+"&answerId="+answerId,this,"voted");return false;};Inquiry.prototype.voted=function(txt,status,attr){this.fetch();};Inquiry.prototype.show=function(txt,status,attr){eval("result = "+txt+";");for(n=0;n<result.inquiry.length;n++){var row=result.inquiry[n];var votedAnswer="";var rightAnswer="";var answerCount="";var inquiryHTML="";switch(row.type){case "inquiry":var inquiryEl=SZN.gEl("inquiry"+row.inquiryId);inquiryEl.innerHTML="<h2><span>Anketa:</span> "+row.title+"</h2>";var graphData=[];var graphColors=this.colors;for(i=0;i<row.answers.length;i++){graphData.push({"label":"","data":row.answers[i].pc});var odpoved=row.answers[i].text+" - "+row.answers[i].pc+"% ";if(row.canVote){var link=SZN.cEl("a",false,"answer");link.href="#";link.style.color=graphColors[i%graphColors.length];var inquiryId=row.inquiryId;var answerId=row.answers[i].answerId;link.onclick=this.generateAnonymousVoteFunc(this,inquiryId,answerId);link.innerHTML=odpoved;inquiryEl.appendChild(link);}else{var odp=SZN.cEl("span",false,"answer");odp.style.color=graphColors[i%graphColors.length];odp.innerHTML=odpoved;inquiryEl.appendChild(odp);}}if(row.sumCount>0){var div=SZN.cEl("div","inquiry_graph_"+row.inquiryId,"inquiry_graph");div.style.height="180px";div.style.width="220px";inquiryEl.appendChild(div);var piechart=new SZN.PieChart("inquiry_graph_"+row.inquiryId,graphData,{"depth":15,"skew":0.65,"padding":35,"legend":false,"colors":graphColors,"outlineColor":{"legend":"#000","graph":"#e7ebef"}});}if(!row.canVote&&row.votedAnswer){var voted=SZN.cEl("span",false,"voted");voted.innerHTML="V této anketě už jste hlasoval/a.";inquiryEl.appendChild(voted);}var reader="";var vote="";switch(row.sumCount){case 1:vote="";reader="";break;case 2,3,4:vote="i";reader="i";break;default:vote="o";reader="ů";break;}var p=SZN.cEl("p",false,"voteCount type"+row.type);p.innerHTML="Celkem hlasoval"+vote+" <strong>"+row.sumCount+"</strong> čtenář"+reader+".";inquiryEl.appendChild(p);inquiryEl.appendChild(SZN.cEl("br"));break;case "fashion_sh":var inquiryEl=SZN.gEl("content");var id="fashion_sh_"+row.inquiryId;var elmf=SZN.gEl(id);if(elmf){elmf.parentNode.removeChild(elmf);elmf=null;}var galleryData=[];var div=SZN.cEl("div",id,"hlidka");for(var i=0;i<row.answers.length;i++){div.innerHTML+="<div class=\"photo "+(i%2==0?"":"noright")+" \"> <h3>"+(i+1)+". "+row.answers[i].text+" </h3> "+"<div class=\"img\"><a href=\""+this.imgPath+"/"+row.answers[i].pictureUrl.replace("%s","600x450")+".jpg\"><img src=\""+this.imgPath+"/"+row.answers[i].pictureUrl.replace("%s","230x305")+".jpg\" alt=\""+row.answers[i].text+"\" height=\"305\" width=\"230\" /></a></div> "+"<p>"+row.answers[i].description+"</p>"+"</div>";galleryData.push({"big":{"url":this.imgPath+"/"+row.answers[i].pictureUrl.replace("%s","600x450")+".jpg"},"small":{"url":this.imgPath+"/"+row.answers[i].pictureUrl.replace("%s","100x75")+".jpg"},"alt":row.answers[i].text,"description":row.answers[i].text});}inquiryEl.appendChild(div);var imgBox=SZN.cEl("div",false,"photo forth");div.appendChild(imgBox);imgBox.innerHTML="<h3>Hlasování</h3> ";var celebVote=SZN.cEl("div","celebvote");imgBox.appendChild(celebVote);celebVote.innerHTML="<h4>"+row.title+"</h4> ";var innerDiv=SZN.cEl("div");celebVote.appendChild(innerDiv);if(row.canVote){for(i=0;i<row.answers.length;i++){var d=SZN.cEl("div",false,"celeb");d.appendChild(SZN.cTxt(" "+(i+1)+". "));var link=SZN.cEl("a",false,"color"+i);link.href="#";link.onclick="";link.onclick=this.generateAnonymousVoteFunc(this,row.inquiryId,row.answers[i].answerId);link.innerHTML=row.answers[i].text;d.appendChild(link);innerDiv.appendChild(d);}}else{innerDiv.className="voted";for(i=0;i<row.answers.length;i++){var pct=Math.round(row.answers[i].voteCount/row.sumCount*1000)/10;innerDiv.innerHTML+="<div class=\"celeb\"> "+(i+1)+". "+row.answers[i].text+" <div class=\"percent\">"+pct+"%</div> <div class=\"scale\"> <div style=\"width: "+pct+"%;\" class=\"inscale\"> </div> </div> <span>Hlasovalo "+row.answers[i].voteCount+"</span> </div>";}}SZN.LightBox.SuperOptObj.anchorageOpt.elmId="inquiryInArticle";var gsh=new SZN.LightBox(galleryData,SZN.LightBox.SuperOptObj);var divs=SZN.Dom.getElementsByClass("img");var links=[];for(var i=0;i<divs.length;i++){var ls=divs[i].getElementsByTagName("a");for(var j=0;j<ls.length;j++){links.push(ls[j]);}}var j=0;for(var i=0;i<links.length;i++){if(links[i]!=null){gsh.bindElement(links[i],j);j++;}}break;}}};Inquiry.prototype.generateAnonymousVoteFunc=function(obj,a,b){return function(){obj.vote(a,b);return false;};};SZN.Interpolator=SZN.ClassMaker.makeClass({"NAME":"Interpolator","VERSION":"1.0","CLASS":"class"});SZN.Interpolator.LINEAR=1;SZN.Interpolator.QUADRATIC=2;SZN.Interpolator.SQRT=3;SZN.Interpolator.SIN=4;SZN.Interpolator.ASIN=5;SZN.Interpolator.prototype.$constructor=function(startVal,endVal,interval,callback,options){this.startVal=startVal;this.endVal=endVal;this.interval=interval;this.callback=callback;this.options={"interpolation":SZN.Interpolator.LINEAR,"frequency":20,"endCallback":false};this.running=false;this._tick=SZN.bind(this,this._tick);for(var p in options){this.options[p]=options[p];}};SZN.Interpolator.prototype._call=function(frac){var result=this._interpolate(frac);var delta=this.endVal-this.startVal;this.callback(this.startVal+delta*result);};SZN.Interpolator.prototype._interpolate=function(val){if(typeof (this.options.interpolation)=="function"){return this.options.interpolation(val);}switch(this.options.interpolation){case SZN.Interpolator.QUADRATIC:return val*val;case SZN.Interpolator.SQRT:return Math.sqrt(val);case SZN.Interpolator.SIN:return (Math.sin(Math.PI*(val-0.5))+1)/2;case SZN.Interpolator.ASIN:return (Math.asin(2*(val-0.5))+Math.PI/2)/Math.PI;default:return val;}};SZN.Interpolator.prototype.start=function(){if(this.running){return;}this.running=true;this.startTime=(new Date()).getTime();this._call(0);this.handle=setInterval(this._tick,this.options.frequency);};SZN.Interpolator.prototype.stop=function(){if(!this.running){return;}this.running=false;clearInterval(this.handle);};SZN.Interpolator.prototype._tick=function(){var now=(new Date()).getTime();var elapsed=now-this.startTime;if(elapsed>=this.interval){this.stop();this._call(1);if(this.options.endCallback){this.options.endCallback();}}else{this._call(elapsed/this.interval);}};SZN.CSSInterpolator=SZN.ClassMaker.makeClass({"NAME":"CSSInterpolator","VERSION":"1.0","CLASS":"class"});SZN.CSSInterpolator.prototype.$constructor=function(elm,interval,options){this.elm=elm;this.properties=[];this.colors=[];this._tick=SZN.bind(this,this._tick);this.interpolator=new SZN.Interpolator(0,1,interval,this._tick,options);};SZN.CSSInterpolator.prototype.addProperty=function(property,startVal,endVal,suffix){var o={"property":property,"startVal":startVal,"endVal":endVal,"suffix":suffix||""};this.properties.push(o);};SZN.CSSInterpolator.prototype.addColorProperty=function(property,startVal,endVal){var o={"startVal":SZN.Parser.color(startVal),"endVal":SZN.Parser.color(endVal),"property":property};this.colors.push(o);};SZN.CSSInterpolator.prototype.start=function(){this.interpolator.start();};SZN.CSSInterpolator.prototype.stop=function(){this.interpolator.stop();};SZN.CSSInterpolator.prototype._tick=function(frac){for(var i=0;i<this.properties.length;i++){var prop=this.properties[i];var val=prop.startVal+frac*(prop.endVal-prop.startVal);val+=prop.suffix;this.elm.style[prop.property]=val;}var names=["r","g","b"];for(var i=0;i<this.colors.length;i++){var c=this.colors[i];var out=[0,0,0];for(var j=0;j<names.length;j++){var name=names[j];out[j]=c.startVal[name]+Math.round(frac*(c.endVal[name]-c.startVal[name]));}var result="rgb("+out.join(",")+")";this.elm.style[c.property]=result;}};SZN.LightBox=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox","VERSION":"1.0","CLASS":"class","IMPLEMENT":[SZN.SigInterface,SZN.Components]});SZN.LightBox.DIR_PREW=-1;SZN.LightBox.DIR_NEXT=1;SZN.LightBox.prototype.$constructor=function(data,optObj){this.options={"components":{"anchorage":SZN.LightBox.Anchorage,"main":SZN.LightBox.Main,"strip":SZN.LightBox.Strip,"description":SZN.LightBox.Description,"pageShader":SZN.LightBox.PageShader,"navigation":SZN.LightBox.Navigation,"transition":SZN.LightBox.Transition,"others":[]},"imagePath":"img/","imageFormat":"png","parent":false,"zIndex":false,"useShadow":false,"usePageShader":true,"shadowSizes":[16,16,16,16],"galleryId":false,"galleryClassName":"image-browser-content","handleDocumentCloseClick":true,"mainOpt":{"id":false,"className":"image-browser-image","useMouseWheelScroll":true},"stripOpt":{"id":false,"className":"image-browser-thumbs","orientation":"vertical","activeBorder":"inner","activeId":false,"activeClassName":"image-browser-active","imageBoxClassName":"image-browser-thumb-box"},"descriptionOpt":{"id":false,"className":"image-browser-caption","contentId":false,"contentClassName":"image-browser-caption-content"},"navigationOpt":{"id":false,"className":"image-browser-navigation","continuous":true,"showDisabled":false,"nextClassName":"image-browser-next","prevClassName":"image-browser-prev","closeClassName":"image-browser-close"},"transitionOpt":{},"anchorageOpt":{}};for(var p in optObj){if(optObj[p] instanceof Object&&!optObj[p].CLASS){for(var o in optObj[p]){this.options[p][o]=optObj[p][o];}}else{this.options[p]=optObj[p];}}this.dom={};this.ec=[];this.objCache=[];this.components=[];this.visible=false;this.index=0;this.direction=SZN.LightBox.DIR_NEXT;this.blindLinkName=SZN.idGenerator();this.blindStyle={"position":"absolute","top":"-1000px","left":"-1000px","width":"1px","height":"1px","overflow":"hidden"};this.data=[];for(var i=0;i<data.length;i++){var item=data[i];var o={};for(var j in item){o[j]=item[j];}if(item.main){this.index=i;}this.data.push(o);}this._buildContainer();this._renderBlindStart();this._render();for(var i=0;i<this.options.components.others.length;i++){this.addNewComponent(this.options.components.others[i]);}this._renderBlindEnd();};SZN.LightBox.create=function(elm,optObj){elm=SZN.gEl(elm);var data=[];var l=[];var links=elm.getElementsByTagName("a");for(var i=0;i<links.length;i++){var img=links[i].getElementsByTagName("img")[0];if(!img){continue;}data.push({"alt":links[i].alt,"small":{"url":img.src},"big":{"url":links[i].href}});l.push(links[i]);}var g=new SZN.LightBox(data,optObj);for(var i=0;i<l.length;i++){g.bindElement(l[i],i);}return g;};SZN.LightBox.prototype.$destructor=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var p in this){this[p]=null;}};SZN.LightBox.prototype._addDefaultComponent=function(name,part,className){var node=part;var ok=false;while(node){if(node==className){ok=true;break;}node=node.EXTEND;}if(ok){this.addNewComponent({"part":part,"name":name});}else{alert("Bad "+name+" functionality");}};SZN.LightBox.prototype._buildContainer=function(){this.dom.loadBox=SZN.cEl("div");this.dom.loadBox.style.position="absolute";this.dom.loadBox.style.top="-100px";this.dom.loadBox.style.left="-100px";this.dom.loadBox.style.overflow="hidden";this.dom.loadBox.style.width="1px";this.dom.loadBox.style.height="1px";var body=document.getElementsByTagName("body")[0];body.insertBefore(this.dom.loadBox,body.firstChild);var div=SZN.cEl("div",this.options.galleryId,this.options.galleryClassName);if(this.options.useShadow){var winopts={"imagePath":this.options.imagePath,"imageFormat":this.options.imageFormat,"sizes":this.options.shadowSizes};this.window=new SZN.Window(winopts);this.dom.container=this.window.container;this.dom.container.style.position="absolute";this.window.content.appendChild(div);this.dom.content=div;}else{this.dom.container=SZN.cEl("div",false,false,{"position":"absolute"});this.dom.container.appendChild(div);this.dom.content=div;}if(this.options.zIndex){this.dom.container.style.zIndex=this.options.zIndex;}if(!this.parent){var parent=this.dom.loadBox;}else{var parent=this.parent;}parent.insertBefore(this.dom.container,parent.firstChild);};SZN.LightBox.prototype._render=function(){this._addDefaultComponent("anchorage",this.options.components.anchorage,SZN.LightBox.Anchorage);this._addDefaultComponent("transition",this.options.components.transition,SZN.LightBox.Transition);this._addDefaultComponent("main",this.options.components.main,SZN.LightBox.Main);this.dom.content.appendChild(this.main.render());if(this.options.usePageShader){this._addDefaultComponent("pageShader",this.options.components.pageShader,SZN.LightBox.PageShader);}this._addDefaultComponent("strip",this.options.components.strip,SZN.LightBox.Strip);this.dom.content.appendChild(this.strip.render());this._addDefaultComponent("description",this.options.components.description,SZN.LightBox.Description);this.dom.content.appendChild(this.description.render());this._addDefaultComponent("navigation",this.options.components.navigation,SZN.LightBox.Navigation);this.dom.content.appendChild(this.navigation.render());this.makeEvent("renderDone","public");};SZN.LightBox.prototype._renderBlindStart=function(){var h3=SZN.cEl("h3");h3.innerHTML="Fotogalerie";SZN.Dom.setStyle(h3,this.blindStyle);var link=SZN.cEl("a");link.href="#"+this.blindLinkName;link.innerHTML="Přeskočit fotogalerii";SZN.Dom.setStyle(link,this.blindStyle);this.dom.content.appendChild(h3);this.dom.content.appendChild(link);};SZN.LightBox.prototype._renderBlindEnd=function(){var link=SZN.cEl("a");link.id=this.blindLinkName;this.dom.content.appendChild(link);};SZN.LightBox.prototype._addEvents=function(){if(this.options.handleDocumentCloseClick){this.ec.push(SZN.Events.addListener(document,"mousedown",this,"_clickClose"));this.ec.push(SZN.Events.addListener(this.dom.container,"mousedown",window,SZN.Events.stopEvent));}this.ec.push(SZN.Events.addListener(window,"resize",this,"_resize"));};SZN.LightBox.prototype._removeEvents=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}};SZN.LightBox.prototype.createEvent=function(sender,name){this.makeEvent(name,"public",{"sender":sender});};SZN.LightBox.prototype._resize=function(e,elm){this.makeEvent("windowResize","protected");};SZN.LightBox.prototype._clickClose=function(e,elm){if(e.button==SZN.Browser.mouse.left){this.close();}};SZN.LightBox.prototype.close=function(){this.makeEvent("close","public");this._removeEvents();this.visible=false;if(!this.parent){SZN.Dom.elementsHider(this.dom.container,false,"show");this.dom.container.parentNode.removeChild(this.dom.container);}this.makeEvent("closed","public");};SZN.LightBox.prototype.show=function(i){this.makeEvent("show","public",{"index":i});this._addEvents();this.visible=true;if(!this.parent){var body=document.getElementsByTagName("body")[0];body.insertBefore(this.dom.container,body.firstChild);this.anchorage.actualizePosition();SZN.Dom.elementsHider(this.dom.container,false,"hide");}this.go(i);this.makeEvent("showed","public",{"index":i});};SZN.LightBox.prototype.go=function(index){var dir=index<this.index?SZN.LightBox.DIR_PREW:SZN.LightBox.DIR_NEXT;this._go(index,dir);};SZN.LightBox.prototype._go=function(i,direction){this.direction=direction;this.makeEvent("go","public",{"index":i});this.main.update(i);this.strip.update(i);this.description.update(i);this.navigation.update(i);this.index=i;};SZN.LightBox.prototype.previous=function(){var i=this.index-1;if(i<0){if(this.options.navigationOpt.continuous){i=this.data.length-1;}else{return;}}this._go(i,SZN.LightBox.DIR_PREW);};SZN.LightBox.prototype.next=function(){var i=this.index+1;if(i==this.data.length){if(this.options.navigationOpt.continuous){i=0;}else{return;}}this._go(i,SZN.LightBox.DIR_NEXT);};SZN.LightBox.prototype.bindAnchors=function(elm){var links=SZN.Dom.arrayFromCollection(SZN.gEl(elm).getElementsByTagName("a"));for(var i=0;i<links.length;i++){this.bindElement(links[i],i);}};SZN.LightBox.prototype.bindElement=function(elm,i){this.objCache.push(new SZN.LightBox.ImageLink(this,i,elm));};SZN.LightBox.ImageLink=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.ImageLink","VERSION":"1.0","CLASS":"class"});SZN.LightBox.ImageLink.prototype.$constructor=function(owner,index,elm){this.ec=[];this.owner=owner;this.index=index;this.elm=elm;this.ec.push(SZN.Events.addListener(this.elm,"click",this,"_show"));};SZN.LightBox.ImageLink.prototype.$destructor=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var p in this){this[p]=null;}};SZN.LightBox.ImageLink.prototype._show=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);this.owner.show(this.index);};SZN.LightBox.Anchorage=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Anchorage","VERSION":"1.0","CLASS":"class"});SZN.LightBox.Anchorage.prototype.$constructor=function(owner){this.owner=owner;this.options=this.owner.options.anchorageOpt;this.container=this.owner.dom.container;};SZN.LightBox.Anchorage.prototype.actualizePosition=function(){this.container.style.top="0px";this.container.style.left="0px";this.container.style.position="absolute";};SZN.LightBox.Anchorage.Fixed=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Anchorage.Fixed","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Anchorage});SZN.LightBox.Anchorage.Fixed.prototype.$constructor=function(owner){this.callSuper("$constructor",arguments.callee)(owner);this.ec=[];this.useAbsoluteHack=false;if(SZN.Browser.client=="ie"&&SZN.Browser.version<=6){this.useAbsoluteHack=true;}this.attachEvents();};SZN.LightBox.Anchorage.Fixed.prototype.$destructor=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var p in this){this[p]=null;}};SZN.LightBox.Anchorage.Fixed.prototype.attachEvents=function(){this.ec.push(SZN.Events.addListener(window,"resize",this,"actualizePosition"));if(this.useAbsoluteHack){this.ec.push(SZN.Events.addListener(window,"scroll",this,"actualizePosition"));}};SZN.LightBox.Anchorage.Fixed.prototype.actualizePosition=function(){var hasParent=true;if(!this.owner.visible){this.container.style.position="absolute";this.container.style.top="-1000px";this.container.style.left="-1000px";this.container.style.visibility="hidden";hasParent=false;}var body=document.getElementsByTagName("body")[0];body.insertBefore(this.container,body.firstChild);var portSize=SZN.Dom.getDocSize();if(this.useAbsoluteHack){var wScroll=SZN.Dom.getScrollPos();this.container.style.position="absolute";this.container.style.top=Math.round(wScroll.y+portSize.height/2-this.container.offsetHeight/2)+"px";this.container.style.left=Math.round(wScroll.x+portSize.width/2-this.container.offsetWidth/2)+"px";}else{this.container.style.position="fixed";this.container.style.top=Math.round(portSize.height/2-this.container.offsetHeight/2)+"px";this.container.style.left=Math.round(portSize.width/2-this.container.offsetWidth/2)+"px";}if(!hasParent){this.container.parentNode.removeChild(this.container);this.container.style.visibility="visible";}};SZN.LightBox.Anchorage.TopLeft=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Anchorage.TopLeft","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Anchorage});SZN.LightBox.Anchorage.TopLeft.prototype.actualizePosition=function(){this.container.style.top=this.options.top+"px";this.container.style.left=this.options.left+"px";this.container.style.position="absolute";};SZN.LightBox.Main=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Main","VERSION":"1.0","CLASS":"class","IMPLEMENT":[SZN.SigInterface]});SZN.LightBox.Main.prototype.$constructor=function(owner){this.owner=owner;this.options=this.owner.options.mainOpt;this.dom={};this.ec=[];this.width=0;this.height=0;};SZN.LightBox.Main.prototype.$destructor=function(){for(p in this.dom){this.dom[p]=null;}for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(p in this){this[p]=null;}};SZN.LightBox.Main.prototype.render=function(){this.dom.mainBox=SZN.cEl("div",this.options.id,this.options.className);this._attachEvents();return this.dom.mainBox;};SZN.LightBox.Main.prototype._attachEvents=function(){if(this.options.useMouseWheelScroll){this.ec.push(SZN.Events.addListener(this.dom.mainBox,"DOMMouseScroll",this,"_scroll"));this.ec.push(SZN.Events.addListener(this.dom.mainBox,"mousewheel",this,"_scroll"));}};SZN.LightBox.Main.prototype._scroll=function(e,elm){SZN.Events.cancelDef(e);var delta=e.wheelDelta||e.detail;if(SZN.Browser.client=="gecko"){delta=-delta;}if(delta>0){this.owner.previous();}else{this.owner.next();}};SZN.LightBox.Main.prototype.update=function(i){this.width=parseInt(this.dom.mainBox.clientWidth);this.height=parseInt(this.dom.mainBox.clientHeight);var imgObj=this.owner.data[i];if(imgObj.flash){this._generateFlashElm(imgObj);}else{this._generateImgElm(imgObj);}};SZN.LightBox.Main.prototype._generateFlashElm=function(img){var em=SZN.cEl("embed");em.setAttribute("quality","high");em.setAttribute("pluginspage","http://www.macromedia.com/go/getflashplayer");em.setAttribute("type","application/x-shockwave-flash");em.setAttribute("width",this.width);em.setAttribute("height",this.height);em.setAttribute("allowfullscreen","true");em.setAttribute("src",img.big.url);em.setAttribute("flashvars",img.flash);em.style.visibility="hidden";this.dom.mainBox.appendChild(em);this._switchImages(this.dom.mainBox.getElementsByTagName("embed")[0]);};SZN.LightBox.Main.prototype._generateImgElm=function(img){var em=SZN.cEl("img");em.style.visibility="hidden";em.src=img.big.url;this.dom.mainBox.appendChild(em);this._switchImages(em);};SZN.LightBox.Main.prototype._switchImages=function(newImg){var c=this.current;this.current=newImg;this.owner.transition.start(c,newImg);};SZN.LightBox.Main.Scaled=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Main.Scaled","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Main});SZN.LightBox.Main.Scaled.prototype._generateImgElm=function(img){var em=SZN.cEl("img");em.height=this.height;em.width=this.width;em.style.visibility="hidden";em.style.position="absolute";em.src=img.big.url;this.dom.mainBox.appendChild(em);this._switchImages(em);};SZN.LightBox.Main.CenteredScaled=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Main.CenteredScaled","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Main});SZN.LightBox.Main.CenteredScaled.prototype.$constructor=function(owner){this.callSuper("$constructor",arguments.callee)(owner);this.scaledImage=null;};SZN.LightBox.Main.CenteredScaled.prototype._generateImgElm=function(img){var em=new SZN.LightBox.ScaledImage(this,img.big.url,this.width,this.height,this.dom.mainBox);em.render();if(this.scaledImage){this.scaledImage.$destructor();this.scaledImage=null;}this.scaledImage=em;};SZN.LightBox.Transition=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Transition","VERSION":"1.0","CLASS":"class"});SZN.LightBox.Transition.prototype.$constructor=function(owner){this.owner=owner;this.options=owner.options.transitionOpt;};SZN.LightBox.Transition.prototype.$destructor=function(){};SZN.LightBox.Transition.prototype.start=function(firstElm,secondElm){this.first=firstElm;this.second=secondElm;this._finish();};SZN.LightBox.Transition.prototype._finish=function(){this.second.style.visibility="visible";if(this.first){this.first.parentNode.removeChild(this.first);}this.first=null;this.second=null;this.owner.createEvent(this,"transitionDone");};SZN.LightBox.Transition.Fade=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Transition.Fade","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Transition});SZN.LightBox.Transition.Fade.prototype.$constructor=function(owner){this.options={"interval":400,"frequency":25,"overlap":1};this.owner=owner;for(var p in owner.options.transitionOpt){this.options[p]=owner.options.transitionOpt[p];}this.running1=false;this.running2=false;this._secondOpacity=0;this._step1=SZN.bind(this,this._step1);this._step2=SZN.bind(this,this._step2);this._finish=SZN.bind(this,this._finish);this.i1=new SZN.Interpolator(1,0,this.options.interval,this._step1,{"frequency":this.options.frequency});this.i2=new SZN.Interpolator(0,1,this.options.interval,this._step2,{"frequency":this.options.frequency,"endCallback":this._finish});};SZN.LightBox.Transition.Fade.prototype.start=function(oldElm,newElm){if(this.running1||this.running2){this.second.parentNode.removeChild(this.second);this.second=newElm;this._setOpacity(this.second,this._secondOpacity);this.second.style.visibility="visible";}else{this.first=oldElm;this.second=newElm;this._secondOpacity=0;this._setOpacity(this.second,0);this.second.style.visibility="visible";if(this.first){this.running1=true;this.i1.start();}else{this._start2();}}};SZN.LightBox.Transition.Fade.prototype._start2=function(){this.running2=true;this.i2.start();};SZN.LightBox.Transition.Fade.prototype._step1=function(value){if(!this.first){return;}this._setOpacity(this.first,value);if(!this.running2&&value<=this.options.overlap){this._start2();}};SZN.LightBox.Transition.Fade.prototype._step2=function(value){this._secondOpacity=value;this._setOpacity(this.second,value);};SZN.LightBox.Transition.Fade.prototype._finish=function(){this.running1=false;this.running2=false;this.callSuper("_finish",arguments.callee)();};SZN.LightBox.Transition.Fade.prototype._setOpacity=function(node,value){node.style.opacity=value;node.style.filter="alpha(opacity="+Math.round(value*100)+")";};SZN.LightBox.ScaledImage=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.ScaledImage","VERSION":"1.0","CLASS":"class"});SZN.LightBox.ScaledImage.prototype.$constructor=function(owner,src,w,h,rootElm){this.owner=owner;this.w=w;this.h=h;this.src=src;this.rootElm=rootElm;this.ec=[];this.dom={};};SZN.LightBox.ScaledImage.prototype.render=function(){this.dom.elm=SZN.cEl("img");this.dom.container=SZN.cEl("div",false,false,{"position":"absolute","left":"-1000px","top":"-1000px","width":"1px","height":"1px","overflow":"hidden"});this.ec.push(SZN.Events.addListener(this.dom.elm,"load",this,"_loaded",false,true));document.body.insertBefore(this.dom.container,document.body.firstChild);this.dom.container.appendChild(this.dom.elm);this.dom.elm.src=this.src;};SZN.LightBox.ScaledImage.prototype.$destructor=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var p in this.dom){this.dom[p]=null;}for(var p in this){this[p]=null;}};SZN.LightBox.ScaledImage.prototype._loaded=function(e,elm){var w=this.dom.elm.width;var h=this.dom.elm.height;var ratio_w=w/this.w;var ratio_h=h/this.h;var max=Math.max(ratio_w,ratio_h);if(max>1){w=w/max;h=h/max;if(w&&h){this.dom.elm.width=Math.ceil(w);this.dom.elm.height=Math.ceil(h);}}var pw=this.rootElm.clientWidth;var ph=this.rootElm.clientHeight;this.dom.elm.style.position="absolute";this.dom.elm.style.visibility="hidden";this.dom.elm.style.top=Math.round((ph-h)/2)+"px";this.dom.elm.style.left=Math.round((pw-w)/2)+"px";if(this.rootElm){this.rootElm.appendChild(this.dom.elm);}if(this.dom.container){this.dom.container.parentNode.removeChild(this.dom.container);this.dom.container=false;}this.owner.owner.createEvent(this,"mainImageLoaded");this.owner._switchImages(this.dom.elm);};SZN.LightBox.PageShader=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.PageShader","VERSION":"1.0","CLASS":"class","IMPLEMENT":[SZN.SigInterface]});SZN.LightBox.PageShader.prototype.$constructor=function(owner){this.owner=owner;this.dom={};this.addListener("showed","_show",this.owner);this.addListener("close","_hide",this.owner);this.addListener("windowResize","_resize",this.owner);};SZN.LightBox.PageShader.prototype.$destructor=function(){for(p in this.dom){this.dom[p]=null;}for(p in this){this[p]=null;}};SZN.LightBox.PageShader.prototype._show=function(){this.dom.root=SZN.cEl("div",false,"image-browser-root",{"position":"absolute","left":"0px","top":"0px"});var docSize=SZN.Dom.getDocSize();var docH=document.compatMode=="BackCompat"?document.body.scrollHeight:document.body.offsetHeight;var docW=document.compatMode=="BackCompat"?document.body.scrollWidth:document.body.offsetWidth;this.dom.root.style.width=(docSize.width>docW?docSize.width:docW)+"px";this.dom.root.style.height=(docSize.height>docH?docSize.height:docH)+"px";if(this.owner.options.zIndex){this.dom.root.style.zIndex=this.owner.options.zIndex-1;}var parent=this.owner.dom.container.parentNode;var nextSibling=this.owner.dom.container.nextSibling;parent.insertBefore(this.dom.root,nextSibling);SZN.Dom.elementsHider(this.dom.root,false,"hide");};SZN.LightBox.PageShader.prototype._hide=function(){if(this.dom.root&&this.dom.root.parentNode){SZN.Dom.elementsHider(this.dom.root,false,"hide");this.dom.root.parentNode.removeChild(this.dom.root);}this.dom.root=null;};SZN.LightBox.PageShader.prototype._resize=function(){this._hide();this._show();};SZN.LightBox.Strip=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Strip","VERSION":"1.0","CLASS":"class"});SZN.LightBox.Strip.prototype.$constructor=function(owner){this.owner=owner;this.options=this.owner.options.stripOpt;this.dom={};};SZN.LightBox.Strip.prototype.$destructor=function(){for(p in this.dom){this.dom[p]=null;}for(p in this){this[p]=null;}};SZN.LightBox.Strip.prototype.render=function(){this.dom.mainBox=SZN.cEl("div",this.options.id,this.options.className);return this.dom.mainBox;};SZN.LightBox.Strip.prototype.update=function(index){};SZN.LightBox.Strip.Scrollable=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Strip.Scrollable","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Strip});SZN.LightBox.Strip.Scrollable.prototype.$constructor=function(owner){this.callSuper("$constructor",arguments.callee)(owner);this.objCache=[];this.ec=[];this.activeBorder={};};SZN.LightBox.Strip.Scrollable.prototype.$destructor=function(){for(var i=0;i<this.objCache.length;i++){this.objCache[i].$destructor();this.objCache[i]=null;}for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}this.callSuper("$destructor",arguments.callee)();};SZN.LightBox.Strip.Scrollable.prototype.render=function(){this.callSuper("render",arguments.callee)();this.owner.dom.content.appendChild(this.dom.mainBox);this.dom.mainBox.style.position="relative";this.dom.imageBox=SZN.cEl("div");this.dom.mainBox.appendChild(this.dom.imageBox);this.dom.imageTable=SZN.cEl("table");this.dom.imageTable.style.borderCollapse="collapse";var tbody=SZN.cEl("tbody");this.dom.imageTable.appendChild(tbody);this.dom.imageBox.appendChild(this.dom.imageTable);for(var i=0;i<this.owner.data.length;i++){if(this.options.orientation=="vertical"){var tr=SZN.cEl("tr");var td=SZN.cEl("td");tr.appendChild(td);td.align="center";td.vAlign="center";tbody.appendChild(tr);}else{if(i==0){var tr=SZN.cEl("tr");}var td=SZN.cEl("td");td.align="center";td.vAlign="center";tr.appendChild(td);if(i==this.owner.data.length-1){tbody.appendChild(tr);}}var div=SZN.cEl("div",false,this.options.imageBoxClassName);div.style.position="relative";td.style.padding="0px";td.appendChild(div);}var elms=SZN.Dom.arrayFromCollection(tbody.getElementsByTagName("div"));for(var i=0;i<this.owner.data.length;i++){var stripImg=new SZN.LightBox.StripImage(this.owner,this.options,this.owner.data[i],i);stripImg.render(elms[i]);this.objCache.push(stripImg);}this.dom.active=SZN.cEl("div",this.options.activeId,this.options.activeClassName);this.dom.active.style.position="absolute";this.dom.mainBox.appendChild(this.dom.active);this.activeBorder.top=parseInt(SZN.Dom.getStyle(this.dom.active,"borderTopWidth"));this.activeBorder.bottom=parseInt(SZN.Dom.getStyle(this.dom.active,"borderBottomWidth"));this.activeBorder.left=parseInt(SZN.Dom.getStyle(this.dom.active,"borderLeftWidth"));this.activeBorder.right=parseInt(SZN.Dom.getStyle(this.dom.active,"borderRightWidth"));this.dom.mainBox.removeChild(this.dom.active);this._addEvents();return this.dom.mainBox;};SZN.LightBox.Strip.Scrollable.prototype._addEvents=function(){if(this.options.orientation=="horizontal"){this.ec.push(SZN.Events.addListener(this.dom.mainBox,"DOMMouseScroll",this,"_scroll"));this.ec.push(SZN.Events.addListener(this.dom.mainBox,"mousewheel",this,"_scroll"));}};SZN.LightBox.Strip.Scrollable.prototype._scroll=function(e,elm){SZN.Events.cancelDef(e);var delta=e.wheelDelta||e.detail;if(SZN.Browser.client=="gecko"){delta=-delta;}if(delta>0){this.dom.mainBox.scrollLeft-=30;}else{this.dom.mainBox.scrollLeft+=30;}};SZN.LightBox.Strip.Scrollable.prototype.update2=function(index){this.dom.active.style.position="absolute";var pos=SZN.Dom.getBoxPosition(this.objCache[index].dom.img.parentNode,this.dom.imageTable);var borderTop=parseInt(SZN.Dom.getStyle(this.dom.active,"borderTopWidth"));var borderBottom=parseInt(SZN.Dom.getStyle(this.dom.active,"borderBottomWidth"));var borderLeft=parseInt(SZN.Dom.getStyle(this.dom.active,"borderLeftWidth"));var borderRight=parseInt(SZN.Dom.getStyle(this.dom.active,"borderRightWidth"));if(this.options.activeBorder=="inner"){this.dom.active.style.top=pos.top+"px";this.dom.active.style.left=pos.left+"px";this.dom.active.style.width=(this.objCache[index].dom.img.parentNode.offsetWidth-(!isNaN(borderLeft)?borderLeft:0)-(!isNaN(borderRight)?borderRight:0))+"px";this.dom.active.style.height=(this.objCache[index].dom.img.parentNode.offsetHeight-(!isNaN(borderTop)?borderTop:0)-(!isNaN(borderBottom)?borderBottom:0))+"px";}else{this.dom.active.style.top=(pos.top-(!isNaN(borderLeft)?borderLeft:0))+"px";this.dom.active.style.left=(pos.left-(!isNaN(borderTop)?borderTop:0))+"px";this.dom.active.style.width=(this.objCache[index].dom.img.parentNode.offsetWidth)+"px";this.dom.active.style.height=(this.objCache[index].dom.img.parentNode.offsetHeight)+"px";}if(this.options.orientation=="vertical"){var a=SZN.Dom.getBoxPosition(this.objCache[index].dom.img.parentNode,this.dom.mainBox);var b=parseInt(SZN.Dom.getStyle(this.dom.mainBox,"height"))/2;var c=parseInt(SZN.Dom.getStyle(this.objCache[index].dom.img.parentNode,"height"))/2;var scroll=a.top-b+c;this.dom.mainBox.scrollTop=Math.round(scroll);}else{var a=SZN.Dom.getBoxPosition(this.objCache[index].dom.img.parentNode,this.dom.mainBox);var b=parseInt(SZN.Dom.getStyle(this.dom.mainBox,"width"))/2;var c=parseInt(SZN.Dom.getStyle(this.objCache[index].dom.img.parentNode,"width"))/2;var scroll=a.left-b+c;this.dom.mainBox.scrollLeft=Math.round(scroll);}};SZN.LightBox.Strip.Scrollable.prototype.update=function(index){if(this.options.activeBorder=="inner"){this.dom.active.style.left="0px";this.dom.active.style.top="0px";this.dom.active.style.width=(this.objCache[index].dom.img.parentNode.offsetWidth-(!isNaN(this.activeBorder.left)?this.activeBorder.left:0)-(!isNaN(this.activeBorder.right)?this.activeBorder.right:0))+"px";this.dom.active.style.height=(this.objCache[index].dom.img.parentNode.offsetHeight-(!isNaN(this.activeBorder.top)?this.activeBorder.top:0)-(!isNaN(this.activeBorder.bottom)?this.activeBorder.bottom:0))+"px";}else{this.dom.active.style.left=-(!isNaN(this.activeBorder.left)?this.activeBorder.left:0)+"px";this.dom.active.style.top=-(!isNaN(this.activeBorder.top)?this.activeBorder.top:0)+"px";this.dom.active.style.width=(this.objCache[index].dom.img.parentNode.clientWidth)+"px";this.dom.active.style.height=(this.objCache[index].dom.img.parentNode.clientHeight)+"px";}this.objCache[index].dom.img.parentNode.appendChild(this.dom.active);if(this.options.orientation=="vertical"){var a=SZN.Dom.getBoxPosition(this.objCache[index].dom.img.parentNode,this.dom.mainBox);var b=parseInt(SZN.Dom.getStyle(this.dom.mainBox,"height"))/2;var c=parseInt(SZN.Dom.getStyle(this.objCache[index].dom.img.parentNode,"height"))/2;var scroll=a.top-b+c;this.dom.mainBox.scrollTop=Math.round(scroll);}else{var a=SZN.Dom.getBoxPosition(this.objCache[index].dom.img.parentNode,this.dom.mainBox);var b=parseInt(SZN.Dom.getStyle(this.dom.mainBox,"width"))/2;var c=parseInt(SZN.Dom.getStyle(this.objCache[index].dom.img.parentNode,"width"))/2;var scroll=a.left-b+c;this.dom.mainBox.scrollLeft=Math.round(scroll);}};SZN.LightBox.StripImage=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.StripImage","VERSION":"1.0","CLASS":"class"});SZN.LightBox.StripImage.prototype.$constructor=function(mainOwner,options,data,order){this.mainOwner=mainOwner;this.data=data;this.options=options;this.order=order;this.dom={};this.ec=[];};SZN.LightBox.StripImage.prototype.$destructor=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}};SZN.LightBox.StripImage.prototype.render=function(elm){this.dom.parentNode=elm;this.dom.tmpBox=SZN.cEl("div",false,false,{"position":"absolute","top":"-100px","left":"-100px","width":"1px","height":"1px","overflow":"hidden"});var body=document.getElementsByTagName("body")[0];body.insertBefore(this.dom.tmpBox,body.firstChild);this.dom.img=SZN.cEl("img");this.dom.tmpBox.appendChild(this.dom.img);this.ec.push(SZN.Events.addListener(this.dom.img,"load",this,"_loaded"));this.dom.img.src=this.data.small.url;this.dom.img.alt=this.data.alt;this.ec.push(SZN.Events.addListener(elm,"click",this,"_click"));};SZN.LightBox.StripImage.prototype._click=function(e,elm){this.mainOwner.go(this.order);};SZN.LightBox.StripImage.prototype._loaded=function(e,elm){var w=elm.width;var h=elm.height;this.dom.img.style.display="none";this.dom.parentNode.appendChild(this.dom.img);this.dom.tmpBox.parentNode.removeChild(this.dom.tmpBox);this.dom.tmpBox=null;var boxW=parseInt(this.dom.img.parentNode.clientWidth);var boxH=parseInt(this.dom.img.parentNode.clientHeight);var ratio_w=w/boxW;var ratio_h=h/boxH;var max=Math.max(ratio_w,ratio_h);if(max>1){w=Math.floor(w/max);h=Math.floor(h/max);if(w&&h){this.dom.img.width=w;this.dom.img.height=h;}}var ph=this.dom.parentNode.clientHeight;this.dom.img.style.marginTop=Math.round((ph-h)/2)+"px";this.dom.img.parentNode.textAlign="center";this.dom.img.style.display="";};SZN.LightBox.Description=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Description","VERSION":"1.0","CLASS":"class"});SZN.LightBox.Description.prototype.$constructor=function(owner){this.owner=owner;this.options=owner.options.descriptionOpt;this.dom={};};SZN.LightBox.Description.prototype.$destructor=function(){for(var p in this.dom){this.dom[p]=null;}for(var p in this){this[p]=null;}};SZN.LightBox.Description.prototype.render=function(){this.dom.box=SZN.cEl("div",this.options.id,this.options.className);return this.dom.box;};SZN.LightBox.Description.prototype.update=function(index){};SZN.LightBox.Description.Basic=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Description.Basic","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Description});SZN.LightBox.Description.Basic.prototype.render=function(){this.callSuper("render",arguments.callee)();this.dom.content=SZN.cEl("div",this.options.contentId,this.options.contentClassName);this.dom.box.appendChild(this.dom.content);return this.dom.box;};SZN.LightBox.Description.Basic.prototype.update=function(index){if(this.owner.data[index].description){this.dom.content.innerHTML=this.owner.data[index].description;}};SZN.LightBox.Navigation=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Navigation","VERSION":"1.0","CLASS":"class"});SZN.LightBox.Navigation.prototype.$constructor=function(owner){this.owner=owner;this.options=owner.options.navigationOpt;this.dom={};this.ec=[];};SZN.LightBox.Navigation.prototype.$destructor=function(){for(var p in this.dom){this.dom[p]=null;}for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var p in this){this[p]=null;}};SZN.LightBox.Navigation.prototype.render=function(){return SZN.cEl("div",this.options.id,this.options.className);};SZN.LightBox.Navigation.prototype.update=function(index){};SZN.LightBox.Navigation.Basic=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Navigation.Basic","VERSION":"1.0","CLASS":"class","EXTEND":SZN.LightBox.Navigation});SZN.LightBox.Navigation.Basic.prototype.render=function(){this.dom.next=SZN.cEl("a",this.options.nextId,this.options.nextClassName);this.dom.prev=SZN.cEl("a",this.options.prevId,this.options.prevClassName);this.dom.nextDisabled=SZN.cEl("a",this.options.nextId?this.options.nextId+"-disabled":false,this.options.nextClassName+"-disabled");this.dom.prevDisabled=SZN.cEl("a",this.options.prevId?this.options.prevId+"-disabled":false,this.options.prevClassName+"-disabled");this.dom.close=SZN.cEl("a",this.options.closeId,this.options.closeClassName);this.dom.next.href="#";this.dom.prev.href="#";this.dom.nextDisabled.href="#";this.dom.prevDisabled.href="#";this.dom.close.href="#";this.dom.nextPreload=SZN.cEl("div",this.options.nextId?this.options.nextId+"-preload":false,this.options.nextClassName+"-preload",{"position":"absolute","visibility":"hidden","height":"1px","width":"1px"});this.dom.nextDisabledPreload=SZN.cEl("div",this.options.nextId?this.options.nextId+"-disabled-preload":false,this.options.nextClassName+"-disabled-preload",{"position":"absolute","visibility":"hidden","height":"1px","width":"1px"});this.dom.prevPreload=SZN.cEl("div",this.options.prevId?this.options.prevId+"-preload":false,this.options.prevClassName+"-preload",{"position":"absolute","visibility":"hidden","height":"1px","width":"1px"});this.dom.prevDisabledPreload=SZN.cEl("div",this.options.prevId?this.options.prevId+"-disabled-preload":false,this.options.prevClassName+"-disabled-preload",{"position":"absolute","visibility":"hidden","height":"1px","width":"1px"});this.dom.closePreload=SZN.cEl("div",this.options.closeId?this.options.closeId+"-preload":false,this.options.closeClassName+"-preload",{"position":"absolute","visibility":"hidden","height":"1px","width":"1px"});this._addEvents();var div=SZN.cEl("div",this.options.id,this.options.className);SZN.Dom.append([div,this.dom.next,this.dom.nextDisabled,this.dom.prev,this.dom.prevDisabled,this.dom.close]);SZN.Dom.append([div,this.dom.nextPreload,this.dom.nextDisabledPreload,this.dom.prevPreload,this.dom.prevDisabledPreload,this.dom.closePreload]);return div;};SZN.LightBox.Navigation.Basic.prototype._addEvents=function(){this.ec.push(SZN.Events.addListener(this.dom.next,"click",this,"_next"));this.ec.push(SZN.Events.addListener(this.dom.prev,"click",this,"_previous"));this.ec.push(SZN.Events.addListener(this.dom.close,"click",this,"_close"));this.ec.push(SZN.Events.addListener(document,"keydown",this,"_closeKey"));this.ec.push(SZN.Events.addListener(this.dom.nextDisabled,"click",this,"_disabled"));this.ec.push(SZN.Events.addListener(this.dom.prevDisabled,"click",this,"_disabled"));};SZN.LightBox.Navigation.Basic.prototype._disabled=function(e,elm){elm.blur();SZN.Events.cancelDef(e);};SZN.LightBox.Navigation.Basic.prototype._close=function(e,elm){elm.blur();SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);this.owner.close();};SZN.LightBox.Navigation.Basic.prototype._next=function(e,elm){elm.blur();SZN.Events.cancelDef(e);this.owner.next();};SZN.LightBox.Navigation.Basic.prototype._previous=function(e,elm){elm.blur();SZN.Events.cancelDef(e);this.owner.previous();};SZN.LightBox.Navigation.Basic.prototype._closeKey=function(e,elm){if(e.keyCode==27){this.owner.close();}};SZN.LightBox.Navigation.Basic.prototype.update=function(index){if(!this.options.continuous){this.dom.prev.style.display="";this.dom.next.style.display="";this.dom.prevDisabled.style.display="none";this.dom.nextDisabled.style.display="none";if(index==0){this.dom.prev.style.display="none";if(this.options.showDisabled){this.dom.prevDisabled.style.display="";}}if(index==this.owner.data.length-1){this.dom.next.style.display="none";if(this.options.showDisabled){this.dom.nextDisabled.style.display="";}}}else{this.dom.prevDisabled.style.display="none";this.dom.nextDisabled.style.display="none";this.dom.prev.style.display="";this.dom.next.style.display="";}};SZN.ItemsPager=SZN.ClassMaker.makeClass({"NAME":"ItemsPager","VERSION":"1.1","CLASS":"class"});SZN.ItemsPager.prototype.$constructor=function(container,prevButton,nextButton,data,inactiveButtonClass){this.callback=[];this.callbackObj=[];this.buttonClass=inactiveButtonClass||false;this.prevButton=SZN.gEl(prevButton);this.nextButton=SZN.gEl(nextButton);this.container=container;this.pageNumber=data.pageNumber;this.itemsPerPage=data.itemsPerPage;this.clearAfter=data.clearAfter;this.vars=data.variables;this.items=data.items;this.elmLinks={};this.template=null;this.stepNext=false;this.stepPrev=false;this.from=0;this.to=0;SZN.Events.addListener(this.prevButton,"click",this,"prev");SZN.Events.addListener(this.nextButton,"click",this,"next");this._getTemplate();this._stepsCalc();this._setButtons();};SZN.ItemsPager.prototype.start=function(e){this.pageNumber=0;this._stepsCalc();this._build();this._setButtons();for(var i=0;i<this.callback.length;i++){this.callbackObj[i][this.callback[i]](this.pageNumber);}SZN.Events.cancelDef(e);try{pp_gemius_hit(__gemius_id);}catch(e){}};SZN.ItemsPager.prototype.next=function(e){if(this.stepNext){this.pageNumber++;this._stepsCalc();this._build();}this._setButtons();for(var i=0;i<this.callback.length;i++){this.callbackObj[i][this.callback[i]](this.pageNumber);}SZN.Events.cancelDef(e);try{pp_gemius_hit(__gemius_id);}catch(e){}};SZN.ItemsPager.prototype.prev=function(e){if(this.stepPrev){this.pageNumber--;this._stepsCalc();this._build();}this._setButtons();for(var i=0;i<this.callback.length;i++){this.callbackObj[i][this.callback[i]](this.pageNumber);}SZN.Events.cancelDef(e);try{pp_gemius_hit(__gemius_id);}catch(e){}};SZN.ItemsPager.prototype.addCallback=function(callbackObj,callback){this.callback.push(callback);this.callbackObj.push((callbackObj===false)?window:callbackObj);};SZN.ItemsPager.prototype._setButtons=function(){m=this.stepPrev?"removeClass":"addClass";SZN.Dom[m](this.prevButton,this.buttonClass);m=this.stepNext?"removeClass":"addClass";SZN.Dom[m](this.nextButton,this.buttonClass);};SZN.ItemsPager.prototype._build=function(){this.container.innerHTML="";for(var i=this.from;i<this.to;i++){for(var v in this.items[i]){for(var el=0;el<this.elmLinks[v].length;el++){this.elmLinks[v][el][0][this.elmLinks[v][el][1]]=this.items[i][v];}}this.container.appendChild(this.template.cloneNode(true));if(this.clearAfter&&(i-this.from+1)%this.clearAfter==0){this.container.appendChild(SZN.cEl("div","","cleaner"));}}};SZN.ItemsPager.prototype._stepsCalc=function(){this.stepNext=true;this.stepPrev=true;this.offset=this.pageNumber*this.itemsPerPage;var len=this.items.length;var fr=this.offset;var to=this.offset+this.itemsPerPage;if(fr<=0){fr=0;this.stepPrev=false;}if(to>=len){to=len;this.stepNext=false;}this.from=fr;this.to=to;};SZN.ItemsPager.prototype._getTemplate=function(){this.container=SZN.gEl(this.container);var node=this.container.firstChild;while(node.nodeType!=1){node=node.nextSibling;}this.template=node.cloneNode(true);this._exploreNode(this.template);};SZN.ItemsPager.prototype._exploreNode=function(node){for(var i=0;i<node.childNodes.length;i++){if(node.childNodes[i].nodeType!=1)continue;var cl=node.childNodes[i].className;if(cl.indexOf(" ")!=-1){cl=cl.split(" ");for(var c=0;c<cl.length;c++){if(cl[c] in this.vars){var x=this.vars[cl[c]];if(!this.elmLinks[x[0]]){this.elmLinks[x[0]]=[];};this.elmLinks[x[0]].push([node.childNodes[i],x[1]]);}}}else{if(cl in this.vars){var x=this.vars[cl];if(!this.elmLinks[x[0]]){this.elmLinks[x[0]]=[];};this.elmLinks[x[0]].push([node.childNodes[i],x[1]]);}}this._exploreNode(node.childNodes[i]);}};PictureByDay=SZN.ClassMaker.makeClass({"NAME":"PictureByDay","VERSION":"1.0","CLASS":"class"});PictureByDay.prototype.$constructor=function(el){this.root=el;this.ec=[];this.voted=false;this.voteElement=null;var links=this.root.getElementsByTagName("a");for(var i=0;i<links.length;i++){this.ec.push(SZN.Events.addListener(links[i],"click",this,"_vote",false,true));}};PictureByDay.prototype._vote=function(e,elm){SZN.Events.cancelDef(e);if(!this.voted){this.voteElement=elm;var url=elm.href+"&ajax=1";var rq=new SZN.HTTPRequest();rq.setMethod("get");rq.setFormat("txt");rq.setMode("async");rq.send(url,this,"_voted");this.voted=true;}};PictureByDay.prototype._voted=function(txt,status){eval("data = "+txt+";");var votedLink=SZN.Dom.getElementsByClass("voted",this.root,"a");if(votedLink&&votedLink[0]){SZN.Dom.removeClass(votedLink[0],"voted");}SZN.Dom.addClass(this.voteElement,"voted");SZN.gEl("voteCount").innerHTML=data.voteCount+"x";SZN.gEl("voteAverage").innerHTML=Math.round(data.voteSum/data.voteCount*100)/100;};SZN.Photos=SZN.ClassMaker.makeClass({"NAME":"SZN.Photos","VERSION":"1.0","CLASS":"class","IMPLEMENT":[SZN.SigInterface]});SZN.Photos.prototype.$constructor=function(owner){this.owner=owner;this._render();};SZN.Photos.prototype._render=function(){var c=SZN.cEl("div",false,"image-browser-photo-count");var n=this.owner.data.length;var text="fotografií";switch(n.toString().substr(n.toString().length-1)){case 1:case 2:case 3:case 4:text="fotografie";break;default:text="fotografií";break;}c.innerHTML=n+" "+text;this.owner.dom.content.appendChild(c);};SZN.LightBox.Anchorage.Super=SZN.ClassMaker.makeClass({"NAME":"SZN.LightBox.Anchorage.Super","EXTEND":SZN.LightBox.Anchorage,"VERSION":"1.0","CLASS":"class"});SZN.LightBox.Anchorage.Super.prototype.$constructor=function(owner){this.callSuper("$constructor",arguments.callee)(owner);this.elm=SZN.gEl(this.options.elmId);};SZN.LightBox.Anchorage.Super.prototype.actualizePosition=function(){var pos=SZN.Dom.getBoxPosition(this.elm);var sc=SZN.Dom.getScrollPos();var win=SZN.Dom.getDocSize();var left=pos.left;var top=Math.round(pos.top);var picTop=Math.round(pos.top);var top=pos.top;if((top+this.container.offsetHeight)>(sc.y+win.height)){var diff=(top+this.container.offsetHeight)-(sc.y+win.height);top-=diff;}if((top<sc.y)){top+=(sc.y-top+16);}var logoTop=SZN.Dom.getBoxPosition(SZN.gEl("menu")).top;var top=top<logoTop?logoTop:top;this.container.style.top=(top-3)+"px";this.container.style.left=(left-3)+"px";this.container.style.position="absolute";};SZN.LightBox.SuperOptObj={"useShadow":true,"imagePath":"/static/images/lightbox/shadow-","galleryId":"lightBox","usePageShader":false,"components":{"anchorage":SZN.LightBox.Anchorage.Super,"main":SZN.LightBox.Main.CenteredScaled,"strip":SZN.LightBox.Strip.Scrollable,"description":SZN.LightBox.Description.Basic,"pageShader":SZN.LightBox.PageShader,"navigation":SZN.LightBox.Navigation.Basic,"transition":SZN.LightBox.Transition.Fade,"others":[{"name":"photos","part":SZN.Photos}]},"anchorageOpt":{},"stripOpt":{"orientation":"vertical","activeBorder":"outer"},"navigationOpt":{"continuous":false,"showDisabled":true},"transitionOpt":{"interval":300}};SZN.Tabs=SZN.ClassMaker.makeClass({"NAME":"Tabs","VERSION":"1.1","IMPLEMENT":[SZN.SigInterface],"CLASS":"class"});SZN.Tabs.prototype.$constructor=function(container,optObj,callbackObject,callbackMethod){this.options={"defaultClass":"tab","selectedClass":"tab-selected","hoverClass":"tab-hover","hover":false};for(var p in optObj){this.options[p]=optObj[p];}this.selectedIndex=-1;this.container=SZN.gEl(container);this.callbackObject=callbackObject;this.callbackMethod=callbackMethod;this.tabs=[];this.ec=[];};SZN.Tabs.prototype.$destructor=function(){for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var i=0;i<this.tabs.length;i++){this.tabs[i].$destructor();}for(var p in this){this[p]=null;}};SZN.Tabs.prototype.clear=function(){this.selectedIndex=-1;for(var i=0;i<this.tabs.length;i++){this.tabs[i].$destructor();}this.tabs=[];};SZN.Tabs.prototype.getActiveTab=function(){if(this.tabs[this.selectedIndex]){return this.tabs[this.selectedIndex];}else{return null;}};SZN.Tabs.prototype.addTab=function(click,content){if(arguments.length==1){this._addTab(click);}else{this._crateNewTab(click,content);}};SZN.Tabs.prototype._crateNewTab=function(click,content){var tab=new SZN.Tab(click,content,this,this.options.hover,this.options.hoverClass);this._addTab(tab);};SZN.Tabs.prototype._addTab=function(tab){this.tabs.push(tab);tab._deactivate();};SZN.Tabs.prototype.go=function(index){if(index==this.selectedIndex){return;}var oldI=this.selectedIndex;if(this.selectedIndex!=-1){this.tabs[this.selectedIndex]._deactivate();}this.selectedIndex=index;this.tabs[this.selectedIndex]._activate();this.makeEvent("tabchange");if(this.callbackObject){this.callbackObject[this.callbackMethod](oldI,this.selectedIndex);}};SZN.Tabs.prototype.addManyTabs=function(clickList,contentList,defaultIndex){var clicks=SZN.gEl(clickList);var contents=SZN.gEl(contentList);var clicks_=[];var contents_=[];for(var i=0;i<clicks.childNodes.length;i++){var item=clicks.childNodes[i];if(item.nodeType==1){clicks_.push(item);}}for(var i=0;i<contents.childNodes.length;i++){var item=contents.childNodes[i];if(item.nodeType==1){contents_.push(item);}}var cnt=Math.min(clicks_.length,contents_.length);for(var i=0;i<cnt;i++){this.addTab(clicks_[i],contents_[i]);}if(defaultIndex!=-1){this.go(defaultIndex);}};SZN.Tab=SZN.ClassMaker.makeClass({"NAME":"Tab","VERSION":"1.0","CLASS":"class"});SZN.Tab.prototype.$constructor=function(click,content,owner,hover,hoverClass){this.content=SZN.gEl(content);this.owner=owner;this.click=SZN.gEl(click);this.hoverClass=hoverClass;this.ec=[];this.ec.push(SZN.Events.addListener(this.click,"click",this,"_go",false,true));if(hover){this.ec.push(SZN.Events.addListener(this.click,"mouseover",this,"_hover"));this.ec.push(SZN.Events.addListener(this.click,"mouseout",this,"_hoverOut"));}if(this.owner.options.defaultClass){SZN.Dom.addClass(this.click,this.owner.options.defaultClass);}};SZN.Tab.prototype.$destructor=function(){if(this.content.parentNode){this.content.parentNode.removeChild(this.content);}if(this.click.parentNode){this.click.parentNode.removeChild(this.click);}for(var i=0;i<this.ec.length;i++){SZN.Events.removeListener(this.ec[i]);}for(var p in this){this[p]=null;}};SZN.Tab.prototype._go=function(e,elm){var index=-1;for(var i=0;i<this.owner.tabs.length;i++){if(this.owner.tabs[i]==this){index=i;}}if(index==-1){return;}this.owner.go(index);};SZN.Tab.prototype._activate=function(){if(!this.content.parentNode||this.content.parentNode!=this.owner.container){this.owner.container.appendChild(this.content);}this.content.style.display="";if(this.owner.options.selectedClass){SZN.Dom.addClass(this.click,this.owner.options.selectedClass);}};SZN.Tab.prototype._deactivate=function(){var c=this.content.style.display="none";if(this.owner.options.selectedClass){SZN.Dom.removeClass(this.click,this.owner.options.selectedClass);}};SZN.Tab.prototype._hover=function(e,elm){SZN.Dom.addClass(elm,this.hoverClass);};SZN.Tab.prototype._hoverOut=function(e,elm){SZN.Dom.removeClass(elm,this.hoverClass);};var login={"xmlHttpReq":false,"chatStatusId":true,"check":function(loginUri,logoutUri,page){if(window.XMLHttpRequest){this.xmlHttpReq=new XMLHttpRequest();}else{if(window.ActiveXObject){this.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}}this.xmlHttpReq.open("POST","/sessionCheck?loginUri="+loginUri+"&logoutUri="+logoutUri+"&page="+page,true);this.xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.xmlHttpReq.onreadystatechange=function(){if(login.xmlHttpReq.readyState==4){if(login.xmlHttpReq.status==200){SZN.gEl("login").innerHTML=login.xmlHttpReq.responseText;SZN.gEl("login").style.display="block";}}};this.xmlHttpReq.send("");},"checkAjax":function(loginUri,logoutUri){SZN.xmlhttpPost("/sessionCheckAjax?loginUri="+loginUri+"&logoutUri="+logoutUri,login.evalAjax);},"evalAjax":function(result,attr){if(window.ENABLE_ONLINE_CHAT&&login.chatStatusId){if(result.loginStatus){var content="<form onsubmit=\"return online.sendComment();\">"+"<input type=\"text\" id=\"commentContent\" />"+"<input type=\"submit\" value=\"Odeslat\" onclick=\"return online.sendComment();\">"+"</form>";window.loggedUserName=result.userName;}else{var content="Pokud chcete poslat vlastní příspěvek, musíte se <a href=\""+result.loginUri+"\">přihlásit</a>!";}}else{var content="<strong>Omlouváme se, ale chat není momentálně dostupný. Děkujeme za pochopení.</strong>";}SZN.gEl("addComment").innerHTML=content;}};function onlineShow(url){window.open(url,"_blank","width=775,height=700,resizable=yes");return false;};function calendarShow(e,elm){SZN.events.cancelDef(e);var url=elm.href;window.open(url,"_blank","width=775,height=700,resizable=yes");return false;};SZN.joke=function(id){var elm=SZN.gEl(id);this.url=elm.href.replace(/&/g,"&amp;");SZN.events.addListener(elm,"click",this,"_open");};SZN.joke.prototype._open=function(e,elm){window.open(this.url,"_blank","width=790,height=500,menubar=yes,resizable=yes,scrollbars=yes");SZN.events.cancelDef(e);};SZN.joke.init=function(id){var j=new SZN.joke(id);};function setGen(gen){var cookName="show_sex";var newGen=gen=="child"?"f":"child";var dateExp=new Date();dateExp.setDate(dateExp.getDate()+365);document.cookie=cookName+"="+newGen+";expires="+dateExp.toGMTString()+";path=/;";if(document.cookie.indexOf(cookName)==-1){alert("Pro stálé zapamatování vaąí volby musíte mít povoleno ukládání cookies v prohlíľeči.");}document.location.href="?show_sex="+newGen;return false;};function writeLink(gen){document.write("<p class=\"more\"><a href=\"#\" onclick=\"return setGen('"+gen+"')\">Zobrazovat na HP "+(gen=="f"?"dítě":"dívku")+" dne</a></p>");};function mailDecrypt(str){var r="";for(i=0;i<str.length;i++){n=str.charCodeAt(i);if(n>=8364){n=128;}r+=String.fromCharCode(n-4);}return "<a href=\"mailto:"+r+"\">Redakce Super.cz</a>";};var bubble={"cont":null,"loader":null,"showTimer":null,"hideTimer":null,"x":0,"y":0,"hide":function(){function closeBubble(){window.clearTimeout(bubble.showTimer);bubble.showTimer=null;if(bubble.loader!=null){bubble.cont.removeChild(bubble.loader);bubble.loader=null;}}bubble.hideTimer=window.setTimeout(closeBubble,200);return false;},"show":function(elm,url,e){if(!e){e=window.event;};this.x=e.clientX;this.y=e.clientY;sX=!document.documentElement.scrollTop?document.body.scrollLeft:document.documentElement.scrollLeft;sY=!document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;this.x=this.x+sX;this.y=this.y+sY+5;bubble.cont=document.getElementsByTagName("body")[0];function getData(){SZN.xmlhttpPost(url+"&r="+Math.round(Math.random()*100),bubble.makeOutput);};bubble.showTimer=window.setTimeout(getData,500);},"cancelHide":function(){window.clearTimeout(bubble.hideTimer);bubble.hideTimer=null;},"makeOutput":function(data){var c=bubble.cont;var l=bubble.loader=SZN.cEl("div");var text=data.content;var title=data.title;var imgURL=data.pictureUrl.replace("%s","75x100");var imgW="75";var imgH="100";var imgAlt=data.pictureTitle;var html="<div id=\"bubble-cnt\" onmouseover=\"return bubble.cancelHide();\" onmouseout=\"return bubble.hide();\" style=\"position:absolute;top:"+bubble.y+"px; left:"+bubble.x+"px;\"><div id=\"bubble\">";html+="<p class=\"close\">";html+="\t<a href=\"#\" onclick=\"return bubble.hide();\">Zavřít</a> ";html+="</p>";html+="<div class=\"inside\">";if(imgURL){html+="<img src=\""+imgURL+"\" width=\""+imgW+"\" height=\""+imgH+"\" alt=\""+imgAlt+"\" />";}html+="<div class=\"text\">"+text+"</div></div>";html+="<div class=\"cleaner\"></div></div></div>";l.innerHTML=html;c.appendChild(l);}};SZN.xmlhttpPost=function(strURL,callbackFunct,attr){var xmlHttpReq=false;var self=window;if(window.XMLHttpRequest){self.xmlHttpReq=new XMLHttpRequest();}else{if(window.ActiveXObject){self.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}}self.xmlHttpReq.open("POST",strURL,true);self.xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");self.xmlHttpReq.onreadystatechange=function(){if(self.xmlHttpReq.readyState==4){if(self.xmlHttpReq.status==200){try{eval("var answer ="+self.xmlHttpReq.responseText);}catch(e){var answer={"error":true};}if(attr){callbackFunct(answer,attr);}else{callbackFunct(answer);}}}};self.xmlHttpReq.send("");};SZN.FlashUtils=function(){this.addFlashToPage=function(flashObjectId,mode){var fl=SZN.gEl(flashObjectId);if(fl.outerHTML){var par=fl.getElementsByTagName("PARAM");var parC=[];for(var i=0;i<par.length;i++){parC[i]=par[i].cloneNode("true");}var newFl=fl.cloneNode(false);if(typeof newFl.data!="undefined"){newFl.removeAttribute("data");}for(var i=0;i<parC.length;i++){newFl.appendChild(parC[i]);}if(mode=="write"){fl.parentNode.removeChild(fl);document.write(newFl.outerHTML);}else{fl.outerHTML=newFl.outerHTML;}}};};SZN.flashUtils=new SZN.FlashUtils();function formCheck(form){var schval=SZN.gEl("agreement");var srt="";if(!schval.checked){alert("Musíte souhlasit s podmínkami soutěže.");schval.focus();return false;}for(var a=0;a<form.length;a++){if(form.elements[a].value==""){form.elements[a].focus();alert("Musíte vyplnit všechna pole.");return false;}}return true;}SZN.MoreLess=SZN.ClassMaker.makeClass({"NAME":"MoreLess","VERSION":"1.0","CLASS":"class"});SZN.MoreLess.prototype.$constructor=function(id,id1,id2){this.box=SZN.gEl(id);this.moreLink=SZN.gEl(id1);this.lessLink=SZN.gEl(id2);this.box.style.display="none";this.moreLink.style.display="block";SZN.Events.addListener(this.moreLink,"click",this,"more");SZN.Events.addListener(this.lessLink,"click",this,"less");};SZN.MoreLess.prototype.more=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);elm.style.display="none";this.lessLink.style.display="block";this.box.style.display="block";};SZN.MoreLess.prototype.less=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);elm.style.display="none";this.moreLink.style.display="block";this.box.style.display="none";};SZN.AddPhoto=SZN.ClassMaker.makeClass({"NAME":"AddPhoto","VERSION":"1.0","CLASS":"class"});SZN.AddPhoto.prototype.$constructor=function(showAddPhoto,userHashId,celebrityId,celebrityKeyword){this.userHashId=userHashId;this.celebrityId=celebrityId;this.celebrityKeyword=celebrityKeyword;this.buildDom();SZN.Events.addListener(SZN.gEl(showAddPhoto),"click",this,"showWindow");};SZN.AddPhoto.prototype.buildDom=function(){var params={"imagePath":"/static/images/shadow-","sizes":[0,1,3,0]};w=new SZN.Window(params);var title=SZN.cEl("h3");title.innerHTML="Přidejte fotografie k celebritě";var info=SZN.cEl("p","","info");info.innerHTML="Minimální rozměry jsou 350x466 bodů. Při větších rozměrech bude fotografie zmešena na tuto velikost.";var form=SZN.cEl("form");form.method="post";form.enctype="multipart/form-data";form.action="/celebrity/addPhoto";var hidden1=SZN.cEl("input");hidden1.type="hidden";hidden1.name="hashId";hidden1.value=this.userHashId;var hidden2=SZN.cEl("input");hidden2.type="hidden";hidden2.name="celebrityId";hidden2.value=this.celebrityId;var hidden3=SZN.cEl("input");hidden3.type="hidden";hidden3.name="celebrityKeyword";hidden3.value=this.celebrityKeyword;var row1=SZN.cEl("div","","row");var label=SZN.cEl("label");label.innerHTML="Fotografie:";var br=SZN.cEl("br");var input=SZN.cEl("input");input.type="file";input.name="image";var row2=SZN.cEl("div","","row");var input1=SZN.cEl("input");input1.type="file";input1.name="image_2";var row3=SZN.cEl("div","","row");var input2=SZN.cEl("input");input2.type="file";input2.name="image_3";var submit=SZN.cEl("input","","add-foto");submit.type="submit";submit.value="Vložit fotografie";var close=SZN.cEl("a","close-add-photo");close.href="#";var closeImg=SZN.cEl("img");closeImg.src="/static/images/close.png";SZN.Events.addListener(close,"click",this,"hideWindow");var info1=SZN.cEl("p","","notice");info1.innerHTML="Provozovatel neodpovídá za příspěvky či fotografie vložené uživateli. Současně si však provozovatel vyhrazuje právo smazat veškeré příspěvky či fotografie, jež by mohly odporovat oprávněným zájmům provozovatele, ohrožovat veřejný pořádek, či by mohly být v rozporu s dobrými mravy, etickými pravidly nebo právními předpisy.";SZN.Dom.append([close,closeImg]);SZN.Dom.append([row1,label,br,input]);SZN.Dom.append([row2,input1]);SZN.Dom.append([row3,input2]);SZN.Dom.append([form,hidden1,hidden2,hidden3]);SZN.Dom.append([form,row1,row2,row3,submit]);SZN.Dom.append([w.content,close,title,info,form,info1]);w.container.style.position="absolute";};SZN.AddPhoto.prototype.showWindow=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);SZN.gEl("windowPlaceholder").appendChild(w.container);};SZN.AddPhoto.prototype.hideWindow=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);SZN.gEl("windowPlaceholder").removeChild(w.container);};SZN.AddLink=SZN.ClassMaker.makeClass({"NAME":"AddLink","VERSION":"1.0","CLASS":"class"});SZN.AddLink.prototype.$constructor=function(addLink,form){this.form=SZN.gEl(form);this.form.style.display="none";SZN.Events.addListener(SZN.gEl(addLink),"click",this,"show");};SZN.AddLink.prototype.show=function(e,elm){SZN.Events.cancelDef(e);SZN.Events.stopEvent(e);elm.style.display="none";this.form.style.display="block";};SZN.HiddeAdBlock=SZN.ClassMaker.makeClass({"NAME":"HiddeAdBlock","VERSION":"1.0","CLASS":"class"});SZN.HiddeAdBlock.prototype.$constructor=function(adBlock){this.adBlock=SZN.gEl(adBlock);var hidde=true;var adPartner=SZN.gEl("adPartner");var adPartner2=SZN.gEl("adPartner2");var adSponsor=SZN.gEl("adSponsor");var adCommercial=SZN.gEl("adCommercial");var adCommMarketing=SZN.gEl("adCommMarketing");if(!SZN.Dom.hasClass(adPartner,"adPartnerEmpty")){hidde=false;}if(!SZN.Dom.hasClass(adPartner2,"adPartner2Empty")){hidde=false;}if(!SZN.Dom.hasClass(adSponsor,"adEmpty")){hidde=false;}if(!SZN.Dom.hasClass(adCommercial,"adEmpty")){hidde=false;}if(!SZN.Dom.hasClass(adCommMarketing,"adEmpty")){hidde=false;}if(hidde){this.adBlock.style.display="none";}};SZN.Thumbnails={"_links":[],"_urls":[],"_image":null,"init":function(image,container,urls){this._image=image;this._urls=urls;var links=container.getElementsByTagName("a");for(var i=0;i<links.length;i++){this._links.push(links[i]);SZN.Events.addListener(links[i],"click",this,"_click");}},"_click":function(e,elm){SZN.Events.cancelDef(e);var index=this._links.indexOf(elm);this._image.src=this._urls[index];}};var videoSuper={"pagingElm":null,"contentElm":null,"sectionId":null,"gemiusId":null,"init":function(pagingElm,contentElm,sectionId,gemiusId){var links=[];var pel=SZN.gEl(pagingElm);if(pel){var links=pel.getElementsByTagName("a");}for(var i=0;i<links.length;i++){var link=links[i];SZN.Events.addListener(link,"click",videoSuper,"pageReq");}videoSuper.pagingElm=pagingElm;videoSuper.contentElm=contentElm;videoSuper.sectionId=sectionId;videoSuper.gemiusId=gemiusId;},"pageReq":function(e,elm){SZN.Events.cancelDef(e);var page=/page=([0-9]+)/.exec(elm.href);var videoId=/videoId=([0-9]+)/.exec(elm.href);if(window.XMLHttpRequest){this.xmlHttpReq=new XMLHttpRequest();}else{if(window.ActiveXObject){this.xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");}}var reqUrl="/video/list?page="+page[1]+"&sectionId="+videoSuper.sectionId;if(videoId){reqUrl+="&videoId="+videoId[1];}this.xmlHttpReq.open("GET",reqUrl,true);this.xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.xmlHttpReq.onreadystatechange=function(){if(videoSuper.xmlHttpReq.readyState==4){if(videoSuper.xmlHttpReq.status==200){videoSuper.renderList(videoSuper.xmlHttpReq.responseText);}}};this.xmlHttpReq.send(null);},"renderList":function(result){SZN.gEl(videoSuper.contentElm).innerHTML=result;pp_gemius_hit(videoSuper.gemiusId);videoSuper.init(videoSuper.pagingElm,videoSuper.contentElm,videoSuper.sectionId,videoSuper.gemiusId);}};var videoByEmail={"linkElm":null,"formElm":null,"formElmId":null,"divFormElm":null,"status":false,"init":function(linkElmId,divFormElmId,formElmId){this.linkElm=SZN.gEl(linkElmId);this.formElm=SZN.gEl(formElmId);this.formElmId=formElmId;this.divFormElm=SZN.gEl(divFormElmId);if(this.linkElm){SZN.Events.addListener(this.linkElm,"click",this,"switchForm");}if(this.formElm){SZN.Events.addListener(this.formElm,"submit",this,"sendForm");}},"switchForm":function(e,elm){SZN.Events.cancelDef(e);if(this.status){this.divFormElm.className="nodisplay";this.status=false;}else{this.divFormElm.className="";this.status=true;}},"sendForm":function(e,elm){SZN.Events.cancelDef(e);var from=encodeURIComponent(SZN.gEl("f_fmail").value);var to=encodeURIComponent(SZN.gEl("f_adm").value);var fromName=encodeURIComponent(SZN.gEl("f_name").value);var text=encodeURIComponent(SZN.gEl("f_text").value);var videoId=encodeURIComponent(SZN.gEl("f_videoId").value);var sectionName=encodeURIComponent(SZN.gEl("f_sectionName").value);var url="/email?&ajax=yes&from="+from+"&to="+to+"&name="+fromName+"&description="+text+"&sectionName="+sectionName+"&videoId="+videoId;try{SZN.xmlhttpPost(url,this.sentForm);}catch(e){}return false;},"sentForm":function(data){if(data.status==1){SZN.gEl("f_fmail").value="";SZN.gEl("f_adm").value="";SZN.gEl("f_name").value="";SZN.gEl("f_text").value="";alert("E-mail byl úspěšně odeslán na "+data.to);}else{errors="Některé položky jsou špatně vyplněny:\n";for(i=0;i<data.errors.length;i++)errors+=data.errors[i].message+"\n";alert(errors);}}};var FlashUtils=function(){this.addFlashToPage=function(){var fl=document.getElementById("VideoSpot");if(fl.outerHTML){var par=fl.getElementsByTagName("PARAM");var parC=[];for(var i=0;i<par.length;i++){parC[i]=par[i].cloneNode("true");}var newFl=fl.cloneNode(false);if(typeof newFl.data!="undefined"){newFl.removeAttribute("data");}for(var i=0;i<parC.length;i++){newFl.appendChild(parC[i]);}var pNode=fl.parentNode;pNode.removeChild(fl);document.write(newFl.outerHTML);}};this.initAutoPlay=function(){SZN.Events.addListener(window,"load",this,"setAutoplay",false,false);};this.setAutoplay=function(){var pageurl=document.location.toString();if(pageurl.indexOf("videoId=")!=-1){var fl=document.getElementById("VideoSpot");fl.SetVariable("autoplay","1");}};};var flashUtils=new FlashUtils();Video={"showPopUp":false,"popUpEl":null,"id":null,"url":null,"img":null,"title":null,"source":null,"sourceUrl":null,"show":function(e,elm){SZN.events.cancelDef(e);for(var i=0;i<Article.videoArray.length;i++){if(Article.videoArray[i].id==elm.className){var videoData=Article.videoArray[i];}}var id=videoData.id;var url=videoData.url;var img=videoData.img;var title=videoData.title;var source=videoData.source;var sourceUrl=videoData.sourceUrl;this.id=videoData.id;this.url=videoData.url;this.img=videoData.img;this.title=videoData.title;this.source=videoData.source;this.sourceUrl=videoData.sourceUrl;if(Video.showPopUp){Video.hide();}var popUpEl=SZN.cEl("div");var popUpElIn=SZN.cEl("div");Video.popUpEl=popUpEl;popUpEl.className="videoPopUp";popUpEl.style.visibility="hidden";popUpEl.id="video"+id;SZN.bodyAddEl(popUpEl);Video.showPopUp=true;Video.renderPopUp();return false;},"hideEmbeds":function(el){var foo=SZN.gEl(el);if(foo){var embeds=foo.getElementsByTagName("embed");for(i=0;i<embeds.length;i++){embeds[i].style.visibility="hidden";}}},"showEmbeds":function(el){var foo=SZN.gEl(el);if(foo){var embeds=foo.getElementsByTagName("embed");for(i=0;i<embeds.length;i++){embeds[i].style.visibility="visible";}}},"correctPosition":function(el){var top=SZN.getScrollPos();var win=SZN.getDocSize();var leftPos=parseInt(10+((760-el.offsetWidth)/2));var topPos=parseInt(top.y+((win.height-el.offsetHeight)/2));xx=SZN.getBoxPosition(el,"left");yy=SZN.getBoxPosition(el,"top");el.style.top=(topPos<=0?10:topPos)+"px";el.style.left=leftPos+"px";},"hide":function(){Video.popUpEl.parentNode.removeChild(Video.popUpEl);Video.showPopUp=false;SZN.elementsHider(Video.popUpEl,["embed","object"],"show");return false;},"renderPopUp":function(){Video.correctPosition(Video.popUpEl);var content=""+"<div class=\"content\">"+"<div class=\"top\">"+"<a href=\"#\" onclick=\"return Video.hide()\">Zavřít okno</a>"+"</div>"+"<div class=\"middle\">"+"<object "+"type=\"application/x-shockwave-flash\""+"data=\"/static/flash/videoplayer.swf?video_src="+Video.url+"&amp;image_src="+Video.img+"&amp;pr_fifteen="+window.statUrl+"?videoId="+Video.id+"\""+"width=\"400\" height=\"280\">"+"<param name=\"movie\" value=\"/static/flash/videoplayer.swf?video_src="+Video.url+"&amp;image_src="+Video.img+"\" />"+"<param name=\"allowScriptAcess\" value=\"always\" />"+"<param name=\"quality\" value=\"high\" />"+"<param name=\"scale\" value=\"noScale\" />"+"<param name=\"salign\" value=\"TL\" />"+"<param name=\"allowfullscreen\" value=\"true\" />"+"<param name=\"FlashVars\" value=\"playerMode=embedded\" />"+"</object>"+"<p>"+Video.title+"</p>"+"<p class=\"source\">zdroj: <a href=\""+Video.sourceUrl+"\">"+Video.source+"</p>"+"</div>"+"<div class=\"bottom\"></div>"+"</div>";Video.popUpEl.innerHTML=content;Video.correctPosition(Video.popUpEl);SZN.elementsHider(Video.popUpEl,["embed","object"],"hide");Video.popUpEl.style.visibility="visible";}};SZN.Window=SZN.ClassMaker.makeClass({"NAME":"Window","VERSION":"1.0","CLASS":"class"});SZN.Window.prototype.$constructor=function(optObj){this.options={"imagePath":"/img/shadow-","imageFormat":"png","sizes":[6,6,6,6]};for(var p in optObj){this.options[p]=optObj[p];}this.content=SZN.cEl("div",false,"window-content",{"position":"relative"});;this.container=false;this._buildDom();};SZN.Window.prototype._buildDom=function(){var imageNames=[["lt","t","rt"],["l","","r"],["lb","b","rb"]];this.container=SZN.cEl("div",false,"window-container",{"position":"relative","zIndex":10});var table=SZN.cEl("table",false,false,{"borderCollapse":"collapse","position":"relative"});var tbody=SZN.cEl("tbody");SZN.Dom.append([table,tbody],[this.container,table]);for(var i=0;i<3;i++){var tr=SZN.cEl("tr");tbody.appendChild(tr);for(var j=0;j<3;j++){var td=SZN.cEl("td");td.style.padding="0px";td.style.margin="0px";var div=(i==1&&j==1?this.content:SZN.cEl("div",false,false,{"overflow":"hidden"}));td.appendChild(div);var im=imageNames[i][j];if(im){var path=this.options.imagePath+im+"."+this.options.imageFormat;if(SZN.Browser.klient=="ie"&&this.options.imageFormat.match(/png/i)){td.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+"',sizingMethod='scale')";}else{td.style.backgroundImage="url("+path+")";}}if(i==0){div.style.height=this.options.sizes[0]+"px";}if(i==2){div.style.height=this.options.sizes[2]+"px";}if(j==0){div.style.width=this.options.sizes[3]+"px";}if(j==2){div.style.width=this.options.sizes[1]+"px";}if(j==1&&i!=1){td.style.width="auto";}tr.appendChild(td);}}};SZN.Window.prototype.$destructor=function(){for(var p in this){this[p]=null;}};SZN.Window.prototype.show=function(){this.container.style.display="";};SZN.Window.prototype.hide=function(){this.container.style.display="none";};SZN.VecNd=SZN.ClassMaker.makeClass({"NAME":"VecNd","VERSION":"1.0","CLASS":"class"});SZN.VecNd.prototype.$constructor=function(n){this.n=n;this.data=[];for(var i=0;i<n;i++){var val=(arguments.length>i+1?arguments[i+1]:0);this.data.push(val);}};SZN.VecNd.prototype.setN=function(n,val){this.data[n]=val;};SZN.VecNd.prototype.getN=function(n){return this.data[n];};SZN.VecNd.prototype.norm=function(degree){var d=degree||2;var sum=0;for(var i=0;i<this.n;i++){sum+=Math.pow(this.getN(i),d);}return Math.pow(sum,1/d);};SZN.VecNd.prototype._plus=function(t){for(var i=0;i<this.n;i++){this.setN(i,this.getN(i)+t.getN(i));}return this;};SZN.VecNd.prototype.plus=function(t){var result=this.clone();return result._plus(t);};SZN.VecNd.prototype._minus=function(t){for(var i=0;i<this.n;i++){this.setN(i,this.getN(i)-t.getN(i));}return this;};SZN.VecNd.prototype.minus=function(t){var result=this.clone();return result._minus(t);};SZN.VecNd.prototype._multiply=function(num){for(var i=0;i<this.n;i++){this.setN(i,this.getN(i)*num);}return this;};SZN.VecNd.prototype.multiply=function(num){var result=this.clone();return result._multiply(num);};SZN.VecNd.prototype.dot=function(t){var result=0;for(var i=0;i<this.n;i++){result+=this.getN(i)*t.getN(i);}return result;};SZN.VecNd.prototype._unit=function(degree){var n=this.norm(degree);for(var i=0;i<this.n;i++){this.setN(i,this.getN(i)/n);}return this;};SZN.VecNd.prototype.unit=function(degree){var result=this.clone();return result._unit(degree);};SZN.VecNd.prototype.clone=function(){var result=new this.sConstructor(this.n);for(var i=0;i<this.n;i++){result.setN(i,this.getN(i));}return result;};SZN.VecNd.prototype.join=function(separator,round){var s=separator||",";var arr=[];for(var i=0;i<this.n;i++){var val=this.getN(i);if(round){val=Math.round(val);}arr.push(val);}return arr.join(s);};SZN.VecNd.prototype.toString=function(){return "["+this.join(", ")+"]";};SZN.Vec2d=SZN.ClassMaker.makeClass({"NAME":"Vec2d","VERSION":"1.0","CLASS":"class","EXTEND":SZN.VecNd});SZN.Vec2d.prototype.$constructor=function(x,y){SZN.VecNd.prototype.$constructor.call(this,2,x,y);};SZN.Vec2d.prototype.setX=function(x){this.data[0]=x;};SZN.Vec2d.prototype.setY=function(y){this.data[1]=y;};SZN.Vec2d.prototype.getX=function(){return this.data[0];};SZN.Vec2d.prototype.getY=function(){return this.data[1];};SZN.Vec2d.prototype.normal=function(){return new this.sConstructor(this.getY(),-this.getX());};SZN.Vec2d.prototype._symmetry=function(axis){var norm=axis.normal()._unit();var coef=this.dot(norm);return this._minus(norm._multiply(2*coef));};SZN.Vec2d.prototype.symmetry=function(axis){var result=this.clone();return result._symmetry(axis);};SZN.Vec2d.prototype.distance=function(p1,p2){var vec=p2.minus(p1);var n=vec.normal().unit();var a1=p1.getX();var a2=p1.getY();var c1=this.getX();var c2=this.getY();var v1=vec.getX();var v2=vec.getY();var w1=n.getX();var w2=n.getY();var dist=(v1*c2-v2*c1+a1*v2-a2*v1)/(w1*v2-v1*w2);return -dist;};SZN.Vector=SZN.ClassMaker.makeClass({"NAME":"Vector","CLASS":"static","VERSION":"1.0","DEPEND":[{"sClass":SZN.Vec2d,"ver":"1.0"}]});SZN.Vector.getCanvas=function(w,h){if(SZN.Browser.client=="ie"){return new SZN.VML(w,h);}else{return new SZN.SVG(w,h);}};SZN.Vector.Canvas=SZN.ClassMaker.makeClass({"NAME":"Canvas","VERSION":"1.0","CLASS":"class"});SZN.Vector.Canvas.prototype.$constructor=function(width,height){};SZN.Vector.Canvas.prototype.clear=function(){};SZN.Vector.Canvas.prototype.resize=function(width,height){};SZN.Vector.Canvas.prototype.getContainer=function(){};SZN.Vector.Canvas.prototype.getContent=function(){};SZN.Vector.Canvas.prototype.circle=function(){};SZN.Vector.Canvas.prototype.polyline=function(){};SZN.Vector.Canvas.prototype.polygon=function(){};SZN.Vector.Canvas.prototype.path=function(){};SZN.Vector.Canvas.prototype.setStroke=function(element,options){};SZN.Vector.Canvas.prototype.setFill=function(element,options){};SZN.Vector.Canvas.prototype.setCenterRadius=function(element,center,radius){};SZN.Vector.Canvas.prototype.setPoints=function(element,points,closed){};SZN.Vector.Canvas.prototype.setFormat=function(element,format){};SZN.Vector.Canvas.prototype.setTitle=function(element,title){element.setAttribute("title",title);};SZN.Vector.Canvas.prototype.computeControlPointsSymmetric=function(points,options){var o={"flat":true,"curvature":20,"join":false};for(var p in options){o[p]=options[p];}if(points.length<2||(points.length==2&&!o.join)){return false;}var result=[];var X=false;var Y=false;var limit=(o.join?points.length:points.length-1);for(var i=0;i<limit;i++){var A=points[i];if(o.join){var B=(i+1==points.length?points[0]:points[i+1]);var C=(i+2>=points.length?points[i+2-points.length]:points[i+2]);}else{var B=points[i+1];var C=(i+2==points.length?false:points[i+2]);}if(!C){var AB=B.minus(A);if(o.flat){Y=A.plus(AB.multiply(0.5));}else{var vAX=X.minus(A);var vYB=vAX.symmetry(AB);Y=B.minus(vYB);}}else{var vAC=C.minus(A);var l=vAC.norm();var frac=l/o.curvature;if(!frac){frac=Infinity;}var vYB=vAC.multiply(1/frac);Y=B.minus(vYB);}if(!X){var AB=B.minus(A);if(o.join){var D=points[points.length-1];var vBD=D.minus(B);var l=vBD.norm();var frac=l/o.curvature;if(!frac){frac=Infinity;}var vXA=vBD.multiply(1/frac);X=A.minus(vXA);}else{if(o.flat){X=A.plus(AB.multiply(0.5));}else{var vAX=vYB.symmetry(AB);X=A.plus(vAX);}}}result.push([X,Y]);X=B.plus(vYB);}return result;};SZN.Vector.Canvas.prototype.computeControlPoints=function(points,options){var o={"flat":true,"curvature":20,"join":false};for(var p in options){o[p]=options[p];}o.curvature=o.curvature/100;if(points.length<2||(points.length==2&&!o.join)){return false;}var result=[];var X=false;var Y=false;var limit=(o.join?points.length:points.length-1);for(var i=0;i<limit;i++){var A=points[i];if(o.join){var B=(i+1==points.length?points[0]:points[i+1]);var C=(i+2>=points.length?points[i+2-points.length]:points[i+2]);var D=(i?points[i-1]:points[points.length-1]);}else{var B=points[i+1];var C=(i+2==points.length?false:points[i+2]);var D=(i?points[i-1]:false);}var AB=B.minus(A);if(!C){if(o.flat){Y=A.plus(AB.multiply(0.5));}else{var vAX=X.minus(A);var vYB=vAX.symmetry(AB);Y=B.minus(vYB);}}else{var vAC=C.minus(A);var dist=AB.norm()*o.curvature;var norm=vAC.norm();var vYB=vAC.multiply(dist/norm||0);Y=B.minus(vYB);}if(D){var vBD=D.minus(B);var vBA=B.minus(A);var dist=vBA.norm()*o.curvature;var norm=vBD.norm();var vXA=vBD.multiply(dist/norm||0);X=A.minus(vXA);}else{if(o.flat){X=A.plus(AB.multiply(0.5));}else{var vAX=vYB.symmetry(AB);X=A.plus(vAX);}}result.push([X,Y]);}return result;};SZN.Vector.Primitive=SZN.ClassMaker.makeClass({"NAME":"Primitive","VERSION":"1.0","CLASS":"class"});SZN.Vector.Primitive.prototype.$constructor=function(canvas){this.canvas=canvas;this.elm=false;};SZN.Vector.Primitive.prototype.$destructor=function(){if(this.elm&&this.elm.parentNode&&this.elm.parentNode.nodeType==1){this.elm.parentNode.removeChild(this.elm);}};SZN.Vector.Line=SZN.ClassMaker.makeClass({"NAME":"Line","VERSION":"1.0","CLASS":"class","EXTEND":SZN.Vector.Primitive});SZN.Vector.Line.prototype.$constructor=function(canvas,points,options){this.canvas=canvas;this.elm2=false;this.options={"color":"#000","width":1,"curvature":0,"opacity":1,"outlineColor":"#fff","outlineOpacity":1,"outlineWidth":0,"title":"","symmetricCP":true};for(var p in options){this.options[p]=options[p];}this._build(points);};SZN.Vector.Line.prototype._build=function(points){var o1={"color":this.options.color,"width":this.options.width,"opacity":this.options.opacity};if(this.options.outlineWidth){var o2={"color":this.options.outlineColor,"width":2*this.options.outlineWidth+this.options.width,"opacity":this.options.outlineOpacity};}if(this.elm){this.elm.parentNode.removeChild(this.elm);}if(this.elm2){this.elm2.parentNode.removeChild(this.elm2);}if(this.options.curvature){this.elm=this.canvas.path();if(this.options.outlineWidth){this.elm2=this.canvas.path();}}else{this.elm=this.canvas.polyline();if(this.options.outlineWidth){this.elm2=this.canvas.polyline();}}this.canvas.setTitle(this.elm,this.options.title);this.canvas.setStroke(this.elm,o1);if(this.options.outlineWidth){this.canvas.setStroke(this.elm2,o2);this.canvas.setTitle(this.elm2,this.options.title);this.canvas.getContent().appendChild(this.elm2);}this.canvas.getContent().appendChild(this.elm);this.setPoints(points);};SZN.Vector.Line.prototype.setCurvature=function(c){if(!!this.options.curvature!=!!c){this.options.curvature=c;this._build(this.points);}else{this.options.curvature=c;this.setPoints(this.points);}};SZN.Vector.Line.prototype.$destructor=function(){if(this.elm.parentNode&&this.elm.parentNode.nodeType==1){this.elm.parentNode.removeChild(this.elm);}if(this.elm2&&this.elm2.parentNode&&this.elm2.parentNode.nodeType==1){this.elm2.parentNode.removeChild(this.elm2);}};SZN.Vector.Line.prototype.setPoints=function(points){this.points=points;if(this.options.curvature){var d="M "+this.points[0].join(" ");var len=this.points.length;if(len>2){if(this.options.symmetricCP){var control=this.canvas.computeControlPointsSymmetric(this.points,{"join":false,"curvature":this.options.curvature});}else{var control=this.canvas.computeControlPoints(this.points,{"join":false,"curvature":this.options.curvature});}for(var i=1;i<len;i++){var c=control[i-1];var x=c[0];var y=c[1];var point=this.points[i];d+="C "+x.join(" ")+", "+y.join(" ")+", "+point.join(" ")+" ";}}else{for(var i=1;i<len;i++){var point=this.points[i];d+="L  "+point.join(" ")+" ";}}this.canvas.setFormat(this.elm,d);if(this.elm2){this.canvas.setFormat(this.elm2,d);}}else{this.canvas.setPoints(this.elm,points);if(this.elm2){this.canvas.setPoints(this.elm2,points);}}};SZN.Vector.Line.prototype.setOptions=function(options){var o={};if("width" in options){o.width=options.width;this.options.width=options.width;}if("opacity" in options){o.opacity=options.opacity;}if("color" in options){o.color=options.color;}this.canvas.setStroke(this.elm,o);if(this.elm2){o={};if("outlineWidth" in options){o.width=2*options.outlineWidth+this.options.width;}if("outlineOpacity" in options){o.opacity=options.outlineOpacity;}if("outlineColor" in options){o.color=options.outlineColor;}this.canvas.setStroke(this.elm2,o);}};SZN.Vector.Polygon=SZN.ClassMaker.makeClass({"NAME":"Polygon","VERSION":"1.0","CLASS":"class","EXTEND":SZN.Vector.Primitive});SZN.Vector.Polygon.prototype.$constructor=function(canvas,points,options){this.canvas=canvas;this.options={"color":"#000","curvature":0,"opacity":1,"outlineColor":"#fff","outlineOpacity":1,"outlineWidth":0,"title":"","symmetricCP":true};for(var p in options){this.options[p]=options[p];}this._build(points);};SZN.Vector.Polygon.prototype._build=function(points){var stroke={"color":this.options.outlineColor,"width":this.options.outlineWidth,"opacity":this.options.outlineOpacity};var fill={"color":this.options.color,"opacity":this.options.opacity};if(this.elm){this.elm.parentNode.removeChild(this.elm);}if(this.options.curvature){this.elm=this.canvas.path();}else{this.elm=this.canvas.polygon();}this.canvas.setStroke(this.elm,stroke);this.canvas.setFill(this.elm,fill);this.canvas.setTitle(this.elm,this.options.title);this.canvas.getContent().appendChild(this.elm);this.setPoints(points);};SZN.Vector.Polygon.prototype.setPoints=function(points){this.points=points;if(this.options.curvature){if(this.options.symmetricCP){var control=this.canvas.computeControlPointsSymmetric(this.points,{"join":true,"curvature":this.options.curvature});}else{var control=this.canvas.computeControlPoints(this.points,{"join":true,"curvature":this.options.curvature});}var d="M "+this.points[0].join(" ");var len=this.points.length;for(var i=1;i<len+1;i++){var c=control[i-1];var x=c[0];var y=c[1];var point=(i>=len?this.points[0]:this.points[i]);d+="C "+x.join(" ")+", "+y.join(" ")+", "+point.join(" ")+" ";}d+="Z";this.canvas.setFormat(this.elm,d);}else{this.canvas.setPoints(this.elm,points,true);}};SZN.Vector.Polygon.prototype.setCurvature=function(c){if(!!this.options.curvature!=!!c){this.options.curvature=c;this._build(this.points);}else{this.options.curvature=c;this.setPoints(this.points);}};SZN.Vector.Circle=SZN.ClassMaker.makeClass({"NAME":"Circle","VERSION":"1.0","CLASS":"class","EXTEND":SZN.Vector.Primitive});SZN.Vector.Circle.prototype.$constructor=function(canvas,center,radius,options){this.canvas=canvas;this.center=new SZN.Vec2d(0,0);this.radius=0;this.options={"color":"","opacity":1,"outlineColor":"#000","outlineOpacity":1,"outlineWidth":1,"title":""};for(var p in options){this.options[p]=options[p];}var stroke={"color":this.options.outlineColor,"width":this.options.outlineWidth,"opacity":this.options.outlineOpacity};var fill={"color":this.options.color,"opacity":this.options.opacity};this.elm=this.canvas.circle(this.center,this.radius);this.setCenter(center);this.setRadius(radius);this.canvas.setStroke(this.elm,stroke);this.canvas.setFill(this.elm,fill);this.canvas.setTitle(this.elm,this.options.title);this.canvas.getContent().appendChild(this.elm);};SZN.Vector.Circle.prototype.setCenter=function(center){this.center=center;this.canvas.setCenterRadius(this.elm,this.center,this.radius);};SZN.Vector.Circle.prototype.setRadius=function(radius){this.radius=radius;this.canvas.setCenterRadius(this.elm,this.center,this.radius);};SZN.Vector.Path=SZN.ClassMaker.makeClass({"NAME":"Path","VERSION":"1.0","CLASS":"class","EXTEND":SZN.Vector.Primitive});SZN.Vector.Path.prototype.$constructor=function(canvas,format,options){this.canvas=canvas;this.elm2=false;this.options={"color":"none","opacity":1,"width":0,"outlineColor":"#fff","outlineOpacity":1,"outlineWidth":1,"title":""};for(var p in options){this.options[p]=options[p];}var stroke={"color":this.options.outlineColor,"width":this.options.outlineWidth,"opacity":this.options.outlineOpacity};var fill={"width":this.options.width,"color":this.options.color,"opacity":this.options.opacity};var two=this.options.width&&!format.match(/z/i);this.elm=this.canvas.path();this.setFormat(format);if(two){this.elm2=this.canvas.path();this.setFormat(format);if(stroke.outlineWidth){stroke.outlineWidth=fill.width*2+stroke.outlineWidth;}this.canvas.setStroke(this.elm,fill);this.canvas.setStroke(this.elm2,stroke);this.canvas.setTitle(this.elm2,this.options.title);}else{this.canvas.setStroke(this.elm,stroke);this.canvas.setFill(this.elm,fill);}this.canvas.setTitle(this.elm,this.options.title);if(this.elm2){this.canvas.getContent().appendChild(this.elm2);}this.canvas.getContent().appendChild(this.elm);};SZN.Vector.Path.prototype.$destructor=function(){if(this.elm.parentNode&&this.elm.parentNode.nodeType==1){this.elm.parentNode.removeChild(this.elm);}if(this.elm2&&this.elm2.parentNode&&this.elm2.parentNode.nodeType==1){this.elm2.parentNode.removeChild(this.elm2);}};SZN.Vector.Path.prototype.setFormat=function(format){this.canvas.setFormat(this.elm,format);if(this.elm2){this.canvas.setFormat(this.elm2,format);}};SZN.SVG=SZN.ClassMaker.makeClass({"NAME":"SVG","VERSION":"2.0","CLASS":"class","IMPLEMENT":SZN.Vector.Canvas});SZN.SVG.prototype.ns="http://www.w3.org/2000/svg";SZN.SVG.prototype.xlinkns="http://www.w3.org/1999/xlink";SZN.SVG.prototype.$constructor=function(width,height){var svg=document.createElementNS(this.ns,"svg");svg.setAttribute("width",width);svg.setAttribute("height",height);svg.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",this.xlinkns);SZN.Events.addListener(svg,"mousemove",SZN.Events.cancelDef,false,false);SZN.Events.addListener(svg,"mousedown",SZN.Events.cancelDef,false,false);SZN.Events.addListener(svg,"mouseup",SZN.Events.cancelDef,false,false);this.canvas=svg;};SZN.SVG.prototype.$destructor=function(){SZN.Events.removeListener(this.canvas,"mousemove",SZN.Events.cancelDef,false,false);SZN.Events.removeListener(this.canvas,"mousedown",SZN.Events.cancelDef,false,false);SZN.Events.removeListener(this.canvas,"mouseup",SZN.Events.cancelDef,false,false);if(this.canvas.parentNode&&this.canvas.parentNode.nodeType==1){this.canvas.parentNode.removeChild(this.canvas);}this.canvas=null;};SZN.SVG.prototype.getContainer=function(){return this.canvas;};SZN.SVG.prototype.getContent=function(){return this.canvas;};SZN.SVG.prototype.clear=function(){SZN.Dom.clear(this.canvas);};SZN.SVG.prototype.resize=function(width,height){this.canvas.setAttribute("width",width);this.canvas.setAttribute("height",height);};SZN.SVG.prototype.polyline=function(){var el=document.createElementNS(this.ns,"polyline");el.setAttribute("fill","none");el.setAttribute("stroke","none");el.setAttribute("stroke-linejoin","round");el.setAttribute("stroke-linecap","round");return el;};SZN.SVG.prototype.circle=function(){var el=document.createElementNS(this.ns,"circle");el.setAttribute("fill","none");el.setAttribute("stroke","none");return el;};SZN.SVG.prototype.polygon=function(){var el=document.createElementNS(this.ns,"polygon");el.setAttribute("fill","none");el.setAttribute("stroke","none");el.setAttribute("stroke-linejoin","round");el.setAttribute("stroke-linecap","round");return el;};SZN.SVG.prototype.path=function(){var el=document.createElementNS(this.ns,"path");el.setAttribute("fill","none");el.setAttribute("stroke","none");el.setAttribute("stroke-linejoin","round");el.setAttribute("stroke-linecap","round");return el;};SZN.SVG.prototype.setStroke=function(element,options){if("color" in options){element.setAttribute("stroke",options.color);}if("opacity" in options){element.setAttribute("stroke-opacity",options.opacity);}if("width" in options){element.setAttribute("stroke-width",options.width);}};SZN.SVG.prototype.setFill=function(element,options){if("color" in options){element.setAttribute("fill",options.color);}if("opacity" in options){element.setAttribute("fill-opacity",options.opacity);}};SZN.SVG.prototype.setCenterRadius=function(element,center,radius){element.setAttribute("cx",center.getX());element.setAttribute("cy",center.getY());element.setAttribute("r",radius);};SZN.SVG.prototype.setPoints=function(element,points,closed){var arr=points.map(function(item){return item.join(" ");});element.setAttribute("points",arr.join(", "));};SZN.SVG.prototype.setFormat=function(element,format){element.setAttribute("d",format);};SZN.VML=SZN.ClassMaker.makeClass({"NAME":"VML","VERSION":"2.0","CLASS":"class","IMPLEMENT":SZN.Vector.Canvas});SZN.VML.prototype.$constructor=function(width,height){if(SZN.Browser.client=="ie"&&!document.namespaces["vml"]){document.namespaces.add("vml","urn:schemas-microsoft-com:vml");var s=document.createStyleSheet();s.cssText="vml\\:*{behavior:url(#default#VML);";}var el=SZN.cEl("div",false,false,{"position":"absolute","width":width+"px","height":height+"px","overflow":"hidden"});this.canvas=el;};SZN.VML.prototype.$destructor=function(){if(this.canvas.parentNode&&this.canvas.parentNode.nodeType==1){this.canvas.parentNode.removeChild(this.canvas);}this.canvas=null;};SZN.VML.prototype.clear=function(){SZN.Dom.clear(this.canvas);};SZN.VML.prototype.resize=function(width,height){this.canvas.style.width=width+"px";this.canvas.style.height=height+"px";};SZN.VML.prototype.getContainer=function(){return this.canvas;};SZN.VML.prototype.getContent=function(){return this.canvas;};SZN.VML.prototype.polyline=function(){var el=document.createElement("vml:polyline");el.style.position="absolute";el.setAttribute("filled",false);var s=SZN.cEl("vml:stroke");s.setAttribute("endcap","round");s.setAttribute("joinstyle","round");el.appendChild(s);var s=SZN.cEl("vml:fill");el.appendChild(s);return el;};SZN.VML.prototype.circle=function(){var el=document.createElement("vml:oval");el.style.position="absolute";el.setAttribute("filled",false);el.setAttribute("stroked",false);var s=SZN.cEl("vml:stroke");el.appendChild(s);var s=SZN.cEl("vml:fill");el.appendChild(s);return el;};SZN.VML.prototype.polygon=function(){var el=document.createElement("vml:polyline");el.style.position="absolute";el.setAttribute("filled",false);el.setAttribute("stroked",false);var s=SZN.cEl("vml:stroke");el.appendChild(s);s.setAttribute("endcap","round");s.setAttribute("joinstyle","round");var s=SZN.cEl("vml:fill");el.appendChild(s);return el;};SZN.VML.prototype.path=function(){var el=document.createElement("vml:shape");el.setAttribute("filled",false);el.setAttribute("stroked",false);el.style.position="absolute";el.style.width="1px";el.style.height="1px";el.setAttribute("coordsize","1,1");var s=SZN.cEl("vml:stroke");el.appendChild(s);s.setAttribute("endcap","round");s.setAttribute("joinstyle","round");var s=SZN.cEl("vml:fill");el.appendChild(s);return el;};SZN.VML.prototype.setStroke=function(element,options){if("color" in options){element.setAttribute("strokecolor",options.color);}if("width" in options&&options.width){element.setAttribute("stroked",true);element.setAttribute("strokeweight",options.width+"px");}if("opacity" in options){element.getElementsByTagName("stroke")[0].setAttribute("opacity",options.opacity);}};SZN.VML.prototype.setFill=function(element,options){if("color" in options){element.setAttribute("filled",true);element.setAttribute("fillcolor",options.color);}if("opacity" in options){element.getElementsByTagName("fill")[0].setAttribute("opacity",options.opacity);}};SZN.VML.prototype.setCenterRadius=function(element,center,radius){element.style.left=(center.getX()-radius)+"px";element.style.top=(center.getY()-radius)+"px";element.style.width=(radius*2)+"px";element.style.height=(radius*2)+"px";};SZN.VML.prototype.setPoints=function(element,points,closed){var arr=points.map(function(item){return item.join(" ");});if(closed){arr.push(points[0].join(" "));}if(element.points){element.points.value=arr.join(", ");}else{element.setAttribute("points",arr.join(", "));}};SZN.VML.prototype._analyzeFormat=function(format){var data=[];var ptr=0;var current="";var obj=false;while(ptr<format.length){if(!current){}var ch=format.charAt(ptr);if(ch.match(/[a-z]/i)){if(current){obj.parameters.push(parseFloat(current));}if(obj){data.push(obj);}obj={"command":ch,"parameters":[]};current="";}else{if(ch.match(/[ ,]/)){if(current){obj.parameters.push(parseFloat(current));}current="";}else{current+=ch;}}ptr++;}if(current){obj.parameters.push(parseFloat(current));}if(obj){data.push(obj);}return data;};SZN.VML.prototype._serializeFormat=function(data){var s="";for(var i=0;i<data.length;i++){var cmd=data[i];var numbers=cmd.parameters.map(function(item){return Math.round(item);});s+=cmd.command+" "+numbers.join(" ")+" ";}return s;};SZN.VML.prototype._generateArc=function(parameters,coords){function calcAngle(ux,uy,vx,vy){var ta=Math.atan2(uy,ux);var tb=Math.atan2(vy,vx);if(tb>=ta){return tb-ta;}return 2*Math.PI-(ta-tb);}function fixAngle(angle){var a=angle;a=360*a/(2*Math.PI);return a*(2<<15);}var r1=parameters[0];var r2=parameters[1];var x=parameters[5];var y=parameters[6];var cx=coords.getX();var cy=coords.getY();var largeArcFlag=parameters[3];var sweepFlag=parameters[4];var xp,yp,cxp,cyp;var angle=parameters[2];angle=angle*Math.PI/180;xp=Math.cos(angle)*(cx-x)/2+Math.sin(angle)*(cy-y)/2;yp=-Math.sin(angle)*(cx-x)/2+Math.cos(angle)*(cy-y)/2;var root=0;var numerator=r1*r1*r2*r2-r1*r1*yp*yp-r2*r2*xp*xp;if(numerator<0){var s=sqrt(1-numerator/(r1*r1*r2*r2));r1*=s;r2*=s;root=0;}else{root=Math.sqrt(numerator/(r1*r1*yp*yp+r2*r2*xp*xp));if(largeArcFlag==sweepFlag){root=-root;}}cxp=root*r1*yp/r2;cyp=-root*r2*xp/r1;var centerX=Math.cos(angle)*cxp-Math.sin(angle)*cyp+(cx+x)/2;var centerY=Math.sin(angle)*cxp+Math.cos(angle)*cyp+(cy+y)/2;var theta=calcAngle(1,0,(xp-cxp)/r1,(yp-cyp)/r2);var delta=calcAngle((xp-cxp)/r1,(yp-cyp)/r2,(-xp-cxp)/r1,(-yp-cyp)/r2);if(!sweepFlag&&delta>0){delta-=2*Math.PI;}else{if(sweepFlag&&delta<0){delta+=2*Math.PI;}}coords.setX(x);coords.setY(y);return [centerX,centerY,r1,r2,-fixAngle(theta),-fixAngle(delta)];};SZN.VML.prototype._fixFormat=function(format){var coords=new SZN.Vec2d(0,0);var data=this._analyzeFormat(format);for(var i=0;i<data.length;i++){var cmd=data[i];switch(cmd.command){case "M":case "L":coords.setX(cmd.parameters[0]);coords.setY(cmd.parameters[1]);break;case "C":coords.setX(cmd.parameters[4]);coords.setY(cmd.parameters[5]);break;case "z":case "Z":cmd.command="X";break;case "A":cmd.command="AE";cmd.parameters=this._generateArc(cmd.parameters,coords);break;}}data.push({"command":"E","parameters":[]});return this._serializeFormat(data);};SZN.VML.prototype.setFormat=function(element,format){var f=this._fixFormat(format);element.setAttribute("path",f);};SZN.PieChart=SZN.ClassMaker.makeClass({"NAME":"PieChart","VERSION":"1.0","CLASS":"class","DEPEND":[{"sClass":SZN.Vector,"ver":"1.0"}]});SZN.PieChart.prototype.$constructor=function(id,data,options){this.radius=0;this.width=0;this.height=0;this.options={"padding":15,"skew":0.7,"depth":10,"legendWidth":15,"labelDistance":20,"legend":true,"prefix":"","suffix":"","outlineColor":{"graph":"#000","legend":"#000"},"colors":["rgb(0,76,140)","rgb(255,73,17)","rgb(255,214,37)","rgb(94,162,33)","rgb(132,0,38)","rgb(137,205,255)","rgb(55,71,5)","rgb(179,210,0)","rgb(82,36,118)","rgb(255,155,17)","rgb(201,0,14)","rgb(0,138,212)"]};for(var p in options){this.options[p]=options[p];}this.container=SZN.gEl(id);this.appended=[];this.lastLabel=null;this.width=this.container.offsetWidth;this.height=this.container.offsetHeight;this.data=data;this.canvas=SZN.Vector.getCanvas(this.width,this.height);this.container.style.position="relative";this.container.appendChild(this.canvas.getContainer());this._draw();};SZN.PieChart.prototype.$destructor=function(){this.canvas.$destructor();for(var i=0;i<this.appended.length;i++){var elm=this.appended[i];elm.parentNode.removeChild(elm);}};SZN.PieChart.prototype._draw=function(){var o=this.options;var lw=0;if(o.legend){lw=this._prepareLegend();}var availh=this.height-2*o.padding;var availw=this.width-2*o.padding-lw;availh/=o.skew;availh-=o.depth;this.radius=Math.round(Math.min(availw,availh)/2);var total=0;for(var i=0;i<this.data.length;i++){total+=parseFloat(this.data[i].data);}var r=this.radius;var cx=r+o.padding;var cy=(this.height-o.depth)/2;if(this.options.depth){var angle=2*Math.PI-Math.PI/2;for(var i=0;i<this.data.length;i++){var v=this.data[i].data;if(!v){continue;}var color=o.colors[i%o.colors.length];angle=this._drawPie(v,total,angle,cx,cy+this.options.depth,color,1);}}var angle=2*Math.PI-Math.PI/2;for(var i=0;i<this.data.length;i++){var v=this.data[i].data;if(!v){continue;}var color=o.colors[i%o.colors.length];angle=this._drawPie(v,total,angle,cx,cy,color,0);}if(this.options.legend){this._drawLegend();}};SZN.PieChart.prototype._drawPie=function(value,total,start_angle,cx,cy,color,middle){var ycoef=this.options.skew;var r=this.radius;var x1=r*Math.cos(start_angle)+cx;var y1=ycoef*r*Math.sin(start_angle)+cy;var angle=parseFloat(value)/total*2*Math.PI;var end_angle=start_angle+angle;var x2=r*Math.cos(end_angle)+cx;var y2=ycoef*r*Math.sin(end_angle)+cy;var large=(angle>=Math.PI?1:0);if(middle){var deg1=(start_angle/Math.PI*180)%360;var deg2=(end_angle/Math.PI*180)%360;if(deg2<=deg1){deg2+=360;}if(deg1>180&&deg2<360){return end_angle;}if(deg2>360){deg1=360;large=0;}if(deg1<540&&deg2>540){deg2=540;large=0;}if(deg1<180&&deg2>180){deg2=180;large=0;}var rad1=deg1/180*Math.PI;var rad2=deg2/180*Math.PI;x1=r*Math.cos(rad1)+cx;y1=ycoef*r*Math.sin(rad1)+cy;var x2=r*Math.cos(rad2)+cx;var y2=ycoef*r*Math.sin(rad2)+cy;var d=this.options.depth;var path="M "+x1+" "+y1+" L "+x1+" "+(y1-d)+" ";path+="A "+r*1+" "+(r*ycoef)+" 0 "+large+" 1 "+x2+" "+(y2-d)+" ";path+="L "+x2+" "+y2+" ";path+="A "+r+" "+(r*ycoef)+" 0 "+large+" 0 "+x1+" "+y1+" ";var r=color.match(/([0-9]+) *, *([0-9]+) *, *([0-9]+)/);var c=[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10)];var newr=c[0]-50;if(newr<0){newr=0;}var newg=c[1]-50;if(newg<0){newg=0;}var newb=c[2]-50;if(newb<0){newb=0;}new SZN.Vector.Path(this.canvas,path,{"outlineColor":this.options.outlineColor.graph,"color":"rgb("+newr+","+newg+","+newb+")"});}else{if(value==total){var path="M "+(cx-r)+" "+cy+" ";path+="A "+r+" "+r*(ycoef)+" 0 "+large+" 1 "+(cx+r)+" "+cy+" ";path+="A "+r+" "+r*(ycoef)+" 0 "+large+" 1 "+(cx-r)+" "+cy+" ";}else{var path="M "+cx+" "+cy+" L "+x1+" "+y1+" ";path+="A "+r+" "+r*(ycoef)+" 0 "+large+" 1 "+x2+" "+y2+" ";path+="L "+cx+" "+cy+" z";}new SZN.Vector.Path(this.canvas,path,{"outlineColor":this.options.outlineColor.graph,"color":color});var mid_angle=(start_angle+end_angle)/2;this._drawLabel(cx,cy,mid_angle,value);}return end_angle;};SZN.PieChart.prototype._drawLabel=function(cx,cy,angle,value){var x=(this.radius+this.options.labelDistance)*Math.cos(angle)+cx;var y=(this.radius+this.options.labelDistance)*this.options.skew*Math.sin(angle)+cy;y+=(angle%(2*Math.PI)<Math.PI?this.options.depth:0);var text1=SZN.cEl("div",false,false,{"position":"absolute","left":Math.round(x)+"px","top":Math.round(y)+"px"});var text2=SZN.cEl("div",false,false,{"position":"relative","left":"-50%"});text2.innerHTML=this.options.prefix+value+this.options.suffix;SZN.Dom.append([text1,text2],[this.container,text1]);this.appended.push(text1);var oh=text2.offsetHeight;y-=oh/2;text1.style.top=Math.round(y)+"px";if(this.lastLabel){var pos1=SZN.Dom.getBoxPosition(this.lastLabel);var pos2=SZN.Dom.getBoxPosition(text2);var dims1=[this.lastLabel.offsetWidth,this.lastLabel.offsetHeight];var dims2=[text2.offsetWidth,text2.offsetHeight];var ok1=(pos1.left+dims1[0]<pos2.left)||(pos2.left+dims2[0]<pos1.left);var ok2=(pos1.top+dims1[1]<pos2.top)||(pos2.top+dims2[1]<pos1.top);if(!ok1&&!ok2){var amount=Math.sqrt(dims2[0]*dims2[1]);x+=Math.cos(angle)*amount;y+=Math.sin(angle)*amount;text1.style.left=Math.round(x)+"px";text1.style.top=Math.round(y)+"px";}}this.lastLabel=text2;};SZN.PieChart.prototype._prepareLegend=function(){var labels=[];var max=0;var o=this.options;for(var i=0;i<this.data.length;i++){var text=SZN.cEl("div",false,false,{"position":"absolute"});text.innerHTML=this.data[i].label;this.container.appendChild(text);this.appended.push(text);var w=text.offsetWidth;max=Math.max(max,w);labels.push(text);}this.legendLabels=labels;return max+2*o.padding+10+o.legendWidth;};SZN.PieChart.prototype._drawLegend=function(labels){var labels=this.legendLabels;var o=this.options;for(var i=0;i<this.data.length;i++){var color=o.colors[i%o.colors.length];var x1=2*this.radius+3*o.padding;var x2=x1+o.legendWidth;var y1=i*(o.legendWidth+10)+o.padding;var y2=y1+o.legendWidth;new SZN.Vector.Polygon(this.canvas,[new SZN.Vec2d(x1,y1),new SZN.Vec2d(x2,y1),new SZN.Vec2d(x2,y2),new SZN.Vec2d(x1,y2)],{"color":color,"outlineColor":this.options.outlineColor.legend,"outlineWidth":1});var l=2*this.radius+3*o.padding+10+o.legendWidth;var t=i*(o.legendWidth+10)+o.padding;var text=labels[i];t+=Math.round((o.legendWidth-text.offsetHeight)/2);text.style.left=l+"px";text.style.top=t+"px";}};}
