/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|scale|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}));

/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/

(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.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">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<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(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<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(D)}}};
b.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:0.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(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
/* Polish initialisation for the jQuery UI date picker plugin. */
/* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */
jQuery(function($){
	$.datepicker.regional['pl'] = {
		closeText: 'Zamknij',
		prevText: '&#x3c;Poprzedni',
		nextText: 'Następny&#x3e;',
		currentText: 'Dziś',
		monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
		'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
		monthNamesShort: ['Sty','Lut','Mar','Kwi','Maj','Cze',
		'Lip','Sie','Wrz','Paź','Lis','Gru'],
		dayNames: ['Niedziela','Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
		dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
		dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
		weekHeader: 'Tydz',
		dateFormat: 'yy-mm-dd',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['pl']);
});

var fArch = {
	fundDates: {},
	curFundDates : [],
	minDate: null,
	maxDate: null,	
	dates: null,
	comparedDisabled : {},
	fundSelect : [],
   init: function() {
   	fArch.initMinDate();
		fArch.initCalendars();
		fArch.initForm();
   },
   
   initForm: function() {
   	fArch.fundSelect = [];
   	$('#faFund option').each(function(){
			fArch.fundSelect[fArch.fundSelect.length] = {
				id: $(this).attr('id'),
				value: $(this).attr('value'), 
				text: $(this).html()
			};			
   	});
   	
		$('#faCtg').bind('change', function(){
			fArch.filterFunds();
		});         
		$('#faFund').bind('change', function(){
			fArch.filterCalendars($(this).val());
		});
		$('#fizFund').bind('change', function(){
			fArch.filterFizDates();
		});
		
		$('#faSearchForm').bind('submit', function(){
			return fArch.formValidate();
		});
		$('#fizSearchForm').bind('submit', function(){
			return fArch.fizFormValidate();
		});
		
		$('#faCompare .remove').bind('click', function(){
	  		fArch.removeResult($(this).attr('id').split('_')[1]);		
		});
		fArch.filterFunds();  
		
		if ($('#faSearchForm').length > 0) {
			$($('.ui-datepicker-trigger')[0]).attr('id','faStartDateTrigger');
			$($('.ui-datepicker-trigger')[1]).attr('id','faEndDateTrigger');
		}
		
		fArch.initFizDates();
   },
   
   recolorizeResults: function()
   {
   	$('#faCompare tr').removeClass('gray1');
		$('#faCompare tr:even').not('.head').addClass('gray1');
   },
   
   removeResult: function(id,fiz)
   {
   	if (fiz == true) {
			var prefix = 'fiz';
   	} else {
			var prefix = 'fa';
   	}
		var o = [];
		var c = $('#'+prefix+'Added').val().split(',');
		for (var i in c) {
			if (c[i] != id) {
				o[o.length] = c[i];
			}
		}
		$('#'+prefix+'Added').val(o.join(','));
		$('#cf_'+id).remove();
		if ($('#'+prefix+'Added').val() == '') {
			$('#'+prefix+'Compare').hide();
		} else {
			fArch.recolorizeResults();
		}
		fArch.filterFunds();  
   },
   
   formValidate: function()
   {
   	var errors = '';
		if (!$('#faFund').val()) {
			 if (!$('#faAdded').val()) {
			 	errors += '- '+lang.Nie_wybrano_zadnego_funduszu+'.';	 
			 } else {
				 var added = $('#faAdded').val().split(',');
				 var addedChecked = [];				 
			 	 for (var i in added) {
					 if (fArch.comparedDisabled[added[i]] !== true) {
						 addedChecked[addedChecked.length] = added[i];
					 }
			 	 }	 
			 	 if (addedChecked.length == 0) {
				 	errors += '- '+lang.Nie_wybrano_zadnego_funduszu+'.';	 	 
			 	 }
			 }
		}
		if (!$('#faStartDate').val()) {
			if (errors) {
				errors += '<br />';
			}
			errors += '- '+lang.Nie_wybrano_daty_poczatkowej+'.';
		}
		if (!$('#faEndDate').val()) {
			if (errors) {
				errors += '<br />';
			}
			errors += '- '+lang.Nie_wybrano_daty_koncowej+'.';
		}
		
		if (errors) {
			var msg = $(''+
				'<div title="'+lang.Blad+'!"> '+
					'<p> '+
					'<span class="v-ui-icon-alert-fa"></span> '+
					'<strong style="display:block; padding-bottom:10px; padding-top:7px;">'+lang.Popraw_formularz+'</strong>'+
					errors+
					'</p> '+
				'</div>');
			$('body').append(msg);
			msg.dialog({ 
				modal: true, 
				minWidth:320, 
				minHeight:10, 
				buttons: { 
					OK: function() {	
						$( this ).dialog( "close" ); 
					}
				}
			});
			return false; 
		}
		return true;
   },
   
   fizFormValidate: function()
   {
   	var errors = '';
		if (!$('#fizFund').val()) {
			 if (!$('#fizAdded').val()) {
			 	errors += '- '+lang.Nie_wybrano_zadnego_funduszu+'.';	 
			 } else {
				 var added = $('#fizAdded').val().split(',');
				 var addedChecked = [];				 
			 	 for (var i in added) {
					 if (fArch.comparedDisabled[added[i]] !== true) {
						 addedChecked[addedChecked.length] = added[i];
					 }
			 	 }	 
			 	 if (addedChecked.length == 0) {
				 	errors += '- '+lang.Nie_wybrano_zadnego_funduszu+'.';	 	 
			 	 }
			 }
		}
		if (!$('#fizStartDate').val()) {
			if (errors) {
				errors += '<br />';
			}
			errors += '- '+lang.Nie_wybrano_daty_poczatkowej+'.';
		}
		if (!$('#fizEndDate').val()) {
			if (errors) {
				errors += '<br />';
			}
			errors += '- '+lang.Nie_wybrano_daty_koncowej+'.';
		}
		
		if (!errors) {
			if (fArch.isoToDate($('#fizStartDate').val()) > fArch.isoToDate($('#fizEndDate').val())) {
				var s = $('#fizStartDate').val();
				var e = $('#fizEndDate').val();
				$('#fizStartDate').val(e);
				$('#fizEndDate').val(s);
			}
		}
		
		if (errors) {
			var msg = $(''+
				'<div title="'+lang.Blad+'!"> '+
					'<p> '+
					'<span class="v-ui-icon-alert-fa"></span> '+
					'<strong style="display:block; padding-bottom:10px; padding-top:7px;">'+lang.Popraw_formularz+'</strong>'+
					errors+
					'</p> '+
				'</div>');
			$('body').append(msg);
			msg.dialog({ 
				modal: true, 
				minWidth:320, 
				minHeight:10, 
				buttons: { 
					OK: function() {	
						$( this ).dialog( "close" ); 
					}
				}
			});
			return false; 
		}
		return true;
   },
   
   filterFunds: function() {
   	var match = $('#faCtg').val();
   	$('#faFund option').remove();
		if (match == '') {
			for (var i in fArch.fundSelect) {
			  	$('#faFund').append('<option id="'+fArch.fundSelect[i].id+'" value="'+fArch.fundSelect[i].value+'">'+fArch.fundSelect[i].text+'</option>');	 	
			}
		} else {
			for (var i in fArch.fundSelect) {
				if (fArch.fundSelect[i].value == '' || fArch.fundSelect[i].value.split('|')[1] == match) {
					$('#faFund').append('<option id="'+fArch.fundSelect[i].id+'" value="'+fArch.fundSelect[i].value+'">'+fArch.fundSelect[i].text+'</option>');	 		
				}
			}
		}
		var c = $('#faAdded').val().split(',');
   	for (var i in c) {
			$('#flo_'+c[i]).remove();
   	}
		
   },
   
   filterCalendars: function(match) {
   	if (match != '' && ~~match.split('|')[0] > 0) {
			fArch.curFundDates = fArch.fundDates[match.split('|')[0]];
			if (fArch.curFundDates.length > 0) {
				//1. wyczyścić daty z datepickerów z poza zakresu wybranego funduszu
				if ($(fArch.dates[0]).datepicker('getDate') !== null && (fArch.compareDates(fArch.curFundDates[0], $(fArch.dates[0]).datepicker('getDate')) == 1 || fArch.compareDates($(fArch.dates[0]).datepicker('getDate'), fArch.curFundDates[1]) == 1)) {
					 $(fArch.dates[0]).datepicker('setDate', '');
				}
				if ($(fArch.dates[1]).datepicker('getDate') !== null && (fArch.compareDates(fArch.curFundDates[0], $(fArch.dates[1]).datepicker('getDate')) == 1 || fArch.compareDates($(fArch.dates[1]).datepicker('getDate'), fArch.curFundDates[1]) == 1)) {
					 $(fArch.dates[1]).datepicker('setDate', '');
				}
				//2. ustawiamy minDate w kalendarzu OD na minDate funduszu
				$(fArch.dates[0]).datepicker('option', 'minDate', fArch.curFundDates[0]);
				//3. ustawiamy maxDate w kalendarzu DO na maxDate funduszu
				$(fArch.dates[1]).datepicker('option', 'maxDate', fArch.curFundDates[1]);
				
				//jeśli data w kalendarzu DO jest ustawiona, ustawiamy ją jako maxDate w kalendarzu OD
				if ($(fArch.dates[1]).datepicker('getDate') !== null) {
					$(fArch.dates[0]).datepicker('option', 'maxDate', $(fArch.dates[1]).datepicker('getDate'));	
				} else { // jeśli nie ustawiamy na maxDate funduszu
					$(fArch.dates[0]).datepicker('option', 'maxDate', fArch.curFundDates[1]);	
				}
				
				//jeśli data w kalendarzu OD jest ustawiona, ustawiamy ją jako minDate w kalendarzu DO
				if ($(fArch.dates[0]).datepicker('getDate') !== null) {
					$(fArch.dates[1]).datepicker('option', 'minDate', $(fArch.dates[0]).datepicker('getDate'));	
				} else { // jeśli nie ustawiamy na minDate funduszu
					$(fArch.dates[1]).datepicker('option', 'minDate', fArch.curFundDates[0]);	
				}
			}
   	} else {
   		$(fArch.dates[0]).datepicker('option', 'minDate', fArch.minDate);	
   		$(fArch.dates[0]).datepicker('option', 'maxDate', fArch.maxDate);	
   		$(fArch.dates[1]).datepicker('option', 'minDate', fArch.minDate);	
   		$(fArch.dates[1]).datepicker('option', 'maxDate', fArch.maxDate);	
   	}
   	fArch.checkComparedNewRange();
   },
   
   initCalendars: function() {
   	var d = new Date();
		var minYear = 1998;
		var maxYear = d.getFullYear()+1;
		fArch.dates = $('#faStartDate, #faEndDate').datepicker({
			dateFormat: 'yy-mm-dd',
			showOn: "both",
			buttonImage: "/i/calendar.png",
			showOptions: {direction: 'up' },
			maxDate: fArch.maxDate,
			minDate: fArch.minDate,
			buttonImageOnly: true,
			changeMonth: true,
			changeYear: true,
			yearRange: minYear+':'+maxYear,
			beforeShowDay: $.datepicker.noWeekends,
			onSelect: function( selectedDate ) { 
				var option = this.id == "faStartDate" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" );
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				fArch.dates.not( this ).datepicker( "option", option, date );
				fArch.checkComparedNewRange();				 
			} // update selected range
		});
		$('#faStartDate, #faEndDate').bind('change', function() { fArch.checkComparedNewRange(); });
   },
   
   checkComparedNewRange: function()
   {
	  	if ($('#faAdded').val() == '') {
			return false;
	  	}	
	  	var ids = $('#faAdded').val().split(',');
		var alertize = [false, false];
	  	
	  	for (var i in ids) {
			var fd0 = fArch.fundDates[ids[i]][0];
			var fd1 = fArch.fundDates[ids[i]][1];
			var sd0 = $(fArch.dates[0]).val();
			var sd1 = $(fArch.dates[1]).val();
		
			var del = false;
			if (sd0 && (fArch.compareDates(sd0,fd0) == -1 || fArch.compareDates(sd0,fd1) == 1 )) {
				del = true;
				alertize[0] = true;
			}
			
			if (sd1 && (fArch.compareDates(sd1,fd0) == -1 || fArch.compareDates(sd1,fd1) == 1 )) {
				alertize[1] = true;
				del = true;
			}			
			
			if (del) {
				fArch.disableComparedFund(ids[i]);
			} else {
				fArch.enableComparedFund(ids[i]);
			}
	  	}
	  	
		if (alertize[0]) {
			fArch.alertizeDateField('#faStartDate','se');	
		} else {
			fArch.dealertizeDateField('#faStartDate');	
		}
		if (alertize[1]) {
			fArch.alertizeDateField('#faEndDate','sw');	
		} else {
			fArch.dealertizeDateField('#faEndDate');	
		}
   },
   
   dealertizeDateField: function(field) 
   {
		if ($(field).length > 0) {
			$(field).tipsy("hide");
			$(field).tipsy == null;
			$(field).data('tto',null);
		}
   },
   
   alertizeDateField: function(field, dir)
   {
		if ($(field).length > 0) {
			if ($(field).data('tto')) {
				clearTimeout($(field).data('tto'));
				$(field).data('tto',null);
			}
			if (!$(field).tipsy(true)) {
				$(field).tipsy({
							gravity: dir,
							fade: true,
							offset: 3,
							opacity: 1,
							fallback: lang.Wybrana_data_powoduje_wylaczenie_funduszy_znajdujacych_sie_poza_zakresem,
							trigger: 'manual',
							closer: true
				});
			}
		  	$(field).tipsy("show");
			$(field).data('tto', setTimeout(function(){ $(field).tipsy("hide"); }, 5000));
		}
   },
   
   disableComparedFund: function(id) {
		$('#cf_'+id).addClass('disabled');
		fArch.comparedDisabled[id] = true;
   },
   
   enableComparedFund: function(id) {
		if ($('#cf_'+id).hasClass('disabled')) {
			$('#cf_'+id).removeClass('disabled');	
			fArch.comparedDisabled[id] = false;					
		}
   },
   
   initMinDate: function() {
		for (var i in fArch.fundDates) {
			if (fArch.minDate === null) {
				fArch.minDate = fArch.fundDates[i][0];
			} else {
				if (fArch.compareDates(fArch.fundDates[i][0],fArch.minDate) == -1) {
					fArch.minDate = fArch.fundDates[i][0];
				}
			}
   	}
   },
   
   compareDates: function(a,b) {

   	if (typeof(a) != 'object') {
			var da = fArch.isoToDate(a) 
   	} else {
   		var a = fArch.dateToIso(a);
			var da = fArch.isoToDate(a);
   	}
   	if (typeof(b) != 'object') {
			var db = fArch.isoToDate(b); 
   	} else {
   		var b = fArch.dateToIso(b);
			var db = fArch.isoToDate(b);
   	}

		if (a == b) {
			return 0;
		}	
		if (da < db) {
			return -1;
		}
		return 1;
   },
   
   dateToIso: function (date) {
   	if (date == null) {
		 	return null;	
   	}
		var zeropad = function (num) { return ((num < 10) ? '0' : '') + num; }

		var str = "";
		str += date.getUTCFullYear();
		str += "-" + zeropad(date.getUTCMonth() + 1); 
		str += "-" + zeropad(date.getUTCDate()); 
		
		return str;
	}, 
	
	isoToDate: function (input) {
		if (input == null) {
		 	return null;	
   	}
		var parts = input.match(/(\d+)/g);
		return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based
	},
	
	initFizDates: function(startDate, endDate) {
		
		if (null == startDate && $('#fizStartDate').val()) {
			startDate = $('#fizStartDate').val();
		}
		if (null == endDate && $('#fizEndDate').val()) {
			endDate = $('#fizEndDate').val();
		}
		
		var fndId = null;
		var fndSelectVal = $('#fizFund').val();
		if (fndSelectVal) {
			fndId = fndSelectVal.split('|')[1];	
		}	
		for (var i in fizDates) {
			if (fndId) {
				var ids = fizDates[i].split(',');
				for (var j in ids) {
					if (ids[j] == fndId) {
						$('#fizStartDate').append('<option value="'+i+'" label="'+i+'" '+((null != startDate && startDate == i) ? 'selected="selected"' : '')+'>'+i+'</option>');
						$('#fizEndDate').append('<option value="'+i+'" label="'+i+'" '+((null != endDate && endDate == i) ? 'selected="selected"' : '')+'>'+i+'</option>');
					}
				}
			} else {
				$('#fizStartDate').append('<option value="'+i+'" label="'+i+'" '+((null != startDate && startDate == i) ? 'selected="selected"' : '')+'>'+i+'</option>');
				$('#fizEndDate').append('<option value="'+i+'" label="'+i+'" '+((null != endDate && endDate == i) ? 'selected="selected"' : '')+'>'+i+'</option>');
			}
		}
	},
	
	filterFizDates: function() {
		var dateStartSelected = $('#fizStartDate').val();	
		var dateEndSelected = $('#fizEndDate').val();
		
		$('#fizStartDate option, #fizEndDate option').not('.first').remove();
		fArch.initFizDates(dateStartSelected,dateEndSelected);
	}
	
	
};
;
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';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}};(function($){function Tipsy(element,options){this.$element=$(element);this.options=options;this.enabled=true;this.fixTitle()}Tipsy.prototype={show:function(){var title=this.getTitle();if(title&&this.enabled){var $tip=this.tip();$tip.find('.tipsy-inner')[this.options.html?'html':'text'](title);$tip[0].className='tipsy';(this.options.style!='')?$tip.addClass(this.options.style):null;$tip.remove().css({top:0,left:0,visibility:'hidden',display:'block'}).appendTo(document.body);var pos=$.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var actualWidth=$tip[0].offsetWidth,actualHeight=$tip[0].offsetHeight;var gravity=(typeof this.options.gravity=='function')?this.options.gravity.call(this.$element[0]):this.options.gravity;var tp;switch(gravity.charAt(0)){case'n':tp={top:pos.top+pos.height+this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case's':tp={top:pos.top-actualHeight-this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case'e':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth-this.options.offset};break;case'w':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width+this.options.offset};break}if(gravity.length==2){if(gravity.charAt(1)=='w'){tp.left=pos.left+pos.width/2-15}else{tp.left=pos.left+pos.width/2-actualWidth+15}}$tip.css(tp).addClass('tipsy-'+gravity);$tip.find('a').bind('click',function(){$tip.hide();return true});if(this.options.closer){var closer=$('<a href="#" class="tipsy-closer"></a>');closer.bind('click',function(){$tip.hide()});$tip.append(closer)}if(this.options.fade){$tip.stop().css({opacity:0,display:'block',visibility:'visible'}).animate({opacity:this.options.opacity})}else{$tip.css({visibility:'visible',opacity:this.options.opacity})}if(this.options.trigger!='manual'&&this.options.stayover==true){var self=this;$tip.bind('mouseenter',function(){self.enter()});$tip.bind('mouseleave',function(){self.leave()})}}},hide:function(){if(this.options.fade){this.tip().stop().fadeOut(function(){$(this).remove()})}else{this.tip().remove()}},enter:function(){var self=this;self.hoverState='in';if(self.options.delayIn==0){self.show()}else{self.fixTitle();setTimeout(function(){if(self.hoverState=='in')self.show()},self.options.delayIn)}},leave:function(){var self=this;self.hoverState='out';if(this.options.delayOut==0){setTimeout(function(){if(self.hoverState=='out')self.hide()},self.options.delayOut+self.options.delayOutBase)}else{setTimeout(function(){if(self.hoverState=='out')self.hide()},self.options.delayOut+self.options.delayOutBase)}},fixTitle:function(){var $e=this.$element;if($e.attr('title')||typeof($e.attr('original-title'))!='string'){$e.attr('original-title',$e.attr('title')||'').removeAttr('title')}},getTitle:function(){var title,$e=this.$element,o=this.options;this.fixTitle();var title,o=this.options;if(typeof o.title=='string'){title=$e.attr(o.title=='title'?'original-title':o.title)}else if(typeof o.title=='function'){title=o.title.call($e[0])}title=(''+title).replace(/(^\s*|\s*$)/,"");return title||o.fallback},tip:function(){if(!this.$tip){this.$tip=$('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>')}return this.$tip},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled}};$.fn.tipsy=function(options){if(options===true){return this.data('tipsy')}else if(typeof options=='string'){var tipsy=this.data('tipsy');if(tipsy)tipsy[options]();return this}options=$.extend({},$.fn.tipsy.defaults,options);function get(ele){var tipsy=$.data(ele,'tipsy');if(!tipsy){tipsy=new Tipsy(ele,$.fn.tipsy.elementOptions(ele,options));$.data(ele,'tipsy',tipsy)}return tipsy}function enter(){var tipsy=get(this);tipsy.hoverState='in';if(options.delayIn==0){tipsy.show()}else{tipsy.fixTitle();setTimeout(function(){if(tipsy.hoverState=='in')tipsy.show()},options.delayIn)}};function leave(){var tipsy=get(this);tipsy.hoverState='out';if(options.delayOut==0){setTimeout(function(){if(tipsy.hoverState=='out')tipsy.hide()},options.delayOut+options.delayOutBase)}else{setTimeout(function(){if(tipsy.hoverState=='out')tipsy.hide()},options.delayOut+options.delayOutBase)}};if(!options.live)this.each(function(){get(this)});if(options.trigger!='manual'){var binder=options.live?'live':'bind',eventIn=options.trigger=='hover'?'mouseenter':'focus',eventOut=options.trigger=='hover'?'mouseleave':'blur';this[binder](eventIn,enter)[binder](eventOut,leave)}return this};$.fn.tipsy.defaults={style:'',delayIn:0,delayOut:0,delayOutBase:100,fade:false,fallback:'',gravity:'n',html:false,live:false,offset:0,opacity:0.9,closer:false,title:'title',trigger:'hover',stayover:true};$.fn.tipsy.elementOptions=function(ele,options){return $.metadata?$.extend({},options,$(ele).metadata()):options};$.fn.tipsy.autoNS=function(){return $(this).offset().top>($(document).scrollTop()+$(window).height()/2)?'s':'n'};$.fn.tipsy.autoWE=function(){return $(this).offset().left>($(document).scrollLeft()+$(window).width()/2)?'e':'w'}})(jQuery);(function($){var locationWrapper={put:function(hash,win){(win||window).location.hash=this.encoder(hash)},get:function(win){var hash=((win||window).location.hash).replace(/^#/,'');try{return $.browser.mozilla?hash:decodeURIComponent(hash)}catch(error){return hash}},encoder:encodeURIComponent};var iframeWrapper={id:"__jQuery_history",init:function(){var html='<iframe id="'+this.id+'" style="display:none" src="javascript:false;" />';$("body").prepend(html);return this},_document:function(){return $("#"+this.id)[0].contentWindow.document},put:function(hash){var doc=this._document();doc.open();doc.close();locationWrapper.put(hash,doc)},get:function(){return locationWrapper.get(this._document())}};function initObjects(options){options=$.extend({unescape:false},options||{});locationWrapper.encoder=encoder(options.unescape);function encoder(unescape_){if(unescape_===true){return function(hash){return hash}}if(typeof unescape_=="string"&&(unescape_=partialDecoder(unescape_.split("")))||typeof unescape_=="function"){return function(hash){return unescape_(encodeURIComponent(hash))}}return encodeURIComponent}function partialDecoder(chars){var re=new RegExp($.map(chars,encodeURIComponent).join("|"),"ig");return function(enc){return enc.replace(re,decodeURIComponent)}}}var implementations={};implementations.base={callback:undefined,type:undefined,check:function(){},load:function(hash){},init:function(callback,options){initObjects(options);self.callback=callback;self._options=options;self._init()},_init:function(){},_options:{}};implementations.timer={_appState:undefined,_init:function(){var current_hash=locationWrapper.get();self._appState=current_hash;self.callback(current_hash);setInterval(self.check,100)},check:function(){var current_hash=locationWrapper.get();if(current_hash!=self._appState){self._appState=current_hash;self.callback(current_hash)}},load:function(hash){if(hash!=self._appState){locationWrapper.put(hash);self._appState=hash;self.callback(hash)}}};implementations.iframeTimer={_appState:undefined,_init:function(){var current_hash=locationWrapper.get();self._appState=current_hash;iframeWrapper.init().put(current_hash);self.callback(current_hash);setInterval(self.check,100)},check:function(){var iframe_hash=iframeWrapper.get(),location_hash=locationWrapper.get();if(location_hash!=iframe_hash){if(location_hash==self._appState){self._appState=iframe_hash;locationWrapper.put(iframe_hash);self.callback(iframe_hash)}else{self._appState=location_hash;iframeWrapper.put(location_hash);self.callback(location_hash)}}},load:function(hash){if(hash!=self._appState){locationWrapper.put(hash);iframeWrapper.put(hash);self._appState=hash;self.callback(hash)}}};implementations.hashchangeEvent={_init:function(){self.callback(locationWrapper.get());$(window).bind('hashchange',self.check)},check:function(){self.callback(locationWrapper.get())},load:function(hash){locationWrapper.put(hash)}};var self=$.extend({},implementations.base);if($.browser.msie&&($.browser.version<8||document.documentMode<8)){self.type='iframeTimer'}else if("onhashchange"in window){self.type='hashchangeEvent'}else{self.type='timer'}$.extend(self,implementations[self.type]);$.history=self})(jQuery);var dws={hash:'',init:function(){$(document).ready(function(){if(ftts!==null){ftts.init()}dws.initFundTabs();dws.initFundChangers();dws.initFundDocsAndAnnouncements();dws.initRowBackgrounds();dws.initFaq();dws.initIframes();dws.initSitemap();dws.initFilterDocumentTypes();$('.trunc').not('.tDoc').tipsy({gravity:'sw'});$('.tDoc').tipsy({gravity:'nw',stayover:false});$('a._blank[href^="http://"], a._blank[href^="https://"]').attr('target','_blank')})},initFaq:function(){if($('#faq').length>0){$('#faq dt').bind('click',function(){var close=false;if($(this).hasClass('on')){close=true}$('#faq dd').hide();$('#faq dt').removeClass('on');if(!close){$(this).addClass('on');$('#faq_a_'+$(this).attr('id').split('_')[2]).show()}});$('#faq dd').hide();$('#faq dt').removeClass('on')}},initFundChangers:function(){$('#fundChange, #fundCatChange').bind('change',function(){if($(this).val()!=''){if(dws.hash!=''&&dws.hash!='portfel'&&dws.hash!='dane'){window.location.href=$(this).val()+'#'+dws.hash}else{window.location.href=$(this).val()}}})},initFundTabs:function(){if($('#fundTabs, #walletTabs').length>0){$('#fundTabs a, #walletTabs a').bind('click',dws.fundTabClicked);$.history.init(function(hash){dws.hash=hash;if(hash==""){}else{$('#fundTabs a, .fundTab, #walletTabs a, .walletTab').removeClass('act');$('#fundTabs a, #walletTabs a').each(function(){if($(this).attr('href').replace('#','')==hash){$(this).addClass('act');$($(this).attr('href')).addClass('act');if(hash=='wykres'||hash=='fund_chart'){dws.fundChartShow()}else{dws.fundChartHide()}}})}},{unescape:",/"})}},initFundDocsAndAnnouncements:function(){if($('.docsFound').length>0){$('.docsFound ul.tabs a').bind('click',function(){$(this).parents('ul').first().find('a').removeClass('act');var year=$(this).attr('href').substr(1);if(year=='prospectus'||year=='archive'){$('.docsFound table .tabbed.prospectus, .docsFound table .tabbed.archive').hide()}else if('c_'==year.substr(0,2)){$('.docsFound table').find('.comments.tabbed').hide()}else{$('.docsFound table').find('.tabbed').not('.prospectus, .archive, .comments').hide()}$('.docsFound table .'+year).show();$(this).addClass('act');return false})}},initRowBackgrounds:function(){$('table.frtb tr:odd td').addClass('fbrGr');$('#fundfinder tr:even td').addClass('fbrGr')},fundTabClicked:function(e){if(!$(this).hasClass('act')&&$($(this).attr('href')).length>0){jQuery.history.load($(this).attr('href').replace('#',''))}return false},fundChartShow:function(){if($('#chartPlaceholder').length){var pos=$('#chartPlaceholder').position();$('#chart').css({left:pos.left+'px',top:pos.top+'px'})}},fundChartHide:function(){$('#chart').css({left:'-999em'})},isoDate:function(d){function pad(n){return n<10?'0'+n:n}return d.getUTCFullYear()+'-'+pad(d.getUTCMonth()+1)+'-'+pad(d.getUTCDate())},initIframes:function(){$('.ifrBox').each(function(){var params=$(this).find('a').attr('name').split(',');if(!params||params.length<3){$(this).remove()}var url=params[2];for(var i=3;i<params.length;i++){url+=','+params[i]}var width=params[0]+'px';if(width=='*px'){width='100%'}var height=params[1]+'px';var html='<iframe class="ifr" src="'+url+'" style="width:'+width+'; height:'+height+';"></iframe>';$(this).html(html)})},initSitemap:function(){if($('#sitemap').length>0){var elms=$('#sitemap li');for(var i=0;i<elms.length;i++){var c='#'+$(elms[i]).attr('class');if(c!=''&&$('#sitemap '+c).length>0){if($('#sitemap '+c+' ul').length==0){$('#sitemap '+c).append('<ul></ul>')}$('#sitemap '+c+' ul').first().append(elms[i])}}}},initFilterDocumentTypes:function(){var optsCommon=[];var optsFo=[];var optsFiz=[];var optsAll=[];$('#docLibCtg option').each(function(){optsAll[optsAll.length]={value:$(this).val(),html:$(this).html()};if($(this).hasClass('fiz')){optsFiz[optsFiz.length]={value:$(this).val(),html:$(this).html()}}if($(this).hasClass('fo')){optsFo[optsFo.length]={value:$(this).val(),html:$(this).html()}}if(!$(this).hasClass('fiz')&&!$(this).hasClass('fo')){optsCommon[optsCommon.length]={value:$(this).val(),html:$(this).html()}}});function filter(){$('#docLibCtg option').remove();if($('#docLibFund option:selected').hasClass('fo')){for(var i in optsCommon){$('#docLibCtg').append($('<option value="'+optsCommon[i].value+'">'+optsCommon[i].html+'</option>'))}for(var i in optsFo){$('#docLibCtg').append($('<option value="'+optsFo[i].value+'">'+optsFo[i].html+'</option>'))}}else if($('#docLibFund option:selected').hasClass('fiz')){for(var i in optsCommon){$('#docLibCtg').append($('<option value="'+optsCommon[i].value+'">'+optsCommon[i].html+'</option>'))}for(var i in optsFiz){$('#docLibCtg').append($('<option value="'+optsFiz[i].value+'">'+optsFiz[i].html+'</option>'))}}else{for(var i in optsAll){$('#docLibCtg').append($('<option value="'+optsAll[i].value+'">'+optsAll[i].html+'</option>'))}}}filter();$('#docLibFund').live('change',function(){filter()})}};dws.init();var test=null;var cFrm={instance:null,no:0,init:function(){$(function(){var no=0;$('.contactBox').each(function(){cFrm.initInstance($(this),no);no++})})},initInstance:function(elm,no){var self=this;test=this;this.instance=elm;this.instanceNo=no;if(this.instance.parents('#fpTopRight').length>0){this.instance.parents().first().addClass('topTab').children('p').remove()}var content=this.instance.html();var header=this.instance.find('h3').first().html();var accept=this.instance.find('p.accreg').first().html();this.instance.html('<div class="formBoxInner">\<div class="form">\<h3>'+header+'</h3>\<form class="big_newsletter_form"method="post">\<label for="frmName_'+no+'"class="frmNameLabel">'+lang.Imie+':</label>\<input type="text"id="frmName_'+no+'"name="frmName"class="frmName">\<label for="frmLastname_'+no+'"class="frmLastnameLabel">'+lang.Nazwisko+':</label>\<input type="text"id="frmLastname_'+no+'"name="frmLastname"class="frmLastname">\<label for="frmPhone_'+no+'"class="frmPhoneLabel">'+lang.Telefon+':</label>\<!--<div class="frmPhonePrefix">+48</div>--><input type="text"id="frmPhone_'+no+'"name="frmPhone"class="frmPhone">\<label for="frmEmail"id="frmEmailLabel_'+no+'"class="frmEmailLabel">Email:</label>\<input type="text"id="frmEmail_'+no+'"name="frmEmail"class="frmEmail">\<input type="checkbox"id="frmAccept_'+no+'"class="frmAccept"value="1"checked="checked"><label for="frmAccept_'+no+'"class="frmAcceptInfo"><span>'+accept+'</span></label>\<input type="button"class="frmSubmit '+lang.frmSubmitEnClass+'">\</form>\</div>\<div class="loader">\<img src="/i/loader.gif"alt="'+lang.Prosze_czekac+'...">\</div>\<div class="result ok">\<p class="l1">'+lang.Dziekujemy_za_wypełnienie_formularza+'.</p>\<p class="l2">'+lang.Nasz_doradca_skontaktuje_sie_z_panstwem+'.</p>\</div>\<div class="result error">\<p class="l1">'+lang.Formularz_zawiera_bledy+'.</p>\<p class="l2">'+lang.Wroc_i_popraw_niewlasciwie_wypelnione_pola+'.</p>\<a href="#"class="frmErrorBack '+lang.frmErrorBackEnClass+'">«'+lang.powrot_do_formularza+'</a>\</div>\</div>');c=$.cookie('cFrmFinishedOk');if(c==1){this.showInstantOk()}this.instance.find('.frmSubmit').bind('click',function(){self.showLoader(function(){self.submit()});return false});this.instance.find('.frmErrorBack').bind('click',function(){self.instance.find('.loader, .result.ok').css({display:'none'});self.instance.find('.formBoxInner').animate({left:'0px'},235);return false});this.instance.find('form input').bind('focus',function(){if($('#fpTopRight').length){$('#fpTopRight .tabs .act a').click()}});$('.frmName, .frmLastname, .frmEmail, .frmPhone').bind('keydown',function(){$(this).removeClass('err')});$('.frmAccept').bind('change',function(){$('.frmAcceptInfo').removeClass('err')})},submit:function(){var err=false;var self=this;if(!this.instance.find('.frmName').val()){err=true;this.instance.find('.frmName').addClass('err')}if(!this.instance.find('.frmLastname').val()){err=true;this.instance.find('.frmLastname').addClass('err')}if(!this.instance.find('.frmEmail').val()){err=true;this.instance.find('.frmEmail').addClass('err')}else{var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(reg.test(this.instance.find('.frmEmail').val())==false){err=true;this.instance.find('.frmEmail').addClass('err')}}if(!this.instance.find('.frmPhone').val()){err=true;this.instance.find('.frmPhone').addClass('err')}if(!this.instance.find('.frmAccept').is(':checked')){err=true;this.instance.find('.frmAcceptInfo').addClass('err')}if(err){setTimeout(function(){self.showError()},500);return}$.ajax({url:"/subscribe.php",type:"POST",data:this.instance.find('form').serialize(),dataType:"json",success:function(d){self.ajaxSuccess(d)}})},ajaxSuccess:function(d){var self=this;if(d.status=='ok'){if(d.msg!=''){self.instance.find('.resultOkStatusText').html(d.msg)}self.showOk();$.cookie('cFrmFinishedOk','1',{path:'/'});return}if(d.status=='err'){if(d.msg!=''){var fields=d.msg.split(',');for(var f in fields){self.instance.find('.'+fields[f]).addClass('err')}}self.showError();return}},showLoader:function(callback){this.instance.find('.loader').css({display:'block'});this.instance.find('.formBoxInner').animate({left:'-255px'},235,callback)},showError:function(){this.instance.find('.result.ok').css({display:'none'});this.instance.find('.formBoxInner').animate({left:'-510px'},235)},showOk:function(){this.instance.find('.result.ok').css({display:'block'});this.instance.find('.formBoxInner').animate({left:'-510px'},235)},showInstantOk:function(){this.instance.find('.result.ok').css({display:'block'});this.instance.find('.formBoxInner').css({left:'-510px'})}};cFrm.init();var fundfinder={data:[],filtered:[],filter:null,columnSelects:['1D','1M','1Y'],sortBy:null,sortOrd:null,historyInserting:false,url:'',hash:null,date:null,baseDate:null,maxDate:null,calendarDate:null,category:null,init:function(){if($('#fundfinder').length>0){fundfinder.bindActions();fundfinder.initHistory();fundfinder.initCalendar();fundfinder.initBgColors()}},initBgColors:function(){$('#fundfinder .ffrGr').removeClass('ffrGr');$('#fundfinder .ffRow:odd').addClass('ffrGr')},initCalendar:function(){var d=new Date();var minYear=1998;var maxYear=d.getFullYear()+1;$("#fundsDate").datepicker({dateFormat:'yy-mm-dd',showOn:"both",buttonImage:"/i/calendar.png",showOptions:{direction:'up'},buttonImageOnly:true,changeMonth:true,changeYear:true,yearRange:minYear+':'+maxYear,maxDate:fundfinder.maxDate,beforeShowDay:$.datepicker.noWeekends,onSelect:function(){fundfinder.dateSet()}})},dateSet:function(){var date=$("#fundsDate").datepicker("getDate");var m=date.getMonth()+1;if(m<10){m='0'+m}var d=date.getDate();if(d<10){d='0'+d}fundfinder.calendarDate=date.getUTCFullYear()+'-'+m+'-'+d;var u=fundfinder.url+',ctg,'+fundfinder.category+',date,'+fundfinder.calendarDate;if(fundfinder.hash!=null){u=u+'#'+fundfinder.hash}window.location.href=u},initHistory:function(){$.history.init(function(hash){if(!fundfinder.historyInserting){if(hash!=""){fundfinder.resetParams();var params=hash.replace('#','').split('--');for(var i in params){if(params[i]=='sb'){fundfinder.sortBy=params[i*1+1]}if(params[i]=='so'){fundfinder.sortOrd=params[i*1+1]}if(params[i]=='cs'){fundfinder.columnSelects=params[i*1+1].split('-')}if(params[i]=='f'){fundfinder.filter=params[i*1+1]}}fundfinder.resetSelects();fundfinder.filterByFtp();fundfinder.sort(fundfinder.sortBy,fundfinder.sortOrd);fundfinder.update();fundfinder.resetSortSwitch()}else{fundfinder.resetParams();fundfinder.resetSelects();fundfinder.update();fundfinder.resetSortSwitch()}}fundfinder.historyInserting=false},{unescape:",/"})},resetParams:function(){fundfinder.sortBy=null;fundfinder.sortOrd=null;fundfinder.filter=null;fundfinder.columnSelects=['1D','1M','1Y']},resetSelects:function(){fundfinder.setSelectByValue('#ffFilterFtp',fundfinder.filter);fundfinder.setSelectByValue('#ffSelectCol1',fundfinder.columnSelects[0]);fundfinder.setSelectByValue('#ffSelectCol2',fundfinder.columnSelects[1]);fundfinder.setSelectByValue('#ffSelectCol3',fundfinder.columnSelects[2])},resetSortSwitch:function(){$('#fundfinder .sort a').removeClass('act');switch(fundfinder.sortBy+'_'+fundfinder.sortOrd){case'name_asc':$('#fndNameSort .up').addClass('act');break;case'name_desc':$('#fndNameSort .down').addClass('act');break;case'ftp_asc':$('#fndFtpSort .up').addClass('act');break;case'ftp_desc':$('#fndFtpSort .down').addClass('act');break;case'wanju_asc':$('#fndWanjuSort .up').addClass('act');break;case'wanju_desc':$('#fndWanjuSort .down').addClass('act');break;case'col1_asc':$('#fndCol1Sort .up').addClass('act');break;case'col1_desc':$('#fndCol1Sort .down').addClass('act');break;case'col2_asc':$('#fndCol2Sort .up').addClass('act');break;case'col2_desc':$('#fndCol2Sort .down').addClass('act');break;case'col3_asc':$('#fndCol3Sort .up').addClass('act');break;case'col3_desc':$('#fndCol3Sort .down').addClass('act');break}},setSelectByValue:function(select,value){if(value==null){$(select)[0].selectedIndex=0;return true}var opts=$(select)[0].options;for(var i in opts){if(opts[i]!=null&&opts[i].index!=null&&opts[i].value!=null){if(opts[i].value==value){$(select)[0].selectedIndex=opts[i].index;return true}}}return false},insertHistory:function(){var hash='';if(fundfinder.filter!=null){hash+='f--'+fundfinder.filter+'--'}if(fundfinder.sortBy!=null&&fundfinder.sortOrd!=null){hash+='sb--'+fundfinder.sortBy+'--so--'+fundfinder.sortOrd+'--'}hash+='cs--'+fundfinder.columnSelects.join('-');fundfinder.historyInserting=true;jQuery.history.load(hash);fundfinder.hash=hash},bindActions:function(){$('#ffFilterFtp').bind('change',fundfinder.filterFtpChange);$('#ffSelectCol1, #ffSelectCol2, #ffSelectCol3').bind('change',fundfinder.columnChange);$('#fnd_ctg').bind('change',function(){var u=fundfinder.url+',ctg,'+$(this).val()+',date,'+((fundfinder.calendarDate==null)?fundfinder.baseDate:fundfinder.calendarDate);if(fundfinder.hash!=null){u=u+'#'+fundfinder.hash}window.location.href=u});$('#fndNameSort .up').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('name','asc');return false});$('#fndNameSort .down').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('name','desc');return false});$('#fndFtpSort .up').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('ftp','asc');return false});$('#fndFtpSort .down').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('ftp','desc');return false});$('#fndWanjuSort .up').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('wanju','asc');return false});$('#fndWanjuSort .down').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('wanju','desc');return false});$('#fndCol1Sort .up').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('col1','asc');return false});$('#fndCol1Sort .down').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('col1','desc');return false});$('#fndCol2Sort .up').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('col2','asc');return false});$('#fndCol2Sort .down').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('col2','desc');return false});$('#fndCol3Sort .up').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('col3','asc');return false});$('#fndCol3Sort .down').bind('click',function(){$('#fundfinder .sort a').removeClass('act');$(this).addClass('act');fundfinder.sort('col3','desc');return false})},filterFtpChange:function(){fundfinder.filterByFtp();fundfinder.insertHistory();fundfinder.update()},columnChange:function(){fundfinder.columnSelects=[$('#ffSelectCol1').val(),$('#ffSelectCol2').val(),$('#ffSelectCol3').val()];fundfinder.sort(fundfinder.sortBy,fundfinder.sortOrd);fundfinder.insertHistory();fundfinder.update()},update:function(){$('.ffRow').remove();var src=fundfinder.data;if(fundfinder.filter!=null){src=fundfinder.filtered}for(i in src){$('#fundfinder').append('<tr class="ffRow '+((src[i].liquidation||src[i].merging)?'grName':'')+'">'+'<td class="fndName"><a href="'+src[i].url+'" '+((ftts!=null&&ftts.get(src[i].name)!==false)?'class="tta tt_'+ftts.get(src[i].name)+'"':'')+'>'+src[i].name+'</a>'+((src[i].liquidation)?'<br /><small>'+lang.w_procesie_likwidacji+'</small>':'')+((src[i].merging)?'<br /><small>'+lang.w_procesie_laczenia+'</small>':'')+'</td>'+'<td class="fndFtp">'+src[i].ftpName+'</td>'+'<td class="wanju">'+fundfinder.formatCurrency(src[i].wanju)+((src[i].date!==null)?'<br /><small>'+src[i].date+'</small>':'')+'</td>'+'<td class="cc1">'+fundfinder.formatChange(src[i]['p'+fundfinder.columnSelects[0]])+'</td>'+'<td class="cc2">'+fundfinder.formatChange(src[i]['p'+fundfinder.columnSelects[1]])+'</td>'+'<td class="cc3">'+fundfinder.formatChange(src[i]['p'+fundfinder.columnSelects[2]])+'</td>'+'<td class="last"><a href="'+src[i].url+'#'+(lang.wykres=='chart'?'fund_chart':lang.wykres)+'" class="chartLink">'+lang.wykres+'</a></td>'+'</tr>')}fundfinder.initBgColors()},sort:function(column,order){fundfinder.sortBy=column;fundfinder.sortOrd=order;fundfinder.insertHistory();switch(column+'_'+order){case'name_asc':fundfinder.data.sort(fundfinder.sortNameAsc);break;case'name_desc':fundfinder.data.sort(fundfinder.sortNameDesc);break;case'ftp_asc':fundfinder.data.sort(fundfinder.sortFtpAsc);break;case'ftp_desc':fundfinder.data.sort(fundfinder.sortFtpDesc);break;case'wanju_asc':fundfinder.data.sort(fundfinder.sortWanjuAsc);break;case'wanju_desc':fundfinder.data.sort(fundfinder.sortWanjuDesc);break;case'col1_asc':fundfinder.data.sort(fundfinder.sortCol1Asc);break;case'col1_desc':fundfinder.data.sort(fundfinder.sortCol1Desc);break;case'col2_asc':fundfinder.data.sort(fundfinder.sortCol2Asc);break;case'col2_desc':fundfinder.data.sort(fundfinder.sortCol2Desc);break;case'col3_asc':fundfinder.data.sort(fundfinder.sortCol3Asc);break;case'col3_desc':fundfinder.data.sort(fundfinder.sortCol3Desc);break};fundfinder.update()},sortNameAsc:function(a,b){if(a.name==b.name)return 0;if(a.name>=b.name)return 1;return-1},sortNameDesc:function(a,b){if(a.name==b.name)return 0;if(a.name>=b.name)return-1;return 1},sortFtpAsc:function(a,b){if(a.ftpId==null&&b.ftpId==null)return 0;if(a.ftpId==null)return 1;if(b.ftpId==null)return-1;if(a.ftpOrder==b.ftpOrder)return 0;if(a.ftpOrder>=b.ftpOrder)return 1;return-1},sortFtpDesc:function(a,b){if(a.ftpId==null&&b.ftpId==null)return 0;if(a.ftpId==null)return 1;if(b.ftpId==null)return-1;if(a.ftpOrder==b.ftpOrder)return 0;if(a.ftpOrder>=b.ftpOrder)return-1;return 1},sortWanjuAsc:function(a,b){if(a.wanju==null&&b.wanju==null)return 0;if(a.wanju==null)return 1;if(b.wanju==null)return-1;if(a.wanju==b.wanju)return 0;if(a.wanju>=b.wanju)return 1;return-1},sortWanjuDesc:function(a,b){if(a.wanju==null&&b.wanju==null)return 0;if(a.wanju==null)return 1;if(b.wanju==null)return-1;if(a.wanju==b.wanju)return 0;if(a.wanju>=b.wanju)return-1;return 1},sortCol1Asc:function(a,b){if(a['p'+fundfinder.columnSelects[0]]==null&&b['p'+fundfinder.columnSelects[0]]==null)return 0;if(a['p'+fundfinder.columnSelects[0]]==null)return 1;if(b['p'+fundfinder.columnSelects[0]]==null)return-1;if(a['p'+fundfinder.columnSelects[0]]==b['p'+fundfinder.columnSelects[0]])return 0;if(a['p'+fundfinder.columnSelects[0]]>=b['p'+fundfinder.columnSelects[0]])return 1;return-1},sortCol1Desc:function(a,b){if(a['p'+fundfinder.columnSelects[0]]==null&&b['p'+fundfinder.columnSelects[0]]==null)return 0;if(a['p'+fundfinder.columnSelects[0]]==null)return 1;if(b['p'+fundfinder.columnSelects[0]]==null)return-1;if(a['p'+fundfinder.columnSelects[0]]==b['p'+fundfinder.columnSelects[0]])return 0;if(a['p'+fundfinder.columnSelects[0]]>=b['p'+fundfinder.columnSelects[0]])return-1;return 1},sortCol2Asc:function(a,b){if(a['p'+fundfinder.columnSelects[1]]==null&&b['p'+fundfinder.columnSelects[1]]==null)return 0;if(a['p'+fundfinder.columnSelects[1]]==null)return 1;if(b['p'+fundfinder.columnSelects[1]]==null)return-1;if(a['p'+fundfinder.columnSelects[1]]==b['p'+fundfinder.columnSelects[1]])return 0;if(a['p'+fundfinder.columnSelects[1]]>=b['p'+fundfinder.columnSelects[1]])return 1;return-1},sortCol2Desc:function(a,b){if(a['p'+fundfinder.columnSelects[1]]==null&&b['p'+fundfinder.columnSelects[1]]==null)return 0;if(a['p'+fundfinder.columnSelects[1]]==null)return 1;if(b['p'+fundfinder.columnSelects[1]]==null)return-1;if(a['p'+fundfinder.columnSelects[1]]==b['p'+fundfinder.columnSelects[1]])return 0;if(a['p'+fundfinder.columnSelects[1]]>=b['p'+fundfinder.columnSelects[1]])return-1;return 1},sortCol3Asc:function(a,b){if(a['p'+fundfinder.columnSelects[2]]==null&&b['p'+fundfinder.columnSelects[2]]==null)return 0;if(a['p'+fundfinder.columnSelects[2]]==null)return 1;if(b['p'+fundfinder.columnSelects[2]]==null)return-1;if(a['p'+fundfinder.columnSelects[2]]==b['p'+fundfinder.columnSelects[2]])return 0;if(a['p'+fundfinder.columnSelects[2]]>=b['p'+fundfinder.columnSelects[2]])return 1;return-1},sortCol3Desc:function(a,b){if(a['p'+fundfinder.columnSelects[2]]==null&&b['p'+fundfinder.columnSelects[0]]==null)return 0;if(a['p'+fundfinder.columnSelects[2]]==null)return 1;if(b['p'+fundfinder.columnSelects[2]]==null)return-1;if(a['p'+fundfinder.columnSelects[2]]==b['p'+fundfinder.columnSelects[2]])return 0;if(a['p'+fundfinder.columnSelects[2]]>=b['p'+fundfinder.columnSelects[2]])return-1;return 1},filterByFtp:function(){fundfinder.filtered=[];var fval=$('#ffFilterFtp').val();if(fval==0){fundfinder.filter=null;return}fundfinder.filter=fval;for(i in fundfinder.data){if(fundfinder.data[i].ftpId==fundfinder.filter){fundfinder.filtered[fundfinder.filtered.length]=fundfinder.data[i]}}},formatCurrency:function(n){if(n==null){return'<span class="empty">'+lang.brak+'</span>'}return(n.toFixed(2)+'').replace('.',',')+'&nbsp;'+lang.PLN},formatChange:function(n){if(n==null){return'<span class="empty">'+lang.brak+'</span>'}return(n.toFixed(2)+'').replace('.',',')+'%'},setBaseDate:function(str){fundfinder.baseDate=str},setMaxDate:function(str){fundfinder.maxDate=str}};var ftts={data:[],init:function(){if($('#content.art, #content.fundfinder').length>0){var cnt=$('#content.art, #content.fundfinder').html();for(var i in ftts.data){for(var j in ftts.data[i].n){var m=ftts.data[i].n[j];var r='$1<dfn class="tt tt_'+i+'">'+m+'</dfn>$2';var s='(\>[^\>\<]*)'+ftts.data[i].n[j]+'([^\>\<]*\<)';var reg=new RegExp(s,'g');cnt=cnt.replace(reg,r)}}$('#content').html(cnt);delete cnt,m,r;for(var i in ftts.data){$('.tt_'+i).each(function(){if(!$(this).parent('dfn').length){$(this).addClass('tta')}});$('.tta.tt_'+i).tipsy({gravity:'sw',offset:0,opacity:1,fallback:ftts.data[i].c,trigger:'hover',live:true,stayover:false})}}},get:function(str){for(var i in ftts.data){for(var j in ftts.data[i].n){if(ftts.data[i].n[j]==str){return i}}}return false}};var investCalc={fp:null,cp:null,ti:null,ir:null,plot:null,updateLegendTimeout:null,latestPosition:null,chartData:[],init:function(){investCalc.fp=new calcSlider('#firstPaymentBox',1000,0,25000,100,5000,0,10000000);investCalc.cp=new calcSlider('#cyclicPaymentBox',100,0,250,1,50,0,500000);investCalc.ti=new calcSlider('#timeOfInvestmentBox',10,8,13,1,1,1,99);investCalc.ir=new calcSlider('#investmentReturnBox',7,5,10,1,1,1,30);investCalc.calculate();$('#rangePaymentBox input.rangePayment').bind('change',investCalc.calculate);$("#chartBox").bind("plothover",function(event,pos,item){investCalc.latestPosition=pos;if(!investCalc.updateLegendTimeout){investCalc.updateLegendTimeout=setTimeout(investCalc.updateLegend,50)}});$("#chartBox").bind("mouseout",function(){investCalc.plot.unhighlight();$('#resultHighlight').html('')})},calculate:function(){var value=0;var B1=~~investCalc.fp.value;var B2=~~investCalc.cp.value;var B3=~~investCalc.ti.value;var B5=~~$('.rangePayment:checked').val();var B6=~~investCalc.ir.value/100;value=(B2*((Math.pow((1+B6/B5),(B3*B5)))-1)/(B6/B5)*(1+B6/B5))+(B1*Math.pow((1+B6),B3));$('#resultValue strong').html(value.toMoney(2,',',' '));investCalc.chartData=[];for(var i=0;i<=B3;i+=1){value=(B2*((Math.pow((1+B6/B5),(i*B5)))-1)/(B6/B5)*(1+B6/B5))+(B1*Math.pow((1+B6),i));investCalc.chartData.push([i.toFixed(0),value])}investCalc.plot=$.plot($("#chartBox"),[{data:investCalc.chartData,color:'#af0c10',lines:{show:true,fill:true}}],{series:{lines:{show:true}},crosshair:{mode:"x"},grid:{hoverable:true,autoHighlight:true,borderWidth:1,borderColor:'#d9d9d9'},xaxis:{tickFormatter:function(val,axis){return val.toFixed(0)}},yaxis:{tickFormatter:function(val,axis){return val.toMoney(0,',',' ')}}})},updateLegend:function(){investCalc.updateLegendTimeout=null;var pos=investCalc.latestPosition;var axes=investCalc.plot.getAxes();if(pos.x<axes.xaxis.min||pos.x>axes.xaxis.max||pos.y<axes.yaxis.min||pos.y>axes.yaxis.max)return;var i,j,val,dataset=investCalc.plot.getData();for(i=0;i<dataset.length;++i){var series=dataset[i];j=Math.round(pos.x);val=Math.round(series.data[j][1]*100,2)/100;$('#resultHighlight').html(lang.rok+' '+(j)+': '+lang.kapital+' '+val.toMoney(2,',',' ')+' '+lang.PLN);investCalc.plot.unhighlight();investCalc.plot.highlight(series,series.data[j])}}};function calcSlider(box,value,sliderMin,sliderMax,sliderStep,legendStep,totalMin,totalMax){var self=this;this.box=$(box);this.sliderDiv=$(box).find('.slider');this.valueField=$(box).find('input');this.leftCtrl=$(box).find('.sliderCtrlL');this.rightCtrl=$(box).find('.sliderCtrlR');this.value=value;this.sliderOpts={value:value,min:sliderMin,max:sliderMax,step:sliderStep,slide:function(event,ui){self.moving(event,ui)},stop:function(event,ui){self.moved(event,ui)}};this.pan=null;this.legendStep=legendStep;this.legendLabels=[];this.totalMin=totalMin;this.totalMax=totalMax;this.midRange={min:this.sliderOpts.min+2*this.legendStep,max:this.sliderOpts.min+3*this.legendStep};this.leftCtrl.bind('click',function(){self.panLeft();return false});this.rightCtrl.bind('click',function(){self.panRight();return false});this.valueField.bind('blur',function(){self.fieldUpdateTrigger(this)});this.valueField.bind('keydown',function(event){if(event.keyCode=='13'){self.fieldUpdateTrigger(this)}});this.init()};calcSlider.prototype.init=function(){this.sliderDiv.slider(this.sliderOpts);this.valueField.val(this.value.toMoney(0,',',' '))};calcSlider.prototype.moving=function(event,ui){this.value=ui.value;this.valueField.val(ui.value.toMoney(0,',',' '));investCalc.calculate()};calcSlider.prototype.moved=function(){if(this.value>this.midRange.max||this.value<this.midRange.min){this.updateSlider()}};calcSlider.prototype.updateSlider=function(){var newRange={min:Math.floor(this.value/this.legendStep)*this.legendStep,max:Math.ceil(this.value/this.legendStep)*this.legendStep};if(newRange.min==newRange.max){if(this.pan=='R'){newRange.min-=this.legendStep}else{newRange.max+=this.legendStep}}var label0=newRange.min-(2*this.legendStep);var label5=newRange.max+(2*this.legendStep);if(label0<this.totalMin){label0=this.totalMin}if(label5>this.totalMax){label0=this.totalMax-(5*this.legendStep)}this.legendLabels=[];for(var i=0;i<6;i++){this.legendLabels[i]=~~label0+i*this.legendStep}this.sliderOpts.value=this.value;this.sliderOpts.min=this.legendLabels[0];this.sliderOpts.max=this.legendLabels[5];this.midRange.min=this.legendLabels[2];this.midRange.max=this.legendLabels[3];this.sliderDiv.slider('option',this.sliderOpts);this.sliderDiv.slider('value',this.value);this.updateLabels()};calcSlider.prototype.updateLabels=function(){for(var i=0;i<6;i++){this.box.find('.legend .l'+i).html(this.legendLabels[i].toMoney(0,',',' '))}};calcSlider.prototype.panLeft=function(){this.pan='L';var nV=this.value-this.legendStep;if(nV<=this.totalMin){nV=this.totalMin}this.value=nV;this.valueField.val(nV.toMoney(0,',',' '));this.sliderDiv.slider('value',this.value);this.moved();investCalc.calculate()};calcSlider.prototype.panRight=function(){this.pan='R';var nV=this.value+this.legendStep;if(nV>=this.totalMax){nV=this.totalMax}this.value=nV;this.valueField.val(nV.toMoney(0,',',' '));this.sliderDiv.slider('value',this.value);this.moved();investCalc.calculate()};calcSlider.prototype.fieldUpdateTrigger=function(e){var v=~~$(e).val().split(' ').join('');if(v<this.totalMin){v=this.totalMin}if(v>this.totalMax){v=this.totalMax}this.value=v;this.sliderDiv.slider('value',this.value);this.valueField.val(v.toMoney(0,',',' '));this.moved();investCalc.calculate()};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):'')};var wallet={data:[],columnSelects:['6M','1Y'],init:function(){$('#otherWallets').bind('change',function(){window.location.href=$(this).val()+window.location.hash});$('#ffSelectCol1, #ffSelectCol2').bind('change',wallet.columnChange);wallet.update()},columnChange:function(){wallet.columnSelects=[$('#ffSelectCol1').val(),$('#ffSelectCol2').val()];wallet.update()},update:function(){$('.ffRow').remove();var src=wallet.data;for(i in src){$('#fundfinder').append('<tr class="ffRow '+((src[i].liquidation||src[i].merging)?'grName':'')+'">'+'<td class="fndName"><a href="'+src[i].url+'" '+((ftts!=null&&ftts.get(src[i].name)!==false)?'class="tta tt_'+ftts.get(src[i].name)+'"':'')+'>'+src[i].name+'</a>'+((src[i].liquidation)?'<br /><small>'+lang.w_procesie_likwidacji+'</small>':'')+((src[i].merging)?'<br /><small>'+lang.w_procesie_laczenia+'</small>':'')+'</td>'+'<td class="fndFtp">'+src[i].ftpName+'</td>'+'<td class="share">'+src[i].share+'</td>'+'<td class="cc1">'+fundfinder.formatChange(src[i]['p'+wallet.columnSelects[0]])+'</td>'+'<td class="cc2">'+fundfinder.formatChange(src[i]['p'+wallet.columnSelects[1]])+'</td>'+'</tr>')}fundfinder.initBgColors()},initBgColors:function(){$('#fundfinder .ffrGr').removeClass('ffrGr');$('#fundfinder .ffRow:odd').addClass('ffrGr')}};
