// usage: log('inside coolFunc', this, arguments);
window.log = function(){
	log.history = log.history || [];   // store logs to an array for reference
	log.history.push(arguments);
	arguments.callee = arguments.callee.caller;  
	if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info, log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});

/*
 * Placeholder label in ie
 * <input placeholder="Szukaj..." />
 * https://github.com/AbleTech/jquery.placeholder-label
 * Copyright (c) 2010 Able Technology Consulting Limited
 * http://www.abletech.co.nz/
 */
(function(a){a.placeholderLabel={placeholder_class:null,add_placeholder:function(){if(a(this).val()==a(this).attr("placeholder")){a(this).val("").removeClass(a.placeholderLabel.placeholder_class)}},remove_placeholder:function(){if(a(this).val()==""){a(this).val(a(this).attr("placeholder")).addClass(a.placeholderLabel.placeholder_class)}},disable_placeholder_fields:function(){a(this).find("input[placeholder]").each(function(){if(a(this).val()==a(this).attr("placeholder")){a(this).val("")}});return true}};a.fn.placeholderLabel=function(b){var c=document.createElement("input");if(c.placeholder!=undefined){return this}var d={placeholder_class:"placeholder"};if(b)a.extend(d,b);a.placeholderLabel.placeholder_class=d.placeholder_class;this.each(function(){var b=a(this);b.focus(a.placeholderLabel.add_placeholder);b.blur(a.placeholderLabel.remove_placeholder);b.triggerHandler("focus");b.triggerHandler("blur");a(this.form).submit(a.placeholderLabel.disable_placeholder_fields)});return this}})(jQuery);

/*
 * jQuery Tooltip plugin 1.3
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 */
(function(a){function o(d){function h(){b.parent.removeClass(g.extraClass).hide().css("opacity","")}if(a.tooltip.blocked)return;if(e)clearTimeout(e);c=null;var g=i(this);if((!f||!a.fn.bgiframe)&&g.fade){if(b.parent.is(":animated"))b.parent.stop().fadeTo(g.fade,0,h);else b.parent.stop().fadeOut(g.fade,h)}else h();if(i(this).fixPNG)b.parent.unfixPNG()}function n(){return{x:a(window).scrollLeft(),y:a(window).scrollTop(),cx:a(window).width(),cy:a(window).height()}}function m(d){if(a.tooltip.blocked)return;if(d&&d.target.tagName=="OPTION"){return}if(!g&&b.parent.is(":visible")){a(document.body).unbind("mousemove",m)}if(c==null){a(document.body).unbind("mousemove",m);return}b.parent.removeClass("viewport-right").removeClass("viewport-bottom");var e=b.parent[0].offsetLeft;var f=b.parent[0].offsetTop;if(d){e=d.pageX+i(c).left;f=d.pageY+i(c).top;var h="auto";if(i(c).positionLeft){h=a(window).width()-e;e="auto"}b.parent.css({left:e,right:h,top:f})}var j=n(),k=b.parent[0];if(j.x+j.cx<k.offsetLeft+k.offsetWidth){e-=k.offsetWidth+20+i(c).left;b.parent.css({left:e+"px"}).addClass("viewport-right")}if(j.y+j.cy<k.offsetTop+k.offsetHeight){f-=k.offsetHeight+20+i(c).top;b.parent.css({top:f+"px"}).addClass("viewport-bottom")}}function l(){e=null;if((!f||!a.fn.bgiframe)&&i(c).fade){if(b.parent.is(":animated"))b.parent.stop().show().fadeTo(i(c).fade,c.tOpacity);else b.parent.is(":visible")?b.parent.fadeTo(i(c).fade,c.tOpacity):b.parent.fadeIn(i(c).fade)}else{b.parent.show()}m()}function k(){if(a.tooltip.blocked||this==c||!this.tooltipText&&!i(this).bodyHandler)return;c=this;d=this.tooltipText;if(i(this).bodyHandler){b.title.hide();var e=i(this).bodyHandler.call(this);if(e.nodeType||e.jquery){b.body.empty().append(e)}else{b.body.html(e)}b.body.show()}else if(i(this).showBody){var f=d.split(i(this).showBody);b.title.html(f.shift()).show();b.body.empty();for(var g=0,h;h=f[g];g++){if(g>0)b.body.append("<br/>");b.body.append(h)}b.body.hideWhenEmpty()}else{b.title.html(d).show();b.body.hide()}if(i(this).showURL&&a(this).url())b.url.html(a(this).url().replace("http://","")).show();else b.url.hide();b.parent.addClass(i(this).extraClass);if(i(this).fixPNG)b.parent.fixPNG();j.apply(this,arguments)}function j(b){if(i(this).delay)e=setTimeout(l,i(this).delay);else l();g=!!i(this).track;a(document.body).bind("mousemove",m);m(b)}function i(b){return a.data(b,"tooltip")}function h(c){if(b.parent)return;b.parent=a('<div id="'+c.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if(a.fn.bgiframe)b.parent.bgiframe();b.title=a("h3",b.parent);b.body=a("div.body",b.parent);b.url=a("div.url",b.parent)}var b={},c,d,e,f=a.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),g=false;a.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){a.tooltip.blocked=!a.tooltip.blocked}};a.fn.extend({tooltip:function(c){c=a.extend({},a.tooltip.defaults,c);h(c);return this.each(function(){a.data(this,"tooltip",c);this.tOpacity=b.parent.css("opacity");this.tooltipText=this.title;a(this).removeAttr("title");this.alt=""}).mouseover(k).mouseout(o).click(o)},fixPNG:f?function(){return this.each(function(){var b=a(this).css("backgroundImage");if(b.match(/^url\(["']?(.*\.png)["']?\)$/i)){b=RegExp.$1;a(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+b+"')"}).each(function(){var b=a(this).css("position");if(b!="absolute"&&b!="relative")a(this).css("position","relative")})}})}:function(){return this},unfixPNG:f?function(){return this.each(function(){a(this).css({filter:"",backgroundImage:""})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){a(this)[a(this).html()?"show":"hide"]()})},url:function(){return this.attr("href")||this.attr("src")}})})(jQuery);
/*
 * .disableTextSelect - Disable Text Select Plugin
 * Version: 1.1
 * Updated: 2007-11-28
 * Copyright (c) 2007 James Dempster (letssurf@gmail.com, http://www.jdempster.com/category/jquery/disabletextselect/)
 * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
 */
(function($){if($.browser.mozilla){$.fn.disableTextSelect=function(){return this.each(function(){$(this).css({"MozUserSelect":"none"})})};$.fn.enableTextSelect=function(){return this.each(function(){$(this).css({"MozUserSelect":""})})}}else{if($.browser.msie){$.fn.disableTextSelect=function(){return this.each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})})};$.fn.enableTextSelect=function(){return this.each(function(){$(this).unbind("selectstart.disableTextSelect")})}}else{$.fn.disableTextSelect=function(){return this.each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})})};$.fn.enableTextSelect=function(){return this.each(function(){$(this).unbind("mousedown.disableTextSelect")})}}}})(jQuery);

