// exCanvas 
document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_|| b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d<c.length;d++)this.initElement(c[d])}, initElement:function(b){if(!b.getContext){b.getContext=X;b.innerHTML="";b.attachEvent("onpropertychange",Z);b.attachEvent("onresize",$);var a=b.attributes;if(a.width&&a.width.specified)b.style.width=a.width.nodeValue+"px";else b.width=b.clientWidth;if(a.height&&a.height.specified)b.style.height=a.height.nodeValue+"px";else b.height=b.clientHeight}return b}};function Z(b){var a=b.srcElement;switch(b.propertyName){case "width":a.style.width=a.attributes.width.nodeValue+"px";a.getContext().clearRect(); break;case "height":a.style.height=a.attributes.height.nodeValue+"px";a.getContext().clearRect();break}}function $(b){var a=b.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}M.init();var N=[],B=0;for(;B<16;B++){var C=0;for(;C<16;C++)N[B*16+C]=B.toString(16)+C.toString(16)}function I(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(b,a){var c=I(),d=0;for(;d<3;d++){var f=0;for(;f<3;f++){var h=0,g=0;for(;g<3;g++)h+=b[d][g]*a[g][f];c[d][f]= h}}return c}function O(b,a){a.fillStyle=b.fillStyle;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.lineWidth=b.lineWidth;a.miterLimit=b.miterLimit;a.shadowBlur=b.shadowBlur;a.shadowColor=b.shadowColor;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.strokeStyle=b.strokeStyle;a.globalAlpha=b.globalAlpha;a.arcScaleX_=b.arcScaleX_;a.arcScaleY_=b.arcScaleY_;a.lineScale_=b.lineScale_}function P(b){var a,c=1;b=String(b);if(b.substring(0,3)=="rgb"){var d=b.indexOf("(",3),f=b.indexOf(")",d+ 1),h=b.substring(d+1,f).split(",");a="#";var g=0;for(;g<3;g++)a+=N[Number(h[g])];if(h.length==4&&b.substr(3,1)=="a")c=h[3]}else a=b;return{color:a,alpha:c}}function aa(b){switch(b){case "butt":return"flat";case "round":return"round";case "square":default:return"square"}}function H(b){this.m_=I();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=k*1;this.globalAlpha=1;this.canvas=b; var a=b.ownerDocument.createElement("div");a.style.width=b.clientWidth+"px";a.style.height=b.clientHeight+"px";a.style.overflow="hidden";a.style.position="absolute";b.appendChild(a);this.element_=a;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var i=H.prototype;i.clearRect=function(){this.element_.innerHTML=""};i.beginPath=function(){this.currentPath_=[]};i.moveTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y}; i.lineTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.bezierCurveTo=function(b,a,c,d,f,h){var g=this.getCoords_(f,h),l=this.getCoords_(b,a),e=this.getCoords_(c,d);Q(this,l,e,g)};function Q(b,a,c,d){b.currentPath_.push({type:"bezierCurveTo",cp1x:a.x,cp1y:a.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});b.currentX_=d.x;b.currentY_=d.y}i.quadraticCurveTo=function(b,a,c,d){var f=this.getCoords_(b,a),h=this.getCoords_(c,d),g={x:this.currentX_+ 0.6666666666666666*(f.x-this.currentX_),y:this.currentY_+0.6666666666666666*(f.y-this.currentY_)};Q(this,g,{x:g.x+(h.x-this.currentX_)/3,y:g.y+(h.y-this.currentY_)/3},h)};i.arc=function(b,a,c,d,f,h){c*=k;var g=h?"at":"wa",l=b+G(d)*c-v,e=a+F(d)*c-v,m=b+G(f)*c-v,r=a+F(f)*c-v;if(l==m&&!h)l+=0.125;var n=this.getCoords_(b,a),o=this.getCoords_(l,e),q=this.getCoords_(m,r);this.currentPath_.push({type:g,x:n.x,y:n.y,radius:c,xStart:o.x,yStart:o.y,xEnd:q.x,yEnd:q.y})};i.rect=function(b,a,c,d){this.moveTo(b, a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath()};i.strokeRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.stroke();this.currentPath_=f};i.fillRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.fill();this.currentPath_=f};i.createLinearGradient=function(b, a,c,d){var f=new D("gradient");f.x0_=b;f.y0_=a;f.x1_=c;f.y1_=d;return f};i.createRadialGradient=function(b,a,c,d,f,h){var g=new D("gradientradial");g.x0_=b;g.y0_=a;g.r0_=c;g.x1_=d;g.y1_=f;g.r1_=h;return g};i.drawImage=function(b){var a,c,d,f,h,g,l,e,m=b.runtimeStyle.width,r=b.runtimeStyle.height;b.runtimeStyle.width="auto";b.runtimeStyle.height="auto";var n=b.width,o=b.height;b.runtimeStyle.width=m;b.runtimeStyle.height=r;if(arguments.length==3){a=arguments[1];c=arguments[2];h=g=0;l=d=n;e=f=o}else if(arguments.length== 5){a=arguments[1];c=arguments[2];d=arguments[3];f=arguments[4];h=g=0;l=n;e=o}else if(arguments.length==9){h=arguments[1];g=arguments[2];l=arguments[3];e=arguments[4];a=arguments[5];c=arguments[6];d=arguments[7];f=arguments[8]}else throw Error("Invalid number of arguments");var q=this.getCoords_(a,c),t=[];t.push(" <g_vml_:group",' coordsize="',k*10,",",k*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var E=[];E.push("M11=", this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(q.x/k),",","Dy=",j(q.y/k),"");var p=q,z=this.getCoords_(a+d,c),w=this.getCoords_(a,c+f),x=this.getCoords_(a+d,c+f);p.x=s.max(p.x,z.x,w.x,x.x);p.y=s.max(p.y,z.y,w.y,x.y);t.push("padding:0 ",j(p.x/k),"px ",j(p.y/k),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",E.join(""),", sizingmethod='clip');")}else t.push("top:",j(q.y/k),"px;left:",j(q.x/k),"px;");t.push(' ">','<g_vml_:image src="',b.src, '"',' style="width:',k*d,"px;"," height:",k*f,'px;"',' cropleft="',h/n,'"',' croptop="',g/o,'"',' cropright="',(n-h-l)/n,'"',' cropbottom="',(o-g-e)/o,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("<g_vml_:shape",' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',k*10," ",k*10,'"',' stroked="', !b,'"',' path="');var h={x:null,y:null},g={x:null,y:null},l=0;for(;l<this.currentPath_.length;l++){var e=this.currentPath_[l];switch(e.type){case "moveTo":a.push(" m ",j(e.x),",",j(e.y));break;case "lineTo":a.push(" l ",j(e.x),",",j(e.y));break;case "close":a.push(" x ");e=null;break;case "bezierCurveTo":a.push(" c ",j(e.cp1x),",",j(e.cp1y),",",j(e.cp2x),",",j(e.cp2y),",",j(e.x),",",j(e.y));break;case "at":case "wa":a.push(" ",e.type," ",j(e.x-this.arcScaleX_*e.radius),",",j(e.y-this.arcScaleY_*e.radius), " ",j(e.x+this.arcScaleX_*e.radius),",",j(e.y+this.arcScaleY_*e.radius)," ",j(e.xStart),",",j(e.yStart)," ",j(e.xEnd),",",j(e.yEnd));break}if(e){if(h.x==null||e.x<h.x)h.x=e.x;if(g.x==null||e.x>g.x)g.x=e.x;if(h.y==null||e.y<h.y)h.y=e.y;if(g.y==null||e.y>g.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_), z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l<J;l++){var T=u[l];S.push(T.offset*q+ o+" "+T.color)}a.push('<g_vml_:fill type="',m.type_,'"',' method="none" focus="100%"',' color="',da,'"',' color2="',ea,'"',' colors="',S.join(","),'"',' opacity="',ga,'"',' g_o_:opacity2="',fa,'"',' angle="',r,'"',' focusposition="',n.x,",",n.y,'" />')}else a.push('<g_vml_:fill color="',d,'" opacity="',f,'" />');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("<g_vml_:stroke",' opacity="',f,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',aa(this.lineCap), '"',' weight="',K,'px"',' color="',d,'" />')}a.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(), this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a, 0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager= M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();

