(function(a){var i="span:eq(0)",e="selected",j="a.selected",g=".jNiceSelectWrapper",d=false,h="jNiceHidden",b="jNiceChecked",f="input",k=".jNiceInputWrapper",c="jNiceFocus";a.fn.jNice=function(){var e=this,b=a.browser.safari;a(document).mousedown(o);return this.each(function(){var d=this;a("input:submit, input:reset, input:button",d).each(q);a("button").focus(function(){a(this).addClass(c)}).blur(function(){a(this).removeClass(c)});a("input:text:visible, input:password",d).each(t);b&&a(k).each(function(){a(this).addClass("jNiceSafari").find(f).css("width",a(this).width()+11)});a("input:checkbox",d).each(r);a("input:radio",d).each(s);a("select",d).each(function(a){n(this,a)});a(d).bind("reset",function(){var a=function(){u(this)};window.setTimeout(a,10)});a(".jNiceHidden").css({opacity:0})})};var u=function(c){var d;a(".jNiceSelectWrapper select",c).each(function(){d=this.selectedIndex<0?0:this.selectedIndex;a("ul",a(this).parent()).each(function(){a("a:eq("+d+")",this).click()})});a("a.jNiceCheckbox, a.jNiceRadio",c).removeClass(b);a("input:checkbox, input:radio",c).each(function(){this.checked&&a("a",a(this).parent()).addClass(b)})},s=function(){var g=".jNiceRadio",i='input:radio[name="',e="checked",k=a(this).addClass(h).wrap('<span class="jRadioWrapper jNiceWrapper"></span>'),l=k.parent(),j=a('<span class="jNiceRadio"></span>');l.prepend(j);j.click(function(){var c=a(this).addClass(b).siblings(f).attr(e,true);a(i+c.attr("name")+'"]').not(c).each(function(){a(this).attr(e,d).siblings(g).removeClass(b)});return d});k.click(function(){if(this.checked){var c=a(this).siblings(g).addClass(b).end();a(i+c.attr("name")+'"]').not(c).each(function(){a(this).attr(e,d).siblings(g).removeClass(b)})}}).focus(function(){j.addClass(c)}).blur(function(){j.removeClass(c)});this.checked&&j.addClass(b)},r=function(){var e=".jNiceCheckbox",j=a(this).addClass(h).wrap('<span class="jNiceWrapper"></span>'),i=j.parent().append('<span class="jNiceCheckbox"></span>'),g=i.find(e).click(function(){var e=a(this),c=e.siblings(f)[0];if(c.checked===true){c.checked=d;e.removeClass(b)}else{c.checked=true;e.addClass(b)}return d});j.click(function(){if(this.checked)g.addClass(b);else g.removeClass(b)}).focus(function(){g.addClass(c)}).blur(function(){g.removeClass(c)});this.checked&&a(e,i).addClass(b)},t=function(){var b="jNiceInputWrapper_hover",d=a(this).addClass("jNiceInput").wrap('<div class="jNiceInputWrapper"><div class="jNiceInputInner"></div></div>'),c=d.parents(k);d.focus(function(){c.addClass(b)}).blur(function(){c.removeClass(b)})},q=function(){var b=this,c=a(b).attr("value");a(b).replaceWith('<button id="'+b.id+'" name="'+b.name+'" type="'+b.type+'" class="'+b.className+'" value="'+c+'"><span><span>'+c+"</span></span>")},m=function(){a(".jNiceSelectWrapper ul:visible").hide()},o=function(b){a(b.target).parents(g).length===0&&m()},n=function(n,k){var b=a(n);k=k||b.css("zIndex")*1;k=k?k:0;b.wrap(a('<div class="jNiceWrapper"></div>').css({zIndex:100-k}));var o=b.width();b.addClass(h).after('<div class="jNiceSelectWrapper"><div><span class="jNiceSelectText"></span><span class="jNiceSelectOpen"></span></div><ul></ul></div>');var f=a(n).siblings(g).css({width:o+"px"});a(".jNiceSelectText, .jNiceSelectWrapper ul",f).width(o-a(".jNiceSelectOpen",f).width());a.browser.msie&&jQuery.browser.version<7&&b.after(a('<iframe src="javascript:\'\';" marginwidth="0" marginheight="0" align="bottom" scrolling="no" tabIndex="-1" frameborder="0"></iframe>').css({height:b.height()+4+"px"}));l(n);a("div",f).click(function(){var b=a(this).siblings("ul");b.css("display")=="none"&&m();b.slideToggle();var c=a(j,b).offset().top-b.offset().top;b.animate({scrollTop:c});return d});b.keydown(function(g){var c=this.selectedIndex;switch(g.keyCode){case 40:if(c<this.options.length-1)c+=1;break;case 38:if(c>0)c-=1;break;default:return}a("ul a",f).removeClass(e).eq(c).addClass(e);a(i,f).html(a("option:eq("+c+")",b).attr(e,e).text());return d}).focus(function(){f.addClass(c)}).blur(function(){f.removeClass(c)})},l=function(h){var b=a(h),f=b.siblings(g),c=f.find("ul").find("li").remove().end().hide();a("option",b).each(function(a){c.append('<li><a href="#" index="'+a+'">'+this.text+"</a></li>")});c.find("a").click(function(){var g="index",h=this;a(j,f).removeClass(e);a(h).addClass(e);if(b[0].selectedIndex!=a(h).attr(g)&&b[0].onchange){b[0].selectedIndex=a(h).attr(g);b[0].onchange()}b[0].selectedIndex=a(h).attr(g);a(i,f).html(a(h).html());c.hide();return d});a("a:eq("+b[0].selectedIndex+")",c).click()},p=function(b){var c=a(b).siblings(g).css("zIndex");a(b).css({zIndex:c}).removeClass(h);a(b).siblings(g).remove()};a.jNice={SelectAdd:function(a,b){n(a,b)},SelectRemove:function(a){p(a)},SelectUpdate:function(a){l(a)}};a(function(){a("form.jNice").jNice()})})(jQuery);(function(a){var c="tooltip",f="mouseenter,mouseleave",b=true,d="center";function g(a,g,b){var f=b.relative?a.position().top:a.offset().top,e=b.relative?a.position().left:a.offset().left,c=b.position[0];f-=g.outerHeight()-b.offset[0];e+=a.outerWidth()+b.offset[1];var h=g.outerHeight()+a.outerHeight();if(c==d)f+=h/2;if(c=="bottom")f+=h;c=b.position[1];a=g.outerWidth()+a.outerWidth();if(c==d)e-=a/2;if(c=="left")e-=a;return{top:f,left:e}}function h(f,c){var i="title",d=this,m=f.add(d),h,n=0,o=0,l=f.attr(i),p=e[c.effect],j,q=f.is(":input"),s=q&&f.is(":checkbox, :radio, select, :button"),r=f.attr("type"),k=c.events[r]||c.events[q?s?"widget":"input":"def"];if(!p)throw'Nonexistent effect "'+c.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+r;f.bind(k[0],function(a){if(c.predelay){clearTimeout(n);o=setTimeout(function(){d.show(a)},c.predelay)}else d.show(a)}).bind(k[1],function(a){if(c.delay){clearTimeout(o);n=setTimeout(function(){d.hide(a)},c.delay)}else d.hide(a)});if(l&&c.cancelDefault){f.removeAttr(i);f.data(i,l)}a.extend(d,{show:function(i){if(!h){if(l)h=a(c.layout).addClass(c.tipClass).appendTo(document.body).hide();else if(c.tip)h=a(c.tip).eq(0);else{h=f.next();h.length||(h=f.parent().next())}if(!h.length)throw"Cannot find tooltip for "+f;}if(d.isShown())return d;h.stop(b,b);var e=g(f,h,c);l&&h.html(l);i=i||a.Event();i.type="onBeforeShow";m.trigger(i,[e]);if(i.isDefaultPrevented())return d;e=g(f,h,c);h.css({position:"absolute",top:e.top,left:e.left});j=b;p[0].call(d,function(){i.type="onShow";j="full";m.trigger(i)});e=c.events.tooltip.split(/,\s*/);h.bind(e[0],function(){clearTimeout(n);clearTimeout(o)});e[1]&&!f.is("input:not(:checkbox, :radio), textarea")&&h.bind(e[1],function(a){a.relatedTarget!=f[0]&&f.trigger(k[1].split(" ")[0])});return d},hide:function(b){if(!h||!d.isShown())return d;b=b||a.Event();b.type="onBeforeHide";m.trigger(b);if(!b.isDefaultPrevented()){j=false;e[c.effect][1].call(d,function(){b.type="onHide";j=false;m.trigger(b)});return d}},isShown:function(a){return a?j=="full":j},getConf:function(){return c},getTip:function(){return h},getTrigger:function(){return f}});a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,b){a.isFunction(c[b])&&a(d).bind(b,c[b]);d[b]=function(c){a(d).bind(b,c);return d}})}a.tools=a.tools||{version:"1.2.0"};a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top",d],offset:[0,0],relative:false,cancelDefault:b,events:{def:f,input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:f},layout:"<div/>",tipClass:c},addEffect:function(a,b,c){e[a]=[b,c]}};var e={toggle:[function(c){var a=this.getConf(),b=this.getTip();a=a.opacity;a<1&&b.css({opacity:a});b.show();c.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){this.getTip().fadeIn(this.getConf().fadeInSpeed,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};a.fn.tooltip=function(d){var e=this.data(c);if(e)return e;d=a.extend(b,{},a.tools.tooltip.conf,d);if(typeof d.position=="string")d.position=d.position.split(/,?\s/);this.each(function(){e=new h(a(this),d);a(this).data(c,e)});return d.api?e:this}})(jQuery);(function(a){var c=a.tools.tooltip;a.extend(c.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var b={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};c.addEffect("slide",function(f){var a=this.getConf(),e=this.getTip(),c=a.slideFade?{opacity:a.opacity}:{},d=b[a.direction]||b.up;c[d[1]]=d[0]+"="+a.slideOffset;a.slideFade&&e.css({opacity:0});e.show().animate(c,a.slideInSpeed,f)},function(h){var c=this.getConf(),g=c.slideOffset,e=c.slideFade?{opacity:0}:{},f=b[c.direction]||b.up,d=""+f[0];if(c.bounce)d=d=="+"?"-":"+";e[f[1]]=d+"="+g;this.getTip().animate(e,c.slideOutSpeed,function(){a(this).hide();h.call()})})})(jQuery);(function(a){function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){for(var b=a.length;b--;)if(a[b])return false;return true}var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};a.fn.dynamic=function(e){if(typeof e=="number")e={speed:e};e=a.extend({},b.dynamic.conf,e);var g=e.classNames.split(/\s/),f;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(i,h){i=this.getTip();var b=this.getConf();f||(f=[b.position[0],b.position[1],b.offset[0],b.offset[1],a.extend({},b)]);a.extend(b,f[4]);b.position=[f[0],f[1]];b.offset=[f[2],f[3]];i.css({visibility:"hidden",position:"absolute",top:h.top,left:h.left}).show();h=c(i);if(!d(h)){if(h[2]){a.extend(b,e.top);b.position[0]="top";i.addClass(g[0])}if(h[3]){a.extend(b,e.right);b.position[1]="right";i.addClass(g[1])}if(h[0]){a.extend(b,e.bottom);b.position[0]="bottom";i.addClass(g[2])}if(h[1]){a.extend(b,e.left);b.position[1]="left";i.addClass(g[3])}if(h[0]||h[2])b.offset[0]*=-1;if(h[1]||h[3])b.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf();this.getTip();setTimeout(function(){a.position=[f[0],f[1]];a.offset=[f[2],f[3]]},0)});b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)});ret=b});return e.api?ret:this}})(jQuery)
