(function(a){a.fn.accordion=function(b){b=a.extend({slideSpeed:200,openFirst:true},b);a(this).find("div").hide();a(this).find(window.location.hash).length?(a(this).find("a[href='"+window.location.hash+"']").addClass("active"),a(window.location.hash).show()):b.openFirst&&(a(this).find("a:first").addClass("active"),a(this).find("div:first").show());a(this).find("a").click(function(d){d.preventDefault();d=a(this).hasClass("active");a(this).parent().find("a").removeClass("active");a(this).parent().find("div").slideUp(b.slideSpeed);
d||(a(this).addClass("active"),a(this).parent().find("div"+a(this).attr("href")).slideDown(b.slideSpeed))});return a(this)}})(jQuery);(function(a){a.fn.message=function(b){b=a.extend({fadeSpeed:200},b);a(this).find("a").click(function(){a(this).parent().fadeOut(b.fadeSpeed)});return a(this)}})(jQuery);
(function(a){a.fn.modal=function(b){var b=a.extend({buttons:[],closeButton:true,elId:"modal",fade:false,height:"auto",width:"auto"},b),d=false,c=false;a(this).attr("href")&&a(this).attr("href").indexOf("http")>=0?d=a(this).attr("href"):c=a(this).attr("title");var e=function(){a(".modal-inner").remove();a(".modal-outer").remove();a(".modal-close").remove()},f=function(){a(".modal-outer").css({height:a(document).height(),left:a(window).scrollLeft(),top:0,width:"100%"});a(".modal-inner").css({left:Math.floor(a(window).width()/
2)-Math.floor(a(".modal-inner").outerWidth()/2)+a(window).scrollLeft()+"px",top:Math.floor(a(window).height()/2)-Math.floor(a(".modal-inner").outerHeight()/2)+a(window).scrollTop()+"px"});b.closeButton&&a(".modal-close").css({left:Math.floor(a(window).width()/2)+Math.floor(a(".modal-inner").outerWidth()/2)-Math.floor(a(".modal-close").width()/2)+a(window).scrollLeft()+"px",top:Math.floor(a(window).height()/2)-Math.floor(a(".modal-inner").outerHeight()/2)-Math.floor(a(".modal-close").height()/2)+a(window).scrollTop()+
"px"})},g=function(){b.fade?a(".modal-outer").fadeIn(b.fade,function(){a(".modal-inner, .modal-close").show()}):a(".modal-inner, .modal-outer, .modal-close").show();b.closeButton&&a(".modal-outer").click(function(){e()})};a(window).resize(function(){f()}).scroll(function(){f()});a(this).click(function(h){h.preventDefault();a("<div />").addClass("modal-outer").appendTo("body").hide();a("<div />").addClass("modal-inner").css({height:b.height,width:b.width}).appendTo("body").hide();b.closeButton&&a("<a />").addClass("modal-close").click(function(a){a.preventDefault();
e()}).appendTo("body").hide();a("<div />").addClass("body").appendTo(".modal-inner");b.buttons.length&&(a("<div />").addClass("footer").appendTo(".modal-inner"),a.each(b.buttons,function(b,c){a("<button />").attr("id","button-"+b).appendTo(".modal-inner > .footer");typeof c.html!="undefined"&&a("#button-"+b).html(c.html);typeof c.type=="string"&&a("#button-"+b).addClass(c.type);typeof c.type=="object"&&a.each(c.type,function(c,d){a("#button-"+b).addClass(d)});a("#button-"+b).click(function(){typeof c.action!=
"undefined"&&c.action();e()})}));d?(a("<iframe />").attr({frameBorder:0,src:d}).appendTo(".modal-inner > .body"),a(".modal-inner > .body").height("100%")):a(".modal-inner > .body").html("<div>"+c+"</div>");f();g()});return a(this)}})(jQuery);
(function(a){a.fn.scale=function(b){var b=a.extend({height:void 0,ratio:void 0,width:void 0},b),d=a(this).height(),c=a(this).width(),e=b.height,f=b.width;typeof b.height!="undefined"?f=typeof b.ratio=="object"?b.height*b.ratio[0]/b.ratio[1]:b.height*c/d:typeof b.width!="undefined"&&(e=typeof b.ratio=="object"?b.width*b.ratio[1]/b.ratio[0]:b.width*d/c);a(this).width(f).height(e);return a(this)}})(jQuery);
(function(a){a.fn.tabs=function(b){b=a.extend({fadeSpeed:200},b);a(this).next().find("div").hide();a(this).next().find(window.location.hash).length?(a(this).find("a[href='"+window.location.hash+"']").parent().addClass("active"),a(window.location.hash).show()):(a(this).find("li:first-child").addClass("active"),a(this).next().find("div:first-child").show());a(this).find("a").click(function(d){d.preventDefault();a(this).parent().parent().find("li").removeClass("active");a(this).parent().addClass("active");
a(this).parent().parent().next().find("div").hide();a(this).parent().parent().next().find("div"+a(this).attr("href")).fadeIn(b.fadeSpeed)});return a(this)}})(jQuery);
(function(a){a.fn.tooltip=function(b){var b=a.extend({attrName:"title",delay:200,elId:"tooltip",fade:200,position:"top",size:"normal"},b),d;a(this).mouseover(function(){a("#"+b.elId).remove();a("<div />").attr("id",b.elId).appendTo("body").hide();b.size!="normal"&&a("#"+b.elId).addClass(b.size);a("<div />").addClass("arrow").appendTo("#"+b.elId);a("<div />").addClass("content").html(a(this).attr(b.attrName)).appendTo("#"+b.elId);var c=a(this).position(),e=b.position;switch(e){case "right":c.left-
a(window).scrollLeft()+a(this).outerWidth()+a("#"+b.elId).outerWidth()+15>a(window).width()&&(e="left");break;case "bottom":c.top-a(window).scrollTop()+a(this).outerHeight()+a("#"+b.elId).outerHeight()+15>a(window).height()&&(e="top");break;case "left":c.left-a(window).scrollLeft()<a("#"+b.elId).outerWidth()+15&&(e="right");break;default:c.top-a(window).scrollTop()<a("#"+b.elId).outerHeight()+15&&(e="bottom")}a("#"+b.elId).addClass(e);switch(e){case "right":var f=c.top+a(this).outerHeight()/2-a("#"+
b.elId).outerHeight()/2,g=c.left+a(this).outerWidth()+10;break;case "bottom":f=c.top+a(this).outerHeight()+10;g=c.left+a(this).outerWidth()/2-a("#"+b.elId).outerWidth()/2;break;case "left":f=c.top+a(this).outerHeight()/2-a("#"+b.elId).outerHeight()/2;g=c.left-a("#"+b.elId).outerWidth()-10;break;default:f=c.top-a("#"+b.elId).outerHeight()-5,g=c.left+a(this).outerWidth()/2-a("#"+b.elId).outerWidth()/2}a(this).attr(b.attrName,"");b.delay?d=setTimeout(function(){a("#"+b.elId).css({top:f,left:g}).fadeIn(b.fade?
b.fade:0)},b.delay):a("#"+b.elId).css({top:f,left:g}).fadeIn(b.fade?b.fade:0)}).bind("mouseout click",function(){clearTimeout(d);a("#"+b.elId+" > .content").html()&&a(this).attr(b.attrName,a("#"+b.elId+" > .content").html());a("#"+b.elId).remove()});return a(this)}})(jQuery);