// Jquery Canvas
(function($){var q=false;var r=[];$.fn.jqcanvas=function(i,j){return this.each(function(){var a=$.extend({},$.fn.jqcanvas.defaults,j);$this=$(this);var b=$this.offset().top;var c=$this.offset().left;var d=getMasterWidth($this);var e=getMasterHeight($this);var f=$("canvas").size();var g="jqcanvas_"+f;$this.data("callback",i);$this.data("top",b);$this.data("left",c);$this.data("width",d);$this.data("extraWidth",a.extraWidth);$this.data("height",e);$this.data("jqcanvas_id",g);var h=$(create_canvas(g,b,c,d,e,$this));h.each(function(){redraw($this,this)});if(a.verifySize){r.push($this);if(!(q)){q=true;setInterval(verifyResize,$.fn.jqcanvas.global_options.verifyResizeInterval);$(window).resize(verifyResize)}}})};$.fn.jqcanvas.defaults={extraWidth:0,verifySize:true};$.fn.jqcanvas.global_options={verifyResizeInterval:1000};function hasMoved(a){var b=a.offset();if(b.top!=a.data("top")){return true}else if(b.left!=a.data("left")){return true}else{return false}};function create_canvas(a,b,c,d,e,f){var g=parseInt(f.css('borderLeftWidth'))||0;var h=parseInt(f.css('borderTopWidth'))||0;var i=parseInt(c);var j=parseInt(b);var k=(i+g).toString()+'px';var l=(j+h).toString()+'px';var m={left:k,top:l};var n=d+f.data("extraWidth");var o=document.createElement('canvas');o.setAttribute('id',a);o.setAttribute('width',n);o.setAttribute('height',e);if($.browser.msie){G_vmlCanvasManager.initElement(o)};var p=$(o);f.prepend(p);p.addClass("jqcanvas");p.css(m);return o};function redraw(a,b){var c=getMasterWidth(a);var d=getMasterHeight(a);var e=a.data("jqcanvas_id");$('#'+e).remove();b=create_canvas(e,a.data("top"),a.data("left"),c,d,a);a.data("jqcanvas",$(b));a.data("callback")(b,$(b).width(),$(b).height())};function move(a,b,c,d){$(b).css({top:c,left:d})};function verifyMove(a,b){if(hasMoved(a)){var c=a.offset();b.each(function(){move(a,this,c.top,c.left)});a.data("top",c.top);a.data("left",c.left)}};function getMasterWidth(a){return parseInt(a.css("padding-right"))+parseInt(a.css("padding-left"))+a.width()};function getMasterHeight(a){return parseInt(a.css("padding-bottom"))+parseInt(a.css("padding-top"))+a.height()};function hasResized(a){var b=getMasterWidth(a);var c=getMasterHeight(a);if(b!=a.data("width")){return true}else if(c!=a.data("height")){return true}else{return false}};function verifyResize(){jQuery.map(r,function(a){var b=a.data("jqcanvas");verifyMove(a,b);if(hasResized(a)){b.each(function(){redraw(a,this)});a.data("width",getMasterWidth(a));a.data("height",getMasterHeight(a))}})}})(jQuery);