/*
 * FancyBox - jQuery Plugin
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * Version: 1.3.4 (11/11/2010)
 */
(function(a){var b,c,d,e,f,g,h,i,j,k,l=0,m={},n=[],o=0,p={},q=[],r=null,s=new Image,t=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,u=/[^\.]\.(swf)\s*$/i,v,w=1,x=0,y="",z,A,B=false,C=a.extend(a("<div/>")[0],{prop:0}),D=a.browser.msie&&a.browser.version<7&&!window.XMLHttpRequest,E=function(){c.hide();s.onerror=s.onload=null;r&&r.abort();b.empty()},F=function(){if(false===m.onError(n,l,m)){c.hide();B=false}else{m.titleShow=false;m.width="auto";m.height="auto";b.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');H()}},G=function(){var d=n[l],e,f,h,i,j,k;E();m=a.extend({},a.fn.fancybox.defaults,typeof a(d).data("fancybox")=="undefined"?m:a(d).data("fancybox"));k=m.onStart(n,l,m);if(k===false)B=false;else{if(typeof k=="object")m=a.extend(m,k);h=m.title||(d.nodeName?a(d).attr("title"):d.title)||"";if(d.nodeName&&!m.orig)m.orig=a(d).children("img:first").length?a(d).children("img:first"):a(d);if(h===""&&m.orig&&m.titleFromAlt)h=m.orig.attr("alt");e=m.href||(d.nodeName?a(d).attr("href"):d.href)||null;if(/^(?:javascript)/i.test(e)||e=="#")e=null;if(m.type){f=m.type;if(!e)e=m.content}else if(m.content)f="html";else if(e)f=e.match(t)?"image":e.match(u)?"swf":a(d).hasClass("iframe")?"iframe":e.indexOf("#")===0?"inline":"ajax";if(f){if(f=="inline"){d=e.substr(e.indexOf("#"));f=a(d).length>0?"inline":"ajax"}m.type=f;m.href=e;m.title=h;if(m.autoDimensions)if(m.type=="html"||m.type=="inline"||m.type=="ajax"){m.width="auto";m.height="auto"}else m.autoDimensions=false;if(m.modal){m.overlayShow=true;m.hideOnOverlayClick=false;m.hideOnContentClick=false;m.enableEscapeButton=false;m.showCloseButton=false}m.padding=parseInt(m.padding,10);m.margin=parseInt(m.margin,10);b.css("padding",m.padding+m.margin);a(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){a(this).replaceWith(g.children())});switch(f){case"html":b.html(m.content);H();break;case"inline":if(a(d).parent().is("#fancybox-content")===true){B=false;break}a('<div class="fancybox-inline-tmp" />').hide().insertBefore(a(d)).bind("fancybox-cleanup",function(){a(this).replaceWith(g.children())}).bind("fancybox-cancel",function(){a(this).replaceWith(b.children())});a(d).appendTo(b);H();break;case"image":B=false;a.fancybox.showActivity();s=new Image;s.onerror=function(){F()};s.onload=function(){B=true;s.onerror=s.onload=null;m.width=s.width;m.height=s.height;a("<img />").attr({id:"fancybox-img",src:s.src,alt:m.title}).appendTo(b);I()};s.src=e;break;case"swf":m.scrolling="no";i='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+m.width+'" height="'+m.height+'"><param name="movie" value="'+e+'"></param>';j="";a.each(m.swf,function(a,b){i+='<param name="'+a+'" value="'+b+'"></param>';j+=" "+a+'="'+b+'"'});i+='<embed src="'+e+'" type="application/x-shockwave-flash" width="'+m.width+'" height="'+m.height+'"'+j+"></embed></object>";b.html(i);H();break;case"ajax":B=false;a.fancybox.showActivity();m.ajax.win=m.ajax.success;r=a.ajax(a.extend({},m.ajax,{url:e,data:m.ajax.data||{},error:function(a){a.status>0&&F()},success:function(a,d,f){if((typeof f=="object"?f:r).status==200){if(typeof m.ajax.win=="function"){k=m.ajax.win(e,a,d,f);if(k===false){c.hide();return}else if(typeof k=="string"||typeof k=="object")a=k}b.html(a);H()}}}));break;case"iframe":I()}}else F()}},H=function(){var c=m.width,d=m.height;c=c.toString().indexOf("%")>-1?parseInt((a(window).width()-m.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";d=d.toString().indexOf("%")>-1?parseInt((a(window).height()-m.margin*2)*parseFloat(d)/100,10)+"px":d=="auto"?"auto":d+"px";b.wrapInner('<div style="width:'+c+";height:"+d+";overflow: "+(m.scrolling=="auto"?"auto":m.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');m.width=b.width();m.height=b.height();I()},I=function(){var r,s;c.hide();if(e.is(":visible")&&false===p.onCleanup(q,o,p)){a.event.trigger("fancybox-cancel");B=false}else{B=true;a(g.add(d)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");e.is(":visible")&&p.titlePosition!=="outside"&&e.css("height",e.height());q=n;o=l;p=m;if(p.overlayShow){d.css({"background-color":p.overlayColor,opacity:p.overlayOpacity,cursor:p.hideOnOverlayClick?"pointer":"auto",height:a(document).height()});if(!d.is(":visible")){D&&a("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});d.show()}}else d.hide();A=N();y=p.title||"";x=0;i.empty().removeAttr("style").removeClass();if(p.titleShow!==false){if(a.isFunction(p.titleFormat))r=p.titleFormat(y,q,o,p);else r=y&&y.length?p.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+y+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+p.titlePosition+'">'+y+"</div>":false;y=r;if(!(!y||y==="")){i.addClass("fancybox-title-"+p.titlePosition).html(y).appendTo("body").show();switch(p.titlePosition){case"inside":i.css({width:A.width-p.padding*2,marginLeft:p.padding,marginRight:p.padding});x=i.outerHeight(true);i.appendTo(f);A.height+=x;break;case"over":i.css({marginLeft:p.padding,width:A.width-p.padding*2,bottom:p.padding}).appendTo(f);break;case"float":i.css("left",parseInt((i.width()-A.width-40)/2,10)*-1).appendTo(e);break;default:i.css({width:A.width-p.padding*2,paddingLeft:p.padding,paddingRight:p.padding}).appendTo(e)}}}i.hide();if(e.is(":visible")){a(h.add(j).add(k)).hide();r=e.position();z={top:r.top,left:r.left,width:e.width(),height:e.height()};s=z.width==A.width&&z.height==A.height;g.fadeTo(p.changeFade,.3,function(){var c=function(){g.html(b.contents()).fadeTo(p.changeFade,1,K)};a.event.trigger("fancybox-change");g.empty().removeAttr("filter").css({"border-width":p.padding,width:A.width-p.padding*2,height:m.autoDimensions?"auto":A.height-x-p.padding*2});if(s)c();else{C.prop=0;a(C).animate({prop:1},{duration:p.changeSpeed,easing:p.easingChange,step:L,complete:c})}})}else{e.removeAttr("style");g.css("border-width",p.padding);if(p.transitionIn=="elastic"){z=O();g.html(b.contents());e.show();if(p.opacity)A.opacity=0;C.prop=0;a(C).animate({prop:1},{duration:p.speedIn,easing:p.easingIn,step:L,complete:K})}else{p.titlePosition=="inside"&&x>0&&i.show();g.css({width:A.width-p.padding*2,height:m.autoDimensions?"auto":A.height-x-p.padding*2}).html(b.contents());e.css(A).fadeIn(p.transitionIn=="none"?0:p.speedIn,K)}}}},J=function(){if(p.enableEscapeButton||p.enableKeyboardNav)a(document).bind("keydown.fb",function(b){if(b.keyCode==27&&p.enableEscapeButton){b.preventDefault();a.fancybox.close()}else if((b.keyCode==37||b.keyCode==39)&&p.enableKeyboardNav&&b.target.tagName!=="INPUT"&&b.target.tagName!=="TEXTAREA"&&b.target.tagName!=="SELECT"){b.preventDefault();a.fancybox[b.keyCode==37?"prev":"next"]()}});if(p.showNavArrows){if(p.cyclic&&q.length>1||o!==0)j.show();if(p.cyclic&&q.length>1||o!=q.length-1)k.show()}else{j.hide();k.hide()}},K=function(){if(!a.support.opacity){g.get(0).style.removeAttribute("filter");e.get(0).style.removeAttribute("filter")}m.autoDimensions&&g.css("height","auto");e.css("height","auto");y&&y.length&&i.show();p.showCloseButton&&h.show();J();p.hideOnContentClick&&g.bind("click",a.fancybox.close);p.hideOnOverlayClick&&d.bind("click",a.fancybox.close);a(window).bind("resize.fb",a.fancybox.resize);p.centerOnScroll&&a(window).bind("scroll.fb",a.fancybox.center);if(p.type=="iframe")a('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(a.browser.msie?'allowtransparency="true""':"")+' scrolling="'+m.scrolling+'" src="'+p.href+'"></iframe>').appendTo(g);e.show();B=false;a.fancybox.center();p.onComplete(q,o,p);var b,c;if(q.length-1>o){b=q[o+1].href;if(typeof b!=="undefined"&&b.match(t)){c=new Image;c.src=b}}if(o>0){b=q[o-1].href;if(typeof b!=="undefined"&&b.match(t)){c=new Image;c.src=b}}},L=function(a){var b={width:parseInt(z.width+(A.width-z.width)*a,10),height:parseInt(z.height+(A.height-z.height)*a,10),top:parseInt(z.top+(A.top-z.top)*a,10),left:parseInt(z.left+(A.left-z.left)*a,10)};if(typeof A.opacity!=="undefined")b.opacity=a<.5?.5:a;e.css(b);g.css({width:b.width-p.padding*2,height:b.height-x*a-p.padding*2})},M=function(){return[a(window).width()-p.margin*2,a(window).height()-p.margin*2,a(document).scrollLeft()+p.margin,a(document).scrollTop()+p.margin]},N=function(){var a=M(),b={},c=p.autoScale,d=p.padding*2;b.width=p.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(p.width)/100,10):p.width+d;b.height=p.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(p.height)/100,10):p.height+d;if(c&&(b.width>a[0]||b.height>a[1]))if(m.type=="image"||m.type=="swf"){c=p.width/p.height;if(b.width>a[0]){b.width=a[0];b.height=parseInt((b.width-d)/c+d,10)}if(b.height>a[1]){b.height=a[1];b.width=parseInt((b.height-d)*c+d,10)}}else{b.width=Math.min(b.width,a[0]);b.height=Math.min(b.height,a[1])}b.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-b.height-40)*.5),10);b.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-b.width-40)*.5),10);return b},O=function(){var b=m.orig?a(m.orig):false,c={};if(b&&b.length){c=b.offset();c.top+=parseInt(b.css("paddingTop"),10)||0;c.left+=parseInt(b.css("paddingLeft"),10)||0;c.top+=parseInt(b.css("border-top-width"),10)||0;c.left+=parseInt(b.css("border-left-width"),10)||0;c.width=b.width();c.height=b.height();c={width:c.width+p.padding*2,height:c.height+p.padding*2,top:c.top-p.padding-20,left:c.left-p.padding-20}}else{b=M();c={width:p.padding*2,height:p.padding*2,top:parseInt(b[3]+b[1]*.5,10),left:parseInt(b[2]+b[0]*.5,10)}}return c},P=function(){if(c.is(":visible")){a("div",c).css("top",w*-40+"px");w=(w+1)%12}else clearInterval(v)};a.fn.fancybox=function(b){if(!a(this).length)return this;a(this).data("fancybox",a.extend({},b,a.metadata?a(this).metadata():{})).unbind("click.fb").bind("click.fb",function(b){b.preventDefault();if(!B){B=true;a(this).blur();n=[];l=0;b=a(this).attr("rel")||"";if(!b||b==""||b==="nofollow")n.push(this);else{n=a("a[rel="+b+"], area[rel="+b+"]");l=n.index(this)}G()}});return this};a.fancybox=function(b,c){var d;if(!B){B=true;d=typeof c!=="undefined"?c:{};n=[];l=parseInt(d.index,10)||0;if(a.isArray(b)){for(var e=0,f=b.length;e<f;e++)if(typeof b[e]=="object")a(b[e]).data("fancybox",a.extend({},d,b[e]));else b[e]=a({}).data("fancybox",a.extend({content:b[e]},d));n=jQuery.merge(n,b)}else{if(typeof b=="object")a(b).data("fancybox",a.extend({},d,b));else b=a({}).data("fancybox",a.extend({content:b},d));n.push(b)}if(l>n.length||l<0)l=0;G()}};a.fancybox.showActivity=function(){clearInterval(v);c.show();v=setInterval(P,66)};a.fancybox.hideActivity=function(){c.hide()};a.fancybox.next=function(){return a.fancybox.pos(o+1)};a.fancybox.prev=function(){return a.fancybox.pos(o-1)};a.fancybox.pos=function(a){if(!B){a=parseInt(a);n=q;if(a>-1&&a<q.length){l=a;G()}else if(p.cyclic&&q.length>1){l=a>=q.length?0:q.length-1;G()}}};a.fancybox.cancel=function(){if(!B){B=true;a.event.trigger("fancybox-cancel");E();m.onCancel(n,l,m);B=false}};a.fancybox.close=function(){function b(){d.fadeOut("fast");i.empty().hide();e.hide();a.event.trigger("fancybox-cleanup");g.empty();p.onClosed(q,o,p);q=m=[];o=l=0;p=m={};B=false}if(!(B||e.is(":hidden"))){B=true;if(p&&false===p.onCleanup(q,o,p))B=false;else{E();a(h.add(j).add(k)).hide();a(g.add(d)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");g.find("iframe").attr("src",D&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");p.titlePosition!=="inside"&&i.empty();e.stop();if(p.transitionOut=="elastic"){z=O();var c=e.position();A={top:c.top,left:c.left,width:e.width(),height:e.height()};if(p.opacity)A.opacity=1;i.empty().hide();C.prop=1;a(C).animate({prop:0},{duration:p.speedOut,easing:p.easingOut,step:L,complete:b})}else e.fadeOut(p.transitionOut=="none"?0:p.speedOut,b)}}};a.fancybox.resize=function(){d.is(":visible")&&d.css("height",a(document).height());a.fancybox.center(true)};a.fancybox.center=function(a){var b,c;if(!B){c=a===true?1:0;b=M();!c&&(e.width()>b[0]||e.height()>b[1])||e.stop().animate({top:parseInt(Math.max(b[3]-20,b[3]+(b[1]-g.height()-40)*.5-p.padding)),left:parseInt(Math.max(b[2]-20,b[2]+(b[0]-g.width()-40)*.5-p.padding))},typeof a=="number"?a:200)}};a.fancybox.init=function(){if(!a("#fancybox-wrap").length){a("body").append(b=a('<div id="fancybox-tmp"></div>'),c=a('<div id="fancybox-loading"><div></div></div>'),d=a('<div id="fancybox-overlay"></div>'),e=a('<div id="fancybox-wrap"></div>'));f=a('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(e);f.append(g=a('<div id="fancybox-content"></div>'),h=a('<a id="fancybox-close"></a>'),i=a('<div id="fancybox-title"></div>'),j=a('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),k=a('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));h.click(a.fancybox.close);c.click(a.fancybox.cancel);j.click(function(b){b.preventDefault();a.fancybox.prev()});k.click(function(b){b.preventDefault();a.fancybox.next()});a.fn.mousewheel&&e.bind("mousewheel.fb",function(b,c){if(B)b.preventDefault();else if(a(b.target).get(0).clientHeight==0||a(b.target).get(0).scrollHeight===a(b.target).get(0).clientHeight){b.preventDefault();a.fancybox[c>0?"prev":"next"]()}});a.support.opacity||e.addClass("fancybox-ie");if(D){c.addClass("fancybox-ie6");e.addClass("fancybox-ie6");a('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(f)}}};a.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};a(document).ready(function(){a.fancybox.init()})})(jQuery);


/*
 * Effect - FadeOut with SlideUp
 */
jQuery.fn.fadeSlideToggle = function(speed, easing, callback) {
  if (this.is(":hidden")) {
    return this.slideDown(speed, easing).fadeTo(speed, 1, easing, callback);
  } else {
    return this.fadeTo(speed, 0, easing).slideUp(speed, easing, callback);
  }
};


/*
 jQuery Tools Validator 1.2.6 - HTML5 is here. Now use it.

 NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

 http://flowplayer.org/tools/form/validator/

 Since: Mar 2010
 Date:    Wed Sep 22 06:02:10 2010 +0000 
*/
/*
 jQuery Tools Validator 1.2.5 - HTML5 is here. Now use it.

 NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

 http://flowplayer.org/tools/form/validator/

 Since: Mar 2010
 Date:    Wed Sep 22 06:02:10 2010 +0000 
*/
(function(e){function t(a,b,c){var k=a.offset().top,f=a.offset().left,l=c.position.split(/,?\s+/),p=l[0];l=l[1];k-=b.outerHeight()-c.offset[0];f+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))k-=e(window).scrollTop();c=b.outerHeight()+a.outerHeight();if(p=="center")k+=c/2;if(p=="bottom")k+=c;a=a.outerWidth();if(l=="center")f-=(a+b.outerWidth())/2;if(l=="left")f-=a;return{top:k,left:f}}function y(a){function b(){return this.getAttribute("type")==a}b.key="[type="+a+"]";return b}function u(a,
b,c){function k(g,d,i){if(!(!c.grouped&&g.length)){var j;if(i===false||e.isArray(i)){j=h.messages[d.key||d]||h.messages["*"];j=j[c.lang]||h.messages["*"].en;(d=j.match(/\$\d/g))&&e.isArray(i)&&e.each(d,function(m){j=j.replace(this,i[m])})}else j=i[c.lang]||i;g.push(j)}}var f=this,l=b.add(f);a=a.not(":button, :image, :reset, :submit");e.extend(f,{getConf:function(){return c},getForm:function(){return b},getInputs:function(){return a},reflow:function(){a.each(function(){var g=e(this),d=g.data("msg.el");
if(d){g=t(g,d,c);d.css({top:g.top,left:g.left})}});return f},invalidate:function(g,d){if(!d){var i=[];e.each(g,function(j,m){j=a.filter("[name='"+j+"']");if(j.length){j.trigger("OI",[m]);i.push({input:j,messages:[m]})}});g=i;d=e.Event()}d.type="onFail";l.trigger(d,[g]);d.isDefaultPrevented()||q[c.effect][0].call(f,g,d);return f},reset:function(g){g=g||a;g.removeClass(c.errorClass).each(function(){var d=e(this).data("msg.el");if(d){d.remove();e(this).data("msg.el",null)}}).unbind(c.errorInputEvent||
"");return f},destroy:function(){b.unbind(c.formEvent+".V").unbind("reset.V");a.unbind(c.inputEvent+".V").unbind("change.V");return f.reset()},checkValidity:function(g,d){g=g||a;g=g.not(":disabled");if(!g.length)return true;d=d||e.Event();d.type="onBeforeValidate";l.trigger(d,[g]);if(d.isDefaultPrevented())return d.result;var i=[];g.not(":radio:not(:checked)").each(function(){var m=[],n=e(this).data("messages",m),v=r&&n.is(":date")?"onHide.v":c.errorInputEvent+".v";n.unbind(v);e.each(w,function(){var o=
this,s=o[0];if(n.filter(s).length){o=o[1].call(f,n,n.val());if(o!==true){d.type="onBeforeFail";l.trigger(d,[n,s]);if(d.isDefaultPrevented())return false;var x=n.attr(c.messageAttr);if(x){m=[x];return false}else k(m,s,o)}}});if(m.length){i.push({input:n,messages:m});n.trigger("OI",[m]);c.errorInputEvent&&n.bind(v,function(o){f.checkValidity(n,o)})}if(c.singleError&&i.length)return false});var j=q[c.effect];if(!j)throw'Validator: cannot find effect "'+c.effect+'"';if(i.length){f.invalidate(i,d);return false}else{j[1].call(f,
g,d);d.type="onSuccess";l.trigger(d,[g]);g.unbind(c.errorInputEvent+".v")}return true}});e.each("onBeforeValidate,onBeforeFail,onFail,onSuccess".split(","),function(g,d){e.isFunction(c[d])&&e(f).bind(d,c[d]);f[d]=function(i){i&&e(f).bind(d,i);return f}});c.formEvent&&b.bind(c.formEvent+".V",function(g){if(!f.checkValidity(null,g))return g.preventDefault()});b.bind("reset.V",function(){f.reset()});a[0]&&a[0].validity&&a.each(function(){this.oninvalid=function(){return false}});if(b[0])b[0].checkValidity=
f.checkValidity;c.inputEvent&&a.bind(c.inputEvent+".V",function(g){f.checkValidity(e(this),g)});a.filter(":checkbox, select").filter("[required]").bind("change.V",function(g){var d=e(this);if(this.checked||d.is("select")&&e(this).val())q[c.effect][1].call(f,d,g)});var p=a.filter(":radio").change(function(g){f.checkValidity(p,g)});e(window).resize(function(){f.reflow()})}e.tools=e.tools||{version:"1.2.5"};var z=/\[type=([a-z]+)\]/,A=/^-?[0-9]*(\.[0-9]+)?$/,r=e.tools.dateinput,B=/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i,
C=/^(https?:\/\/)?[\da-z\.\-]+\.[a-z\.]{2,6}[#&+_\?\/\w \.\-=]*$/i,h;h=e.tools.validator={conf:{grouped:false,effect:"default",errorClass:"invalid",inputEvent:null,errorInputEvent:"keyup",formEvent:"submit",lang:"en",message:"<div/>",messageAttr:"data-message",messageClass:"error",offset:[0,0],position:"center right",singleError:false,speed:"normal"},messages:{"*":{en:"Please correct this value"}},localize:function(a,b){e.each(b,function(c,k){h.messages[c]=h.messages[c]||{};h.messages[c][a]=k})},
localizeFn:function(a,b){h.messages[a]=h.messages[a]||{};e.extend(h.messages[a],b)},fn:function(a,b,c){if(e.isFunction(b))c=b;else{if(typeof b=="string")b={en:b};this.messages[a.key||a]=b}if(b=z.exec(a))a=y(b[1]);w.push([a,c])},addEffect:function(a,b,c){q[a]=[b,c]}};var w=[],q={"default":[function(a){var b=this.getConf();e.each(a,function(c,k){c=k.input;c.addClass(b.errorClass);var f=c.data("msg.el");if(!f){f=e(b.message).addClass(b.messageClass).appendTo(document.body);c.data("msg.el",f)}f.css({visibility:"hidden"}).find("p").remove();
e.each(k.messages,function(l,p){e("<p/>").html(p).appendTo(f)});f.outerWidth()==f.parent().width()&&f.add(f.find("p")).css({display:"inline"});k=t(c,f,b);f.css({visibility:"visible",position:"absolute",top:k.top,left:k.left}).fadeIn(b.speed)})},function(a){var b=this.getConf();a.removeClass(b.errorClass).each(function(){var c=e(this).data("msg.el");c&&c.css({visibility:"hidden"})})}]};e.each("email,url,number".split(","),function(a,b){e.expr[":"][b]=function(c){return c.getAttribute("type")===b}});
e.fn.oninvalid=function(a){return this[a?"bind":"trigger"]("OI",a)};h.fn(":email","Please enter a valid email address",function(a,b){return!b||B.test(b)});h.fn(":url","Please enter a valid URL",function(a,b){return!b||C.test(b)});h.fn(":number","Please enter a numeric value.",function(a,b){return A.test(b)});h.fn("[max]","Please enter a value smaller than $1",function(a,b){if(b===""||r&&a.is(":date"))return true;a=a.attr("max");return parseFloat(b)<=parseFloat(a)?true:[a]});h.fn("[min]","Please enter a value larger than $1",
function(a,b){if(b===""||r&&a.is(":date"))return true;a=a.attr("min");return parseFloat(b)>=parseFloat(a)?true:[a]});h.fn("[required]","Please complete this mandatory field.",function(a,b){if(a.is(":checkbox"))return a.is(":checked");return!!b});h.fn("[pattern]",function(a){var b=new RegExp("^"+a.attr("pattern")+"$");return b.test(a.val())});e.fn.validator=function(a){var b=this.data("validator");if(b){b.destroy();this.removeData("validator")}a=e.extend(true,{},h.conf,a);if(this.is("form"))return this.each(function(){var c=
e(this);b=new u(c.find(":input"),c,a);c.data("validator",b)});else{b=new u(this,this.eq(0).closest("form"),a);return this.data("validator",b)}}})(jQuery);
$.tools.validator.fn("[data-equals]", "Value not equal with the $1 field", function(input) {
	var name = input.data("equals"),
		 field = this.getInputs().filter("[name=" + name + "]"); 
	return input.val() == field.val() ? true : [field.data('name')?field.data('name'):name]; 
});

