(function(d){d.tools=d.tools||{version:"1.2.5"};d.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(e,g,f){c[e]=[g,f]}};var c={toggle:[function(e){var f=this.getConf(),g=this.getTip(),h=f.opacity;if(h<1){g.css({opacity:h})}g.show();e.call()},function(e){this.getTip().hide();e.call()}],fade:[function(e){var f=this.getConf();this.getTip().fadeTo(f.fadeInSpeed,f.opacity,e)},function(e){this.getTip().fadeOut(this.getConf().fadeOutSpeed,e)}]};function b(g,i,f){var k=f.relative?g.position().top:g.offset().top,j=f.relative?g.position().left:g.offset().left,l=f.position[0];k-=i.outerHeight()-f.offset[0];j+=g.outerWidth()+f.offset[1];if(/iPad/i.test(navigator.userAgent)){k-=d(window).scrollTop()}var e=i.outerHeight()+g.outerHeight();if(l=="center"){k+=e/2}if(l=="bottom"){k+=e}l=f.position[1];var h=i.outerWidth()+g.outerWidth();if(l=="center"){j-=h/2}if(l=="left"){j-=h}return{top:k,left:j}}function a(h,j){var r=this,g=h.add(r),o,f=0,q=0,m=h.attr("title"),i=h.attr("data-tooltip"),s=c[j.effect],n,l=h.is(":input"),e=l&&h.is(":checkbox, :radio, select, :button, :submit"),k=h.attr("type"),p=j.events[k]||j.events[l?(e?"widget":"input"):"def"];if(!s){throw'Nonexistent effect "'+j.effect+'"'}p=p.split(/,\s*/);if(p.length!=2){throw"Tooltip: bad events configuration for "+k}h.bind(p[0],function(t){clearTimeout(f);if(j.predelay){q=setTimeout(function(){r.show(t)},j.predelay)}else{r.show(t)}}).bind(p[1],function(t){clearTimeout(q);if(j.delay){f=setTimeout(function(){r.hide(t)},j.delay)}else{r.hide(t)}});if(m&&j.cancelDefault){h.removeAttr("title");h.data("title",m)}d.extend(r,{show:function(u){if(!o){if(i){o=d(i)}else{if(j.tip){o=d(j.tip).eq(0)}else{if(m){o=d(j.layout).addClass(j.tipClass).appendTo(document.body).hide().append(m)}else{o=h.next();if(!o.length){o=h.parent().next()}}}}if(!o.length){throw"Cannot find tooltip for "+h}}if(r.isShown()){return r}o.stop(true,true);var v=b(h,o,j);if(j.tip){o.html(h.data("title"))}u=u||d.Event();u.type="onBeforeShow";g.trigger(u,[v]);if(u.isDefaultPrevented()){return r}v=b(h,o,j);o.css({position:"absolute",top:v.top,left:v.left});n=true;s[0].call(r,function(){u.type="onShow";n="full";g.trigger(u)});var t=j.events.tooltip.split(/,\s*/);if(!o.data("__set")){o.bind(t[0],function(){clearTimeout(f);clearTimeout(q)});if(t[1]&&!h.is("input:not(:checkbox, :radio), textarea")){o.bind(t[1],function(w){if(w.relatedTarget!=h[0]){h.trigger(p[1].split(" ")[0])}})}o.data("__set",true)}return r},hide:function(t){if(!o||!r.isShown()){return r}t=t||d.Event();t.type="onBeforeHide";g.trigger(t);if(t.isDefaultPrevented()){return}n=false;c[j.effect][1].call(r,function(){t.type="onHide";g.trigger(t)});return r},isShown:function(t){return t?n=="full":n},getConf:function(){return j},getTip:function(){return o},getTrigger:function(){return h}});d.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(u,t){if(d.isFunction(j[t])){d(r).bind(t,j[t])}r[t]=function(v){if(v){d(r).bind(t,v)}return r}})}d.fn.tooltip=function(e){var f=this.data("tooltip");if(f){return f}e=d.extend(true,{},d.tools.tooltip.conf,e);if(typeof e.position=="string"){e.position=e.position.split(/,?\s/)}this.each(function(){f=new a(d(this),e);d(this).data("tooltip",f)});return e.api?f:this}})(jQuery);(function(b){var a=b.tools.tooltip;b.extend(a.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!b.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};a.addEffect("slide",function(d){var f=this.getConf(),g=this.getTip(),h=f.slideFade?{opacity:f.opacity}:{},e=c[f.direction]||c.up;h[e[1]]=e[0]+"="+f.slideOffset;if(f.slideFade){g.css({opacity:0})}g.show().animate(h,f.slideInSpeed,d)},function(e){var g=this.getConf(),i=g.slideOffset,h=g.slideFade?{opacity:0}:{},f=c[g.direction]||c.up;var d=""+f[0];if(g.bounce){d=d=="+"?"-":"+"}h[f[1]]=d+"="+i;this.getTip().animate(h,g.slideOutSpeed,function(){b(this).hide();e.call()})})})(jQuery);(function(c){c.tools=c.tools||{version:"1.2.5"};c.tools.overlay={addEffect:function(e,f,g){b[e]=[f,g]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!c.browser.msie||c.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var d=[],b={};c.tools.overlay.addEffect("default",function(h,g){var f=this.getConf(),e=c(window);if(!f.fixed){h.top+=e.scrollTop();h.left+=e.scrollLeft()}h.position=f.fixed?"fixed":"absolute";this.getOverlay().css(h).fadeIn(f.speed,g)},function(e){this.getOverlay().fadeOut(this.getConf().closeSpeed,e)});function a(h,m){var o=this,f=h.add(o),n=c(window),k,j,i,e=c.tools.expose&&(m.mask||m.expose),l=Math.random().toString().slice(10);if(e){if(typeof e=="string"){e={color:e}}e.closeOnClick=e.closeOnEsc=false}var g=m.target||h.attr("rel");j=g?c(g):null||h;if(!j.length){throw"Could not find Overlay: "+g}if(h&&h.index(j)==-1){h.click(function(p){o.load(p);return p.preventDefault()})}c.extend(o,{load:function(u){if(o.isOpened()){return o}var r=b[m.effect];if(!r){throw'Overlay: cannot find effect : "'+m.effect+'"'}if(m.oneInstance){c.each(d,function(){this.close(u)})}u=u||c.Event();u.type="onBeforeLoad";f.trigger(u);if(u.isDefaultPrevented()){return o}i=true;if(e){c(j).expose(e)}var t=m.top,s=m.left,p=j.outerWidth({margin:true}),q=j.outerHeight({margin:true});if(typeof t=="string"){t=t=="center"?Math.max((n.height()-q)/2,0):parseInt(t,10)/100*n.height()}if(s=="center"){s=Math.max((n.width()-p)/2,0)}r[0].call(o,{top:t,left:s},function(){if(i){u.type="onLoad";f.trigger(u)}});if(e&&m.closeOnClick){c.mask.getMask().one("click",o.close)}if(m.closeOnClick){c(document).bind("click."+l,function(v){if(!c(v.target).parents(j).length){o.close(v)}})}if(m.closeOnEsc){c(document).bind("keydown."+l,function(v){if(v.keyCode==27){o.close(v)}})}return o},close:function(p){if(!o.isOpened()){return o}p=p||c.Event();p.type="onBeforeClose";f.trigger(p);if(p.isDefaultPrevented()){return}i=false;b[m.effect][1].call(o,function(){p.type="onClose";f.trigger(p)});c(document).unbind("click."+l).unbind("keydown."+l);if(e){c.mask.close()}return o},getOverlay:function(){return j},getTrigger:function(){return h},getClosers:function(){return k},isOpened:function(){return i},getConf:function(){return m}});c.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(q,p){if(c.isFunction(m[p])){c(o).bind(p,m[p])}o[p]=function(r){if(r){c(o).bind(p,r)}return o}});k=j.find(m.close||".close");if(!k.length&&!m.close){k=c('<a class="close"></a>');j.prepend(k)}k.click(function(p){o.close(p)});if(m.load){o.load()}}c.fn.overlay=function(e){var f=this.data("overlay");if(f){return f}if(c.isFunction(e)){e={onBeforeLoad:e}}e=c.extend(true,{},c.tools.overlay.conf,e);this.each(function(){f=new a(c(this),e);d.push(f);c(this).data("overlay",f)});return e.api?f:this}})(jQuery);(function(e){var c=e.tools.overlay,a=e(window);e.extend(c.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function d(g){var h=g.offset();return{top:h.top+g.height()/2,left:h.left+g.width()/2}}var f=function(r,q){var k=this.getOverlay(),o=this.getConf(),i=this.getTrigger(),s=this,t=k.outerWidth({margin:true}),m=k.data("img"),n=o.fixed?"fixed":"absolute";if(!m){var l=k.css("backgroundImage");if(!l){throw"background-image CSS property not set for overlay"}l=l.slice(l.indexOf("(")+1,l.indexOf(")")).replace(/\"/g,"");k.css("backgroundImage","none");m=e('<img src="'+l+'"/>');m.css({border:0,display:"none"}).width(t);e("body").append(m);k.data("img",m)}var j=o.start.top||Math.round(a.height()/2),h=o.start.left||Math.round(a.width()/2);if(i){var g=d(i);j=g.top;h=g.left}if(o.fixed){j-=a.scrollTop();h-=a.scrollLeft()}else{r.top+=a.scrollTop();r.left+=a.scrollLeft()}m.css({position:"absolute",top:j,left:h,width:0,zIndex:o.zIndex}).show();r.position=n;k.css(r);m.animate({top:k.css("top"),left:k.css("left"),width:t},o.speed,function(){k.css("zIndex",o.zIndex+1).fadeIn(o.fadeInSpeed,function(){if(s.isOpened()&&!e(this).index(k)){q.call()}else{k.hide()}})}).css("position",n)};var b=function(g){var k=this.getOverlay().hide(),j=this.getConf(),i=this.getTrigger(),h=k.data("img"),l={top:j.start.top,left:j.start.left,width:0};if(i){e.extend(l,d(i))}if(j.fixed){h.css({position:"absolute"}).animate({top:"+="+a.scrollTop(),left:"+="+a.scrollLeft()},0)}h.animate(l,j.closeSpeed,g)};c.addEffect("apple",f,b)})(jQuery);(function(f){f.tools=f.tools||{version:"1.2.5"};var j=/\[type=([a-z]+)\]/,h=/^-?[0-9]*(\.[0-9]+)?$/,c=f.tools.dateinput,a=/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i,g=/^(https?:\/\/)?[\da-z\.\-]+\.[a-z\.]{2,6}[#&+_\?\/\w \.\-=]*$/i,i;i=f.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(n,m){f.each(m,function(o,p){i.messages[o]=i.messages[o]||{};i.messages[o][n]=p})},localizeFn:function(m,n){i.messages[m]=i.messages[m]||{};f.extend(i.messages[m],n)},fn:function(n,o,m){if(f.isFunction(o)){m=o}else{if(typeof o=="string"){o={en:o}}this.messages[n.key||n]=o}var p=j.exec(n);if(p){n=e(p[1])}k.push([n,m])},addEffect:function(m,n,o){b[m]=[n,o]}};function l(o,n,q){var t=o.offset().top,p=o.offset().left,r=q.position.split(/,?\s+/),s=r[0],u=r[1];t-=n.outerHeight()-q.offset[0];p+=o.outerWidth()+q.offset[1];if(/iPad/i.test(navigator.userAgent)){t-=f(window).scrollTop()}var v=n.outerHeight()+o.outerHeight();if(s=="center"){t+=v/2}if(s=="bottom"){t+=v}var m=o.outerWidth();if(u=="center"){p-=(m+n.outerWidth())/2}if(u=="left"){p-=m}return{top:t,left:p}}function e(n){function m(){return this.getAttribute("type")==n}m.key="[type="+n+"]";return m}var k=[],b={"default":[function(m){var n=this.getConf();f.each(m,function(p,q){var o=q.input;o.addClass(n.errorClass);var r=o.data("msg.el");if(!r){r=f(n.message).addClass(n.messageClass).appendTo(document.body);o.data("msg.el",r)}r.css({visibility:"hidden"}).find("p").remove();f.each(q.messages,function(u,t){f("<p/>").html(t).appendTo(r)});if(r.outerWidth()==r.parent().width()){r.add(r.find("p")).css({display:"inline"})}var s=l(o,r,n);r.css({visibility:"visible",position:"absolute",top:s.top,left:s.left}).fadeIn(n.speed)})},function(m){var n=this.getConf();m.removeClass(n.errorClass).each(function(){var o=f(this).data("msg.el");if(o){o.css({visibility:"hidden"})}})}]};f.each("email,url,number".split(","),function(n,m){f.expr[":"][m]=function(o){return o.getAttribute("type")===m}});f.fn.oninvalid=function(m){return this[m?"bind":"trigger"]("OI",m)};i.fn(":email","Please enter a valid email address",function(n,m){return !m||a.test(m)});i.fn(":url","Please enter a valid URL",function(n,m){return !m||g.test(m)});i.fn(":number","Please enter a numeric value.",function(n,m){return h.test(m)});i.fn("[max]","Please enter a value smaller than $1",function(o,n){if(n===""||c&&o.is(":date")){return true}var m=o.attr("max");return parseFloat(n)<=parseFloat(m)?true:[m]});i.fn("[min]","Please enter a value larger than $1",function(o,m){if(m===""||c&&o.is(":date")){return true}var n=o.attr("min");return parseFloat(m)>=parseFloat(n)?true:[n]});i.fn("[required]","Please complete this mandatory field.",function(n,m){if(n.is(":checkbox")){return n.is(":checked")}return !!m});i.fn("[pattern]",function(m){var n=new RegExp("^"+m.attr("pattern")+"$");return n.test(m.val())});function d(m,r,p){var o=this,q=r.add(o);m=m.not(":button, :image, :reset, :submit");function n(x,v,t){if(!p.grouped&&x.length){return}var w;if(t===false||f.isArray(t)){w=i.messages[v.key||v]||i.messages["*"];w=w[p.lang]||i.messages["*"].en;var u=w.match(/\$\d/g);if(u&&f.isArray(t)){f.each(u,function(y){w=w.replace(this,t[y])})}}else{w=t[p.lang]||t}x.push(w)}f.extend(o,{getConf:function(){return p},getForm:function(){return r},getInputs:function(){return m},reflow:function(){m.each(function(){var t=f(this),u=t.data("msg.el");if(u){var v=l(t,u,p);u.css({top:v.top,left:v.left})}});return o},invalidate:function(t,u){if(!u){var v=[];f.each(t,function(x,y){var w=m.filter("[name='"+x+"']");if(w.length){w.trigger("OI",[y]);v.push({input:w,messages:[y]})}});t=v;u=f.Event()}u.type="onFail";q.trigger(u,[t]);if(!u.isDefaultPrevented()){b[p.effect][0].call(o,t,u)}return o},reset:function(t){t=t||m;t.removeClass(p.errorClass).each(function(){var u=f(this).data("msg.el");if(u){u.remove();f(this).data("msg.el",null)}}).unbind(p.errorInputEvent||"");return o},destroy:function(){r.unbind(p.formEvent+".V").unbind("reset.V");m.unbind(p.inputEvent+".V").unbind("change.V");return o.reset()},checkValidity:function(u,w){u=u||m;u=u.not(":disabled");if(!u.length){return true}w=w||f.Event();w.type="onBeforeValidate";q.trigger(w,[u]);if(w.isDefaultPrevented()){return w.result}var t=[];u.not(":radio:not(:checked)").each(function(){var z=[],x=f(this).data("messages",z),y=c&&x.is(":date")?"onHide.v":p.errorInputEvent+".v";x.unbind(y);f.each(k,function(){var C=this,A=C[0];if(x.filter(A).length){var B=C[1].call(o,x,x.val());if(B!==true){w.type="onBeforeFail";q.trigger(w,[x,A]);if(w.isDefaultPrevented()){return false}var D=x.attr(p.messageAttr);if(D){z=[D];return false}else{n(z,A,B)}}}});if(z.length){t.push({input:x,messages:z});x.trigger("OI",[z]);if(p.errorInputEvent){x.bind(y,function(A){o.checkValidity(x,A)})}}if(p.singleError&&t.length){return false}});var v=b[p.effect];if(!v){throw'Validator: cannot find effect "'+p.effect+'"'}if(t.length){o.invalidate(t,w);return false}else{v[1].call(o,u,w);w.type="onSuccess";q.trigger(w,[u]);u.unbind(p.errorInputEvent+".v")}return true}});f.each("onBeforeValidate,onBeforeFail,onFail,onSuccess".split(","),function(u,t){if(f.isFunction(p[t])){f(o).bind(t,p[t])}o[t]=function(v){if(v){f(o).bind(t,v)}return o}});if(p.formEvent){r.bind(p.formEvent+".V",function(t){if(!o.checkValidity(null,t)){return t.preventDefault()}})}r.bind("reset.V",function(){o.reset()});if(m[0]&&m[0].validity){m.each(function(){this.oninvalid=function(){return false}})}if(r[0]){r[0].checkValidity=o.checkValidity}if(p.inputEvent){m.bind(p.inputEvent+".V",function(t){o.checkValidity(f(this),t)})}m.filter(":checkbox, select").filter("[required]").bind("change.V",function(u){var t=f(this);if(this.checked||(t.is("select")&&f(this).val())){b[p.effect][1].call(o,t,u)}});var s=m.filter(":radio").change(function(t){o.checkValidity(s,t)});f(window).resize(function(){o.reflow()})}f.fn.validator=function(n){var m=this.data("validator");if(m){m.destroy();this.removeData("validator")}n=f.extend(true,{},i.conf,n);if(this.is("form")){return this.each(function(){var o=f(this);m=new d(o.find(":input"),o,n);o.data("validator",m)})}else{m=new d(this,this.eq(0).closest("form"),n);return this.data("validator",m)}}})(jQuery);