// Peckadesign Ajax Form + Mazání formulářů
(function($){$.fn.pdAjaxForm=function(g){return this.each(function(){var f=$(this),$form=this.tagName=='FORM'?f:f.find('form'),submit=':submit, :image';var a=g||{};f.bind('click',function(e){var c=$(e.target);if(c.closest(submit).length){var d=$(e.target.form),_this=e.target.form,btn=c.attr('name')!=''?c.attr('name')+'='+c.val():'',data=d.serialize()+'&'+btn+'&ajax=true',act=_this.action.split('#')[0],url=(act==''||act==' ')?'/':act,type=_this.method.toUpperCase();$.ajax({url:a.url||url,type:a.type||type,dataType:a.dataType||null,success:function(b){if(typeof a.success=='function'){a.success(b,f,d)}},beforeSend:function(){if(typeof a.beforeSend=='function'){return a.beforeSend(f,d,data,a)}},data:a.data||data});return false}})})};$.fn.clearForm=function(b){var c=b||'';return this.not(c).each(function(){var a=this.type,tag=this.tagName.toLowerCase();if(tag=='form'){return $(':input',this).clearForm(c)}if(a=='text'||a=='password'||tag=='textarea'){this.value=''}else if(a=='checkbox'||a=='radio'){this.checked=false}else if(tag=='select'){this.selectedIndex=-1}})}})($);