$.tools.validator.localize("pl", {
	'*'			: 'Niepoprawna wartość',
	':email'  	: 'Błędny adres e-mail',
	':number' 	: 'Wartość musi być liczbą',
	':url' 		: 'Niepoprawny adres',
	'[max]'	 	: 'Maksymalna wartość to $1',
	'[min]'		: 'Minimala wartość to $1',
	'[required]': 'Pole wymagane',
	'[data-equals]': 'Wartość nie jest taka sama jak pole $1'
});

/*
 * Format numbers
 * 5220.53.toMonay() -> 5 220,53
 */
Number.prototype.toMoney = function(decimals, decimal_sep, thousands_sep)
{ 
   var n = this,
   c = isNaN(decimals) ? 2 : Math.abs(decimals),
   d = decimal_sep || ',',
   t = (typeof thousands_sep === 'undefined') ? ' ' : thousands_sep,
   sign = (n < 0) ? '-' : '',
   i = parseInt(n = Math.abs(n).toFixed(c)) + '', 
   j = ((j = i.length) > 3) ? j % 3 : 0; 
   return sign + (j ? i.substr(0, j) + t : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ''); 
};
/*
* jQuery jclock - Clock plugin - v 2.3.2
* http://plugins.jquery.com/project/jclock
*
* Copyright (c) 2007-2011 Doug Sparling <http://www.dougsparling.com>
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
 
  $.fn.jclock = function(options) {
    var version = '2.3.2';
 
    // options
    var opts = $.extend({}, $.fn.jclock.defaults, options);
         
    return this.each(function() {
      $this = $(this);
      $this.timerID = null;
      $this.running = false;
 
      // Record keeping for seeded clock
      $this.increment = 0;
      $this.lastCalled = new Date().getTime();
 
      var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
 
      $this.format = o.format;
      $this.utc = o.utc;
      // deprecate utc_offset (v 2.2.0)
      $this.utcOffset = (o.utc_offset != null) ? o.utc_offset : o.utcOffset;
      $this.seedTime = o.seedTime;
      $this.timeout = o.timeout;
 
      $this.css({
        fontFamily: o.fontFamily,
        fontSize: o.fontSize,
        backgroundColor: o.background,
        color: o.foreground
      });
 
      // %a
      $this.daysAbbrvNames = new Array(7);
      $this.daysAbbrvNames[0] = "Sun";
      $this.daysAbbrvNames[1] = "Mon";
      $this.daysAbbrvNames[2] = "Tue";
      $this.daysAbbrvNames[3] = "Wed";
      $this.daysAbbrvNames[4] = "Thu";
      $this.daysAbbrvNames[5] = "Fri";
      $this.daysAbbrvNames[6] = "Sat";
 
      // %A
      $this.daysFullNames = new Array(7);
      $this.daysFullNames[0] = "Sunday";
      $this.daysFullNames[1] = "Monday";
      $this.daysFullNames[2] = "Tuesday";
      $this.daysFullNames[3] = "Wednesday";
      $this.daysFullNames[4] = "Thursday";
      $this.daysFullNames[5] = "Friday";
      $this.daysFullNames[6] = "Saturday";
 
      // %b
      $this.monthsAbbrvNames = new Array(12);
      $this.monthsAbbrvNames[0] = "Jan";
      $this.monthsAbbrvNames[1] = "Feb";
      $this.monthsAbbrvNames[2] = "Mar";
      $this.monthsAbbrvNames[3] = "Apr";
      $this.monthsAbbrvNames[4] = "May";
      $this.monthsAbbrvNames[5] = "Jun";
      $this.monthsAbbrvNames[6] = "Jul";
      $this.monthsAbbrvNames[7] = "Aug";
      $this.monthsAbbrvNames[8] = "Sep";
      $this.monthsAbbrvNames[9] = "Oct";
      $this.monthsAbbrvNames[10] = "Nov";
      $this.monthsAbbrvNames[11] = "Dec";
 
      // %B
      $this.monthsFullNames = new Array(12);
      $this.monthsFullNames[0] = "January";
      $this.monthsFullNames[1] = "February";
      $this.monthsFullNames[2] = "March";
      $this.monthsFullNames[3] = "April";
      $this.monthsFullNames[4] = "May";
      $this.monthsFullNames[5] = "June";
      $this.monthsFullNames[6] = "July";
      $this.monthsFullNames[7] = "August";
      $this.monthsFullNames[8] = "September";
      $this.monthsFullNames[9] = "October";
      $this.monthsFullNames[10] = "November";
      $this.monthsFullNames[11] = "December";
 
      $.fn.jclock.startClock($this);
 
    });
  };
       
  $.fn.jclock.startClock = function(el) {
    $.fn.jclock.stopClock(el);
    $.fn.jclock.displayTime(el);
  }
 
  $.fn.jclock.stopClock = function(el) {
    if(el.running) {
      clearTimeout(el.timerID);
    }
    el.running = false;
  }
 
  $.fn.jclock.displayTime = function(el) {
    var time = $.fn.jclock.currentTime(el);
    var formatted_time = $.fn.jclock.formatTime(time, el);
    el.attr('currentTime', time.getTime())
    el.html(formatted_time);
    el.timerID = setTimeout(function(){$.fn.jclock.displayTime(el)},el.timeout);
  }

  $.fn.jclock.currentTime = function(el) {
    if(typeof(el.seedTime) == 'undefined') {
      // Seed time not being used, use current time
      var now = new Date();
    } else {
      // Otherwise, use seed time with increment
      el.increment += new Date().getTime() - el.lastCalled;
      var now = new Date(el.seedTime + el.increment);
      el.lastCalled = new Date().getTime();
    }
 
    if(el.utc == true) {
      var localTime = now.getTime();
      var localOffset = now.getTimezoneOffset() * 60000;
      var utc = localTime + localOffset;
      var utcTime = utc + (3600000 * el.utcOffset);
      var now = new Date(utcTime);
    }

    return now
  }
 
  $.fn.jclock.formatTime = function(time, el) {
 
    var timeNow = "";
    var i = 0;
    var index = 0;
    while ((index = el.format.indexOf("%", i)) != -1) {
      timeNow += el.format.substring(i, index);
      index++;
 
      // modifier flag
      //switch (el.format.charAt(index++)) {
      //}
      
      var property = $.fn.jclock.getProperty(time, el, el.format.charAt(index));
      index++;
      
      //switch (switchCase) {
      //}
 
      timeNow += property;
      i = index
    }
 
    timeNow += el.format.substring(i);
    return timeNow;
  };
 
  $.fn.jclock.getProperty = function(dateObject, el, property) {
 
    switch (property) {
      case "a": // abbrv day names
          return (el.daysAbbrvNames[dateObject.getDay()]);
      case "A": // full day names
          return (el.daysFullNames[dateObject.getDay()]);
      case "b": // abbrv month names
          return (el.monthsAbbrvNames[dateObject.getMonth()]);
      case "B": // full month names
          return (el.monthsFullNames[dateObject.getMonth()]);
      case "d": // day 01-31
          return ((dateObject.getDate() < 10) ? "0" : "") + dateObject.getDate();
      case "H": // hour as a decimal number using a 24-hour clock (range 00 to 23)
          return ((dateObject.getHours() < 10) ? "0" : "") + dateObject.getHours();
      case "I": // hour as a decimal number using a 12-hour clock (range 01 to 12)
          var hours = (dateObject.getHours() % 12 || 12);
          return ((hours < 10) ? "0" : "") + hours;
      case "l": // hour as a decimal number using a 12-hour clock (range 1 to 12)
          var hours = (dateObject.getHours() % 12 || 12);
          //return ((hours < 10) ? "0" : "") + hours;
          return hours;
      case "m": // month number
          return (((dateObject.getMonth() + 1) < 10) ? "0" : "") + (dateObject.getMonth() + 1);
      case "M": // minute as a decimal number
          return ((dateObject.getMinutes() < 10) ? "0" : "") + dateObject.getMinutes();
      case "p": // either `am' or `pm' according to the given time value,
          // or the corresponding strings for the current locale
          return (dateObject.getHours() < 12 ? "am" : "pm");
      case "P": // either `AM' or `PM' according to the given time value,
          return (dateObject.getHours() < 12 ? "AM" : "PM");
      case "S": // second as a decimal number
          return ((dateObject.getSeconds() < 10) ? "0" : "") + dateObject.getSeconds();
      case "y": // two-digit year
          return dateObject.getFullYear().toString().substring(2);
      case "Y": // full year
          return (dateObject.getFullYear());
      case "%":
          return "%";
    }
 
  }
       
  // plugin defaults (24-hour)
  $.fn.jclock.defaults = {
    format: '%H:%M:%S',
    utcOffset: 0,
    utc: false,
    fontFamily: '',
    fontSize: '',
    foreground: '',
    background: '',
    seedTime: undefined,
    timeout: 1000 // 1000 = one second, 60000 = one minute
  };
 
})(jQuery);
;/*
 * jQuery Nivo Slider v2.6
 * http://nivo.dev7studios.com
 *
 * Copyright 2011, Gilbert Pellegrom
 * Free to use and abuse under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * March 2010
 */