// PDBox, Copyright (c) 2010 PeckaDesign (www.peckadesign.cz)
(function($){$.pdBox=function(){this.overlay=null;this.overlayI=null;this.window={};this.$doc=$(document);this.$body=$('body');this.$html=$('html');this.langcode=this.$html.attr('lang')||'cs';this.langs={cs:{close:"Zavřít",prev:"předchozí",next:"další"},en:{close:"Close",prev:"previous",next:"next"},de:{close:"Zumachen",prev:"vorige",next:"folgend"},es:{close:"Vaer",prev:"previo",next:"siguiente"},fr:{close:"Fermer",prev:"précédant",next:"suivant"},it:{close:"Chiudere",prev:"previo",next:" veniente"},ru:{close:"закрыть",prev:"предшествующий",next:"последующий"}};this.html="<div id='pd-box-top'>"+"<div id='pd-box-bottom'>"+"<div id='pd-box-left'>"+"<div id='pd-box-right'>"+"<div id='pd-content'>"+"<p id='pd-box-pager'>"+"<a href='#' id='pd-box-prev' rel=''>"+this.langs[this.langcode]["prev"]+"</a>"+"<span id='pd-box-pages'></span>"+"<a href='#' id='pd-box-next' rel=''>"+this.langs[this.langcode]["next"]+"</a>"+"</p>"+"<h2 id='pd-box-title'></h2>"+"<div id='pd-box-desc'></div>"+"<a href='#' id='pd-box-image' title='"+this.langs[this.langcode]["close"]+"'></a>"+"</div>"+"</div>"+"</div>"+"</div>"+"</div>"+"<a href='#' id='pd-box-close' title='"+this.langs[this.langcode]["close"]+"'> "+this.langs[this.langcode]["close"]+"</a>"+"<div id='pd-box-top-left'>&nbsp;</div>"+"<div id='pd-box-top-right'>&nbsp;</div>"+"<div id='pd-box-bottom-left'>&nbsp;</div>"+"<div id='pd-box-bottom-right'>&nbsp;</div>";this.width=600;this.autoWidth=false;this.onOpen=null;this.onLoad=null;this.onClose=null;this.isOpen=false};$.pdBox.prototype={control:function($elems){$elems.bind('click',{that:this},function(e){e.data.that.open($(this),$elems);return false})},open:function($this,$all){if(!this.isOpen){this.isOpen=true;this.handleOnOpen();this.overlayShow();this.boxShow()}this.window.elem.addClass('loading').focusin(function(){$(this).addClass('focus')}).focusout(function(){$(this).removeClass('focus')});this.window.pager.hide();this.window.image.hide();this.window.title.hide();if(typeof $this!='undefined'){this.group($this,$all)}},group:function($this,$all){var rel=$this.attr('rel');var that=this;if(rel){var group=$all.filter('[rel="'+rel+'"]');var htmlPages='';group.each(function(i){htmlPages+=" <a href='"+this.href+"'>"+(i+1)+"</a> "});this.window.pages.empty().append(htmlPages);numbers=$("a",this.window.pages);numbers.bind('click',{that:this,numbers:numbers,all:$all},this.handleNumbers).eq($all.index($this)).trigger('click');this.window.prev.bind('click',function(){$('.active',that.window.pages).prev().trigger('click');return false});this.window.next.bind('click',function(){$('.active',that.window.pages).next().trigger('click');return false});this.$doc.bind('keyup',{that:this},this.handleKeyPage);if(numbers.size()>1){this.window.pager.show()}}else{this.preload($this.get(0).href,$this)}},openUrl:function(href){this.open();this.preloadUrl(href)},openHtml:function(html){this.open();this.window.content.show().html(html);this.handleOnLoad(html)},openHash:function(href){this.open();this.preloadHash(href)},preload:function(href,$this){var img=/\.jpg|\.png|\.gif$/,hash=/#/,$href=$this.attr('href');if(href.search(img)!==-1){var $img=$('img',$this),title=$img.attr('alt'),longdesc=$img.attr('longdesc')||'',desc=$img.attr('title')||'';desc=desc+((desc&&longdesc)?', ':'')+((longdesc)?'<a href="'+longdesc+'">'+longdesc+'</a>':'');if(title){this.window.title.show().text(title)}else{this.window.title.hide()}if(desc){this.window.content.show().html('<p>'+desc+'</p>')}else{this.window.content.hide()}this.window.image.show();this.preloadImage(href)}else if($href.search(hash)==0||($href.search(hash)!=-1&&window.location.href.split('#')[0]==href.split('#')[0])){this.preloadHash(href)}else{this.preloadUrl(href)}},preloadImage:function(href){imgPreloader=document.createElement('img');$(imgPreloader).bind('load',{that:this},function(e){var that=e.data.that,imgW=this.width;that.window.image.empty().append(this);if(that.autoWidth){that.width=imgW+2*17+2*17;that.boxPosition()}that.handleOnLoad(this)});$(imgPreloader).attr('src',href)},preloadUrl:function(href){var that=this,s='?',re1=/\?/;if(href.search(re1)!=-1){s='&'}$.get(href+s+"ajax=true",function(data){var hash=(href.search(/#/)!=-1)?href.split('#')[1]:'';if(hash!=''){var frag=$('<div>'+data+'</div>');var html=$('#'+unescape(hash),frag).clone()}else{var html=data}that.window.content.show().html(html);that.window.image.hide();$('#pd-box-bottom-left, #pd-box-bottom-right').css('position','absolute');that.handleOnLoad(html)})},preloadHash:function(href){if(href.search(/#/)!=-1){var hash=href.split('#')[1]}else{var hash=href}if($('#'+hash).size()>0){var hashContent=$('#'+hash).html()}else{hashContent='Hash nenalezen'}this.window.content.show().html(hashContent);this.window.image.hide();this.handleOnLoad(hashContent)},close:function(){this.isOpen=false;this.handleOnClose();this.boxHide();this.overlayHide()},boxShow:function(){this.window.elem=$('<div id="pd-box-window"></div>');this.window.elem.html(this.html).appendTo(this.$body);this.window.close=$("#pd-box-close",this.window.elem);this.window.title=$("#pd-box-title",this.window.elem);this.window.content=$("#pd-box-desc",this.window.elem);this.window.pager=$("#pd-box-pager",this.window.elem);this.window.pages=$("#pd-box-pages",this.window.elem);this.window.prev=$("#pd-box-prev",this.window.elem);this.window.next=$("#pd-box-next",this.window.elem);this.window.image=$("#pd-box-image",this.window.elem);this.window.close.bind('click',{that:this},this.handleClose);this.$doc.bind('keyup',{that:this},this.handleKeyClose);this.boxPosition()},boxHide:function(){this.window.close.unbind();this.window.next.unbind();this.window.prev.unbind();this.window.pages.find('a').unbind();this.$doc.unbind('keyup',this.handleKeyClose).unbind('keyup',this.handleKeyPage);this.window.elem.remove()},boxPosition:function(){var scroll=this.$html.scrollTop()||this.$body.scrollTop();this.window.elem.css({marginLeft:'-'+this.width/2+'px',width:this.width+'px',top:(scroll+40)+"px"})},overlayShow:function(){var h=this.$body.height();this.overlayI=$('<iframe id="pd-box-HideSelect"></iframe>').height(h).appendTo(this.$body);this.overlay=$('<div id="pd-box-overlay"></div>').height(h).appendTo(this.$body);this.overlay.bind('click',{that:this},this.handleClose)},overlayHide:function(){this.overlay.unbind().remove();this.overlayI.remove()},getKey:function(e){var keycode;if(!e){var e=window.event}if(e.keyCode){keycode=e.keyCode}else if(e.which){keycode=e.which}var key=String.fromCharCode(keycode).toLowerCase();return[keycode,key]},handleClose:function(e){e.data.that.close();return false},handleKeyClose:function(e){var that=e.data.that,key=that.getKey(e);if(key[0]==27||(!that.window.elem.is('.focus')&&(key[1]=='x'||key[1]=='c'))){that.window.close.trigger('click')}return false},handleKeyPage:function(e){var that=e.data.that,key=that.getKey(e);if(!that.window.elem.is('.focus')&&(key[1]=='p'||key[0]==37)){that.window.prev.filter(':visible').trigger('click')}else if(!that.window.elem.is('.focus')&&(key[1]=='n'||key[1]=='d'||key[0]==39)){that.window.next.filter(':visible').trigger('click')}return false},handleNumbers:function(e){var numbers=e.data.numbers,that=e.data.that,$this=$(this),index=numbers.index(this);numbers.removeClass('active');$this.addClass('active');if(index==0){that.window.prev.hide()}else{that.window.prev.show()}if(index==numbers.size()-1){that.window.next.hide()}else{that.window.next.show()}that.preload(this.href,e.data.all.eq(index));return false},handleOnOpen:function(){if(typeof this.onOpen=='function'){this.onOpen.call(this,this.window.elem)}},handleOnLoad:function(content){if(typeof this.onLoad=='function'){this.onLoad.call(this,this.window.elem,content)}this.window.elem.removeClass('loading')},handleOnClose:function(){if(typeof this.onClose=='function'){this.onClose.call(this,this.window.elem)}}}}(jQuery));

// předvyplněný text v inputech 
(function($){$.fn.inputText=function(sett){var o=$.extend({text:'Defaultní text'},sett);return this.each(function(){if(this.type&&this.type=='text'){var text=this.value==''?o.text:this.value,that=this;$(this).val(text).focus(function(){if(this.value==text)this.value=''}).blur(function(){if(this.value=='')this.value=text});$(this.form).submit(function(){if(that.value==text)that.value=''})}})}}(jQuery));

//Adjust heights created by Michal Matuška (fireball_)
(function($){var eqHeights=function(){this.stack=[];this.index=0;this.register=function(el,options,wrap){var opt=options||null;if(opt&&typeof opt=='string'){opt=[opt]}this.stack[this.index]={context:el,elements:opt,too:wrap||false};this.index++};this.calculate=function(obj){var that=obj,context=that.context,elements=that.elements,too=that.too,height=0,height2=0,fn=function(h){var newH=$(this).height();return h>newH?h:newH};context.css('height','').each(function(){if(elements){var len=elements.length,j=0;for(var i=len;i--;){height2=0;$(elements[j],this).css('height','').each(function(){height2=fn.call(this,height2)}).height(height2);j++}}if(!elements||elements&&too){height=fn.call(this,height)}});if(!elements||elements&&too){context.height(height)}};this.init=function(i){if(this.index){var index=i||null;if(index){index=index=='last'?this.index-1:index=='first'?0:index;this.calculate(this.stack[index])}else{var len=this.stack.length,j=0;for(var i=len;i--;){this.calculate(this.stack[j]);j++}}}};this.refresh=function(){this.init()}};$.eqHeights=new eqHeights;$.fn.eqHeights=function(elements,too){$.eqHeights.register(this,elements,too);$.eqHeights.init('last');return this}})(jQuery);
(function($){$.fn.fontSizeListener=function(element,callback){var el=$(element);var h=el.height();var listen=function(){var newH=el.height();if(newH!=h){h=newH;if(callback&&typeof callback=='function'){callback()}}};var fontSizeInterval=setInterval(function(){listen()},200)}})(jQuery);

// Jquery History
(function($){function History(){this._curHash='';this._callback=function(hash){}};$.extend(History.prototype,{init:function(callback){this._callback=callback;this._curHash=location.hash;if($.browser.msie){if(this._curHash==''){this._curHash='#'}$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var iframe=$("#jQuery_history")[0].contentWindow.document;iframe.open();iframe.close();iframe.location.hash=this._curHash}else if($.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack=[];this._isFirst=true;this._dontCheck=false}this._callback(this._curHash.replace(/^#/,''));setInterval(this._check,100)},add:function(hash){this._historyBackStack.push(hash);this._historyForwardStack.length=0;this._isFirst=true},_check:function(){if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash;if(current_hash!=$.history._curHash){location.hash=current_hash;$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''))}}else if($.browser.safari){if(!$.history._dontCheck){var historyDelta=history.length-$.history._historyBackStack.length;if(historyDelta){$.history._isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)$.history._historyForwardStack.unshift($.history._historyBackStack.pop())}else{for(var i=0;i<historyDelta;i++)$.history._historyBackStack.push($.history._historyForwardStack.shift())}var cachedHash=$.history._historyBackStack[$.history._historyBackStack.length-1];if(cachedHash!=undefined){$.history._curHash=location.hash;$.history._callback(cachedHash)}}else if($.history._historyBackStack[$.history._historyBackStack.length-1]==undefined&&!$.history._isFirst){if(location.hash.indexOf('#')>=0){$.history._callback(location.hash.split('#')[1])}else{$.history._callback('')}$.history._isFirst=true}}}else{var current_hash=location.hash;if(current_hash!=$.history._curHash){$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''))}}},isKonqueror:function(){return/KHTML|Konqueror/.test(navigator.userAgent)},load:function(hash){var newhash;if($.browser.safari){newhash=hash}else{newhash=(this.isKonqueror()?'':'#')+hash;location.hash=newhash}this._curHash=newhash;if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;this._callback(hash)}else if($.browser.safari){this._dontCheck=true;this.add(hash);var fn=function(){$.history._dontCheck=false};window.setTimeout(fn,200);this._callback(hash);location.hash=newhash}else{this._callback(hash)}}});$(document).ready(function(){$.history=new History()})})(jQuery);
// TABS
$.fn.pdTabs=function(option){option=jQuery.extend({tabSelector:'.tab-fragment',tabNameSelector:'.tab-name',defTab:0,tabPosition:'top',hideTabClass:'hide-tab',activeTabClass:'active',callFunction:function(){},prefix:'hi_'},option);var helpHash='';var sdiak="áäčďéěíĺľňóôöŕšťúůüýřžÁÄČĎÉĚÍĹĽŇÓÔÖŔŠŤÚŮÜÝŘŽ/";var bdiak="aacdeeillnooorstuuuyrzAACDEEILLNOOORSTUUUYRZ.";function bezdiak(str){var tx="";var txt=str;for(p=0;p<txt.length;p++){if(sdiak.indexOf(txt.charAt(p))!=-1){tx+=bdiak.charAt(sdiak.indexOf(txt.charAt(p)))}else tx+=txt.charAt(p)}return tx};$(this).each(function(){var element=$(this);$(element).addClass('js');var tabConstruct={name:function(){var i=0;var arr=[];$(''+option.tabSelector,element).each(function(){var size=$(''+option.tabNameSelector,this).size();if(size>0){if($(''+option.tabNameSelector+':eq(0)',this).attr('title')!=''){arr[i]=$(''+option.tabNameSelector+':eq(0)',this).attr('title')}else{arr[i]=$(''+option.tabNameSelector+':eq(0)',this).text()}}else{var j=i+1;arr[i]='Tab '+j}i++});return arr},id:function(){var arr=this.name();for(var i=0;i<arr.length;i++){arr[i]=bezdiak(arr[i].toLowerCase());arr[i]=arr[i].replace(/\s/g,"-").replace(/[-]{2,}/g,"-").replace(/\.|\{|\}|\(|\)|\[|\]|\\|@|:|\d/g,"").replace(/^-/,"").replace(/-$/,"")}return arr},size:$(''+option.tabSelector,element).size(),tabList:function(){var arrName=tabConstruct.name();var arrId=tabConstruct.id();var list='<ul class="tab-list">';for(var i=0;i<this.size;i++){list+='<li class="tab-'+(i+1)+' tab-'+arrId[i]+'"><a href="#'+arrId[i]+'"><span>'+arrName[i]+'</span></a></li>'}list+='</ul>';return list}};if(option.tabPosition=='bottom'){$(element).append(tabConstruct.tabList());$('.tab-list a').each(function(){$(this).attr('href','#'+$(this).attr('href').split('#')[1])})}else{$(element).prepend(tabConstruct.tabList());$('.tab-list a').each(function(){$(this).attr('href','#'+$(this).attr('href').split('#')[1])})}var i=0;var arrId=tabConstruct.id();$(''+option.tabSelector,element).each(function(){$(this).attr('id',arrId[i]);i++});function makeTabByHash(hash){if(typeof hash!='undefined'){var hash=hash}else{var hash=''}if(hash!=''){var onlyHash=hash;hash=option.prefix+hash}else{hash=window.location.hash.slice(1)}if(hash==''&&helpHash==''){var index=typeof option.defTab=='number'?option.defTab:0;$(''+option.tabSelector,element).eq(index).removeClass(option.hideTabClass);$(''+option.tabSelector,element).not(':eq('+index+')').addClass(option.hideTabClass);$('.tab-list li',element).not(':eq('+index+')').removeClass(option.activeTabClass);$('.tab-list li',element).eq(index).addClass(option.activeTabClass)}else{if($('#'+hash,element).is(option.tabSelector)==true){$('#'+hash,element).filter('.hide-tab').removeClass(option.hideTabClass);$(''+option.tabSelector,element).not('#'+hash+'').addClass(option.hideTabClass);var index=$(''+option.tabSelector,element).index($('#'+hash));$('.tab-list li',element).not(':eq('+index+')').removeClass(option.activeTabClass);$('.tab-list li',element).eq(index).addClass(option.activeTabClass);helpHash=hash}else if($(''+option.tabSelector+' #'+hash,element).size()>0||$(''+option.tabSelector+' #'+onlyHash,element).size()>0){if($(''+option.tabSelector+' #'+hash,element).size()>0){var index=$(''+option.tabSelector,element).index($('#'+hash).parents(''+option.tabSelector))}else{var index=$(''+option.tabSelector,element).index($('#'+onlyHash).parents(''+option.tabSelector))}$(''+option.tabSelector,element).eq(index).removeClass(option.hideTabClass);$(''+option.tabSelector,element).not(':eq('+index+')').addClass(option.hideTabClass);$('.tab-list li',element).not(':eq('+index+')').removeClass(option.activeTabClass);$('.tab-list li',element).eq(index).addClass(option.activeTabClass);helpHash=$(''+option.tabSelector+' #'+hash,element).parents(''+option.tabSelector).attr('id')}else{if(helpHash==''){var index=typeof option.defTab=='number'?option.defTab:0}else{var index=$(''+option.tabSelector,element).index($('#'+helpHash))}$(''+option.tabSelector,element).not(':eq('+index+')').addClass(option.hideTabClass);$('.tab-list li',element).not(':eq('+index+')').removeClass(option.activeTabClass);$('.tab-list li',element).eq(index).addClass(option.activeTabClass)}option.callFunction();if($(''+option.tabSelector+' #'+hash,element).size()>0){var top=$('#'+hash).offset().top;$('html, body').scrollTop(top)}}};$('a[href^="#"]').each(function(){var hash=$(this).attr('href').split('#');hash=hash[hash.length-1];if(hash!=''&&$('#'+hash,element).size()){$('#'+hash).each(function(){this.id=option.prefix+this.id});$('label[for="'+hash+'"]').each(function(){this.htmlFor=option.prefix+this.htmlFor});$(this).click(function(){$.history.load(hash);return false})}});$.history.init(makeTabByHash);var hash=window.location.hash;hash=hash.replace(/^.*#/,'');if(hash!=''){$.history.load(hash)}else{makeTabByHash()}})};

// Cookie
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};

// Cycle
(function($){var ver="2.88";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,(!opts2.rev&&!opts.backwards));},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,(!opts.rev&&!opts.backwards));}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
(function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);

$(document).ready(function(){
	
	// ADJUST HEIGHT
    $.eqHeights.register($('.products-box-list, #home-offer'), ['.title']);
    $.eqHeights.init();
    
    inItem = false;
    inBox = false;
    // MAIN MENU
    /*$('#main-menu li').hover(
		function(){
			var $this = $(this);
			$('.sub-menu').remove();
		
			liIndex = $this.index();
			inItem = true;
			
			$('#main-menu li').removeClass('active');
			$('body').append( mainMenu[liIndex] );			
			$('#main-menu li:eq('+liIndex+')').addClass('active');
			setTimeout(function(){
				$('.sub-menu').slideDown();
				$.eqHeights.register($('.sub-menu:not(".flashMapSubmenu")'), ['.bar']);
				$.eqHeights.init();
			}, 250);				
		},
		function(){
			inItem = false;
			hideMenu();
		}
	)
	
	$('.sub-menu').live('hover', function() {
		inBox = !inBox;
		hideMenu();
	});
	
	function hideMenu()
	{
		setTimeout(function()
		{
			if (!inItem && !inBox)
			{
				$('.sub-menu').remove();
				$('#main-menu li:eq('+liIndex+')').removeClass('active');
			}
		} , 200);	
	}*/
	$('#main-menu').each(function(){
		var $el = $(this);
		var liIndex = 0,
			appendHTML = '<div class="sub-menu"><div class="in"></div></div>';
		
		$('li', this).hover(
			function(){
				var $this = $(this);
				liIndex = $this.index();
				
				$('#main-menu li').removeClass('active');			
				$('#main-menu li:eq('+liIndex+')').addClass('active');
			
				$('.sub-menu .in .spc').remove();
				
				if ( $('.sub-menu').size() == 0 ){
					setTimeout(function(){
						if ( $('.sub-menu').size() == 0 ){
							$('body').append(appendHTML);
							$('.sub-menu .in').append( mainMenu[liIndex] );
							$('.sub-menu .in .spc').show();
							$('.sub-menu').css('display', 'none').slideDown();
						}
					}, 250);
				}
				else{
					$('.sub-menu .in').append( mainMenu[liIndex] );
					if (navigator.appName=="Microsoft Internet Explorer"){
						$('.sub-menu .in .spc').show();
					}
					else{
						$('.sub-menu .in .spc').fadeIn();
					}
				}
				
				$.eqHeights.register($('.sub-menu div:not(".flashMapSubmenu")'), ['.bar']);
				$.eqHeights.init();
				
				inItem = true;				
			},
			function(){
				inItem = false;
				hideMenu();
			}
		);
		
		$('.sub-menu').live('hover', function() {
			inBox = !inBox;
			hideMenu();
		});
		
		function hideMenu()
		{
			setTimeout(function(){
				if (!inItem && !inBox)
				{
					$('.sub-menu').remove();
					$('#main-menu li').removeClass('active');
				}
			} , 250);	
		}
	});
	
    // SEND FORM 
    $('#form-skladem, #form-sort').change(function(){
        this.form.submit();
    });

	// INPUT
    $('input#q, input#giftVoucher').inputText({});	

    // TABS BOX
    $('#tabs-box').pdTabs();
    
    // FORMS
    $('.ajaxForm').not('.new-search')
        .wrap('<div class="ajaxWrap"></div>')
        .after('<div class="ajaxOverlay"></div><div class="ajaxLoader"></div>')
        .pdAjaxForm({
            beforeSend: function($box, $form, data, option){
                // pokud je potřeba přidat do dat další parametr
                //option.data = data + '&neco';
                
                $('.ajaxOverlay', $box.parent()).css('opacity', '0').show().fadeTo(500, 0.5);
                $('.ajaxLoader', $box.parent()).fadeIn();
            },
            success: function(response, $box, $form){
            
                $form.html($(response).html());
                // mazání formuláře po ok hlášce např. pro doporučujeme
                //$form.filter(':has(.ajaxRemove)').clearForm(':hidden, textarea');
                
                // schování formuláře po ok hlášce
                //$('.ajaxRemove', $form).slideUp(400, function(){$(this).remove()});
                $('.ajaxOverlay', $box.parent()).fadeOut();
                $('.ajaxLoader', $box.parent()).fadeOut();
            }
        });

	// THICKBOX ZÁKLADNÍ
	box = new $.pdBox();
    box.control($('.thickbox'));
    box.autoWidth = true;
    
    // THICKBOX FORMULÁŘE
    box2 = new $.pdBox();
    box2.onLoad = function($box){
		$('form', $box)
            .wrap('<div class="ajaxWrap"></div>')
            .after('<div class="ajaxOverlay"></div><div class="ajaxLoader"></div>')
            .pdAjaxForm({
                beforeSend: function($box, $form, data, option){
                    $('.ajaxOverlay', $box.parent()).css('opacity', '0').show().fadeTo(500, 0.5);
                    $('.ajaxLoader', $box.parent()).fadeIn();
                },
                success: function(response, $box, $form){
                    $form.html($(response).html());
                    // mazání formuláře po ok hlášce např. pro doporučujeme
                    //$form.filter(':has(.ajaxRemove)').clearForm(':hidden, textarea');
                    
                    // schování formuláře po ok hlášce
                    $('.ajaxRemove', $form).slideUp(400, function(){$(this).remove()});
                    $('.ajaxOverlay', $box.parent()).fadeOut();
                    $('.ajaxLoader', $box.parent()).fadeOut();
                }
            });
	};
    box2.control($('.thickboxForm')); 
    
    // THICKBOX VIDEO
    box3 = new $.pdBox();
    $('.thickboxVideo').click(function(){
        var href = this.href,
            videoImg = $('img', this).attr('src');
            
        if ( href.search('youtube')!='-1' ) {    
            box3.openHtml('<object type="application/x-shockwave-flash" data="'+href+'" width="400" height="300" ><param name="movie" value="'+href+'" /><param name="quality" value="high" /><param value="transparent" name="wmode"/><param name="swliveconnect" value="true" /><param value="noscale" name="scale"/><param value="http://www.macromedia.com/go/getflashplayer" name="pluginurl"/></object>');
        }
        else{
            box3.openHtml('<object type="application/x-shockwave-flash" data="http://flv-player.net/medias/player_flv_maxi.swf" width="400" height="300"><param name="movie" value="http://flv-player.net/medias/player_flv_maxi.swf" /><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent" /><param name="FlashVars" value="flv='+href+'&amp;startimage='+videoImg+'&amp;width=400&amp;height=300&amp;bgcolor1=444444&amp;bgcolor2=444444&amp;showstop=1&amp;showvolume=1&amp;showplayer=always&amp;autoplay=1&amp;showfullscreen=1&amp;buttoncolor=cccccc&amp;buttonovercolor=ffffff&amp;sliderovercolor=ffffff" /></object>');
        }
        return false;
    });    
    
	box4 = new $.pdBox();
    box4.control($('.thickboxOutfit'));
    box4.width = '770';
    
    // THICKBOX MAPA
	box = new $.pdBox();
    box.control($('.thickbox-map'));
    box.width = 830;
    
    
    $('.outfit-list li').each(function(i){    
        var $this = $(this),
            height = $this.height(),
            width = $this.width(),
            off = $this.position(),
            left = off.left,
            top = off.top,
            midY = top + (height / 2);
            
        if($('.outfit-img .point').eq(i).size())
        {
        
            var $point = $('.outfit-img .point').eq(i),
                pHeight = $point.height(),
                pWidth = $point.width(),
                pOff = $point.position(),
                pLeft = pOff.left,
                pTop = pOff.top,
                pMidX = pLeft + (pWidth / 2),
                pMidY = pTop +(pHeight / 2);
                
            if (pLeft > left)
            {
                left = left + width;
            }
            
            var abs = Math.abs,
                ceil = Math.ceil,
                w = ceil(abs(left - pMidX)),
                // +10 je oprava malé výšky plátna - v ie8 to při malé výšce dělá neplechu 
                h = ceil(abs(pMidY - midY)) + 10,
                x1 = (left < pLeft) ? 0 : w,
                x2 = (left < pLeft) ? w : 0,
                y1 = (midY < pMidY) ? 0 : h - 10,
                y2 = (midY < pMidY) ? h - 10 : 0,
                $wrap = $('.outfit-wrap'),
                $canv = $('<div id="line'+(i+1)+'"></div>')
                    .css({
                        'width': w+'px', 
                        'height': h+'px', 
                        'position': 'absolute', 
                        'top': (pMidY < midY ? pMidY : midY)+'px', 
                        'left': ((left < pLeft ? left : left - w) + 1) + 'px',
                        'overflow':'hidden',
                        'line-height':1
                    })
                    .appendTo($wrap)
                    .jqcanvas(function (canvas, width, height){
                        var ctx = canvas.getContext("2d");
                        ctx.clearRect(0,0,width,height);
                        ctx.fillStyle = 'rgba( 191, 217, 245, 1)';
                        ctx.strokeStyle = 'rgba( 191, 217, 245, 1)';
                        ctx.lineWidth = 1;
                        
                        ctx.beginPath()
                        ctx.moveTo(x1, y1)
                        ctx.lineTo(x2, y2)
                        ctx.closePath()
                        ctx.stroke()
                        ctx.fill();
                    });                        
                //paper = Raphael("line"+(i+1), w, h),
                //c = paper.path('M'+(x1)+' '+(y1)+'L'+(x2)+' '+(y2)).attr({'stroke': "#BFD9F5", 'stroke-width': 1, 'stroke-linecap': 'round'});
	            //console.log(midY, '-', pMidY)
	            //console.log(paper)
        }
    });
    
    // BRAND ROTATOR
    setTimeout(function(){
		$('#home-brand a').pdImageRotator({
			rowTimeOut: 8000,
			imageTimeOut: 0,
			fadeOut: 300,
			fadeIn: 500,
			imagesPath: '/data/imgs/',
			imagesList: logoList
		});	
	}, 4000);
	
	// Cycle
	$('#home-offer .spc').cycle({
		fx: 'fade',
		timeout: 8000
	});
	$('.annot.imgBackground .rote').after('<span class="nav"></span>').cycle({
		fx: 'fade',
		timeout: 1000, 
		pager: '.nav' 
	});
	$('.logo-list p').cycle({
		fx: 'fade',
		timeout: 1000 
	});
	
	// HEADER BOX HOVER
	$('.head-box-js').hover(
		function(){
			$(this).css('z-index', '4');
			$('h2', this).addClass('active').css('z-index', '10');;
			$('.box', this).show().css('z-index', '5');
			Cufon.refresh();
		},
		function(){
			$(this).css('z-index', '2');
			$('h2', this).removeClass('active').css('z-index', '3');;
			$('.box', this).hide().css('z-index', '3');;
			Cufon.refresh();
		}		
	);
	
	// IMGS JS
	$('.imgs-js').each(function(){
		var $this = $(this);		
		$('.list-img a', $this).click(function(){
			$('.list-img a', $this).removeClass('active');
			$(this).addClass('active');
			var ico =  $(this).attr('href').split('m.')[1];
			$('.main-img img', $this).attr('src', $(this).attr('href')).attr('alt', $(this).attr('title'));
			$('.main-img a', $this).attr('href', $(this).attr('href').split('m.'+ico)[0]+'l.'+ico);
			return false;
		});
	});
	
	// VOUCHER COUNT
	$('.voucher-box1').each(function(){
		var $this = $(this);
		if ( $('.int-text', $this).attr('value')>0 && $('.int-text', $this).attr('value')!='' ) {
			$('.total span', $this).text( (parseInt($('.price span', $this).text()) * parseInt($('.int-text', $this).attr('value')) ) + parseInt($('.post span', $this).text()));
		}
		else{
			$('.total span', $this).text('0');	
		}
		$('.int-text', $this).keyup(function(){
			if ( $(this).attr('value')>0 && $(this).attr('value')!='' ) {
				$('.total span', $this).text( (parseInt($('.price span', $this).text()) * parseInt($(this).attr('value')) ) + parseInt($('.post span', $this).text()));
			}
			else{
				$('.total span', $this).text('0');
			}
		});
	});
	
	
	// Open box
    $('.open-box').each(function(){
        var $this = $(this);
        var $chck = $('h2 input', this);
        var attr = $chck.attr('checked')
        var size = 0;
        $('.box :input', $this).each(function(){
            if($(this).is(':text') && $(this).val() != '')
            {
                size++;
            }
            else if($(this).attr('checked'))
            {
                size++;
            }
        });
        if(attr || size != 0)
        {
            $chck.attr('checked', true);
            $this.data('status', true);
        }
        else
        {
            $('.box', this).hide();
            $this.data('status', false);
        }
        $('h2 input', $this).click(function(){
            if($this.data('status'))
            {
                $chck.attr('checked', false);
                $('.box', $this).slideUp('fast');
                $this.data('status', false);
            }
            else
            {
                $chck.attr('checked', true);
                $('.box', $this).slideDown('fast');
                $this.data('status', true);
            }
        });
    });
    
    // VOUCHER CLICK
    $('.voucher-box').each(function(){
		var $this = $(this);
		$('.voucher-menu .clickNext a', $this).click(function(){
			return false;
		});
		$('.voucher-menu .clickBack a', $this).click(function(){
			$('.btn .l .inline-btn input', $this).trigger('click');
			return false;
		});
	});
	
	
	// HOME MOTIVE
	$('#motive .plus').each(function(){
		var $this = $(this);
		
		$this.hide();
		
		setTimeout(function(){
			$this.fadeIn('slow');
			$('.tag', $this).show();
			var pHeight = $('p', $this).height()+20;
			$('.tag', $this)
				.css({
					'width': '0',
					'height': '0'
				});
			$this.hover(
				function(){
					$('.tag', $this)
						.show()
						.css({
							'width': '0',
							'height': '0'
						})
						.animate({
							'width': '179px',
							'height': pHeight+'px'
						}, 250);
					$this.addClass('open');
				},
				function(){
					$('.tag').fadeOut('fast');
					$this.removeClass('open');
				}
			);
		}, 1000);
		
	});
	
	
	$('.wysiwyg tbody tr:even').addClass('even');
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
});