(function($){var NivoSlider=function(element,options){var settings=$.extend({},$.fn.nivoSlider.defaults,options);var vars={currentSlide:0,currentImage:'',totalSlides:0,randAnim:'',running:false,paused:false,stop:false};var slider=$(element);slider.data('nivo:vars',vars);slider.css('position','relative');slider.addClass('nivoSlider');var kids=slider.children();kids.each(function(){var child=$(this);var link='';if(!child.is('img')){if(child.is('a')){child.addClass('nivo-imageLink');link=child;}
child=child.find('img:first');}
var childWidth=child.width();if(childWidth==0)childWidth=child.attr('width');var childHeight=child.height();if(childHeight==0)childHeight=child.attr('height');if(childWidth>slider.width()){slider.width(childWidth);}
if(childHeight>slider.height()){slider.height(childHeight);}
if(link!=''){link.css('display','none');}
child.css('display','none');vars.totalSlides++;});if(settings.startSlide>0){if(settings.startSlide>=vars.totalSlides)settings.startSlide=vars.totalSlides-1;vars.currentSlide=settings.startSlide;}
if($(kids[vars.currentSlide]).is('img')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img:first');}
if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');}
slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');slider.append($('<div class="nivo-caption"><p></p></div>').css({display:'none',opacity:settings.captionOpacity}));var processCaption=function(settings){var nivoCaption=$('.nivo-caption',slider);if(vars.currentImage.attr('title')!=''&&vars.currentImage.attr('title')!=undefined){var title=vars.currentImage.attr('title');if(title.substr(0,1)=='#')title=$(title).html();if(nivoCaption.css('display')=='block'){nivoCaption.find('p').fadeOut(settings.animSpeed,function(){$(this).html(title);$(this).fadeIn(settings.animSpeed);});}else{nivoCaption.find('p').html(title);}
nivoCaption.fadeIn(settings.animSpeed);}else{nivoCaption.fadeOut(settings.animSpeed);}}
processCaption(settings);var timer=0;if(!settings.manualAdvance&&kids.length>1){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}
if(settings.directionNav){slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+settings.prevText+'</a><a class="nivo-nextNav">'+settings.nextText+'</a></div>');if(settings.directionNavHide){$('.nivo-directionNav',slider).hide();slider.hover(function(){$('.nivo-directionNav',slider).show();},function(){$('.nivo-directionNav',slider).hide();});}
$('a.nivo-prevNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');});$('a.nivo-nextNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');});}
if(settings.controlNav){var nivoControl=$('<div class="nivo-controlNav"></div>');slider.append(nivoControl);for(var i=0;i<kids.length;i++){if(settings.controlNavThumbs){var child=kids.eq(i);if(!child.is('img')){child=child.find('img:first');}
if(settings.controlNavThumbsFromRel){nivoControl.append('<a class="nivo-control" rel="'+i+'"><img src="'+child.attr('rel')+'" alt="" /></a>');}else{nivoControl.append('<a class="nivo-control" rel="'+i+'"><img src="'+child.attr('src').replace(settings.controlNavThumbsSearch,settings.controlNavThumbsReplace)+'" alt="" /></a>');}}else{nivoControl.append('<a class="nivo-control" rel="'+i+'">'+(i+1)+'</a>');}}
$('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');$('.nivo-controlNav a',slider).live('click',function(){if(vars.running)return false;if($(this).hasClass('active'))return false;clearInterval(timer);timer='';slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');vars.currentSlide=$(this).attr('rel')-1;nivoRun(slider,kids,settings,'control');});}
if(settings.keyboardNav){$(window).keypress(function(event){if(event.keyCode=='37'){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');}
if(event.keyCode=='39'){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');}});}
if(settings.pauseOnHover){slider.hover(function(){vars.paused=true;clearInterval(timer);timer='';},function(){vars.paused=false;if(timer==''&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}});}
slider.bind('nivo:animFinished',function(){vars.running=false;$(kids).each(function(){if($(this).is('a')){$(this).css('display','none');}});if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');}
if(timer==''&&!vars.paused&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}
settings.afterChange.call(this);});var createSlices=function(slider,settings,vars){for(var i=0;i<settings.slices;i++){var sliceWidth=Math.round(slider.width()/settings.slices);if(i==settings.slices-1){slider.append($('<div class="nivo-slice"></div>').css({left:(sliceWidth*i)+'px',width:(slider.width()-(sliceWidth*i))+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}else{slider.append($('<div class="nivo-slice"></div>').css({left:(sliceWidth*i)+'px',width:sliceWidth+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}}}
var createBoxes=function(slider,settings,vars){var boxWidth=Math.round(slider.width()/settings.boxCols);var boxHeight=Math.round(slider.height()/settings.boxRows);for(var rows=0;rows<settings.boxRows;rows++){for(var cols=0;cols<settings.boxCols;cols++){if(cols==settings.boxCols-1){slider.append($('<div class="nivo-box"></div>').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:(slider.width()-(boxWidth*cols))+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}else{slider.append($('<div class="nivo-box"></div>').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:boxWidth+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}}}}
var nivoRun=function(slider,kids,settings,nudge){var vars=slider.data('nivo:vars');if(vars&&(vars.currentSlide==vars.totalSlides-1)){settings.lastSlide.call(this);}
if((!vars||vars.stop)&&!nudge)return false;settings.beforeChange.call(this);if(!nudge){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}else{if(nudge=='prev'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}
if(nudge=='next'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}}
vars.currentSlide++;if(vars.currentSlide==vars.totalSlides){vars.currentSlide=0;settings.slideshowEnd.call(this);}
if(vars.currentSlide<0)vars.currentSlide=(vars.totalSlides-1);if($(kids[vars.currentSlide]).is('img')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img:first');}
if(settings.controlNav){$('.nivo-controlNav a',slider).removeClass('active');$('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');}
processCaption(settings);$('.nivo-slice',slider).remove();$('.nivo-box',slider).remove();if(settings.effect=='random'){var anims=new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade','boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');vars.randAnim=anims[Math.floor(Math.random()*(anims.length+1))];if(vars.randAnim==undefined)vars.randAnim='fade';}
if(settings.effect.indexOf(',')!=-1){var anims=settings.effect.split(',');vars.randAnim=anims[Math.floor(Math.random()*(anims.length))];if(vars.randAnim==undefined)vars.randAnim='fade';}
vars.running=true;if(settings.effect=='sliceDown'||settings.effect=='sliceDownRight'||vars.randAnim=='sliceDownRight'||settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'top':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;i++;});}
else if(settings.effect=='sliceUp'||settings.effect=='sliceUpRight'||vars.randAnim=='sliceUpRight'||settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'bottom':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;i++;});}
else if(settings.effect=='sliceUpDown'||settings.effect=='sliceUpDownRight'||vars.randAnim=='sliceUpDown'||settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var v=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);if(i==0){slice.css('top','0px');i++;}else{slice.css('bottom','0px');i=0;}
if(v==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;v++;});}
else if(settings.effect=='fold'||vars.randAnim=='fold'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;$('.nivo-slice',slider).each(function(){var slice=$(this);var origWidth=slice.width();slice.css({top:'0px',height:'100%',width:'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;i++;});}
else if(settings.effect=='fade'||vars.randAnim=='fade'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':slider.width()+'px'});firstSlice.animate({opacity:'1.0'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});}
else if(settings.effect=='slideInRight'||vars.randAnim=='slideInRight'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});}
else if(settings.effect=='slideInLeft'||vars.randAnim=='slideInLeft'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1','left':'','right':'0px'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){firstSlice.css({'left':'0px','right':''});slider.trigger('nivo:animFinished');});}
else if(settings.effect=='boxRandom'||vars.randAnim=='boxRandom'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var boxes=shuffle($('.nivo-box',slider));boxes.each(function(){var box=$(this);if(i==totalBoxes-1){setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=20;i++;});}
else if(settings.effect=='boxRain'||vars.randAnim=='boxRain'||settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrow'||vars.randAnim=='boxRainGrow'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var rowIndex=0;var colIndex=0;var box2Darr=new Array();box2Darr[rowIndex]=new Array();var boxes=$('.nivo-box',slider);if(settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){boxes=$('.nivo-box',slider)._reverse();}
boxes.each(function(){box2Darr[rowIndex][colIndex]=$(this);colIndex++;if(colIndex==settings.boxCols){rowIndex++;colIndex=0;box2Darr[rowIndex]=new Array();}});for(var cols=0;cols<(settings.boxCols*2);cols++){var prevCol=cols;for(var rows=0;rows<settings.boxRows;rows++){if(prevCol>=0&&prevCol<settings.boxCols){(function(row,col,time,i,totalBoxes){var box=$(box2Darr[row][col]);var w=box.width();var h=box.height();if(settings.effect=='boxRainGrow'||vars.randAnim=='boxRainGrow'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){box.width(0).height(0);}
if(i==totalBoxes-1){setTimeout(function(){box.animate({opacity:'1',width:w,height:h},settings.animSpeed/1.3,'',function(){slider.trigger('nivo:animFinished');});},(100+time));}else{setTimeout(function(){box.animate({opacity:'1',width:w,height:h},settings.animSpeed/1.3);},(100+time));}})(rows,prevCol,timeBuff,i,totalBoxes);i++;}
prevCol--;}
timeBuff+=100;}}}
var shuffle=function(arr){for(var j,x,i=arr.length;i;j=parseInt(Math.random()*i),x=arr[--i],arr[i]=arr[j],arr[j]=x);return arr;}
var trace=function(msg){if(this.console&&typeof console.log!="undefined")
console.log(msg);}
this.stop=function(){if(!$(element).data('nivo:vars').stop){$(element).data('nivo:vars').stop=true;trace('Stop Slider');}}
this.start=function(){if($(element).data('nivo:vars').stop){$(element).data('nivo:vars').stop=false;trace('Start Slider');}}
settings.afterLoad.call(this);return this;};$.fn.nivoSlider=function(options){return this.each(function(key,value){var element=$(this);if(element.data('nivoslider'))return element.data('nivoslider');var nivoslider=new NivoSlider(this,options);element.data('nivoslider',nivoslider);});};$.fn.nivoSlider.defaults={effect:'random',slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3000,startSlide:0,directionNav:true,directionNavHide:true,controlNav:true,controlNavThumbs:false,controlNavThumbsFromRel:false,controlNavThumbsSearch:'.jpg',controlNavThumbsReplace:'_thumb.jpg',keyboardNav:true,pauseOnHover:true,manualAdvance:false,captionOpacity:0.8,prevText:'Prev',nextText:'Next',beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};$.fn._reverse=[].reverse;})(jQuery);
