(function($)
{function jQueryStyle(style,sub)
{var styleObj,i;styleObj=$.extend(true,{},style);for(i in styleObj)
{if(sub===true&&i.search(/(tip|classes)/i)!==-1)
delete styleObj[i];else if(!sub&&i.search(/(width|border|tip|title|classes|user)/i)!==-1)
delete styleObj[i];}
return styleObj;}
function sanitizeStyle(style)
{if(typeof style.tip!=='object')style.tip={corner:style.tip};if(typeof style.tip.size!=='object')style.tip.size={width:style.tip.size,height:style.tip.size};if(typeof style.border!=='object')style.border={width:style.border};if(typeof style.width!=='object')style.width={value:style.width};if(typeof style.width.value==='string')style.width.value=parseInt(style.width.value.replace(/([0-9]+)/i,"$1"),10)||false;if(typeof style.width.max==='string')style.width.max=parseInt(style.width.max.replace(/([0-9]+)/i,"$1"),10)||false;if(typeof style.width.min==='string')style.width.min=parseInt(style.width.min.replace(/([0-9]+)/i,"$1"),10)||false;if(typeof style.tip.size.x==='number')
{style.tip.size.width=style.tip.size.x;delete style.tip.size.x;}
if(typeof style.tip.size.y==='number')
{style.tip.size.height=style.tip.size.y;delete style.tip.size.y;}
return style;}
function buildStyle()
{var self,i,styleArray,styleExtend,finalStyle;self=this;styleArray=[true,{}];i=arguments.length;while(i--)styleArray.push(arguments[i]);styleExtend=[$.extend.apply($,styleArray)];while(styleExtend[0]&&typeof styleExtend[0].name==='string')
{if(typeof $.fn.qtip.styles[styleExtend[0].name]!=='object')
{$.fn.qtip.log.error.call(self,1,styleExtend[0].name+': '+$.fn.qtip.constants.STYLE_NOT_DEFINED,'buildStyle');styleExtend.shift();continue;}
else styleExtend.unshift(sanitizeStyle($.fn.qtip.styles[styleExtend[0].name]));}
styleExtend.unshift(true,{classes:{tooltip:'qtip-'+(arguments[0].name||'defaults')}},(!arguments[0].name||(arguments[0].name&&arguments[0].name.search(/^css$/i)<0))?$.fn.qtip.styles.defaults:null);finalStyle=$.extend.apply($,styleExtend);finalStyle.tip.size.width+=($.browser.msie)?1:0;finalStyle.tip.size.height+=($.browser.msie)?1:0;if(finalStyle.tip.size.width%2>0)finalStyle.tip.size.width+=1;if(finalStyle.tip.size.height%2>0)finalStyle.tip.size.height+=1;if(finalStyle.tip.corner===true)
finalStyle.tip.corner=(self.options.position.corner.tooltip==='center')?false:self.options.position.corner.tooltip;return finalStyle;}
function contentAjax()
{var self=this,i,options,ajax;options=self.options.content.url;ajax=$.extend({},self.options.content.url);for(i in $.fn.qtip.defaults.content.url)delete ajax[i];return ajax;}
function createTitle()
{var self=this;if(self.elements.title!==null)self.elements.title.remove();self.elements.title=$('<div class="'+self.options.style.classes.title+'">').css(jQueryStyle(self.options.style.title,true)).prependTo(self.elements.contentWrapper);if(self.options.content.title.text)self.updateTitle.call(self,self.options.content.title.text);if(self.options.content.title.button!==false&&typeof self.options.content.title.button==='string')
{self.elements.button=$('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>').css(jQueryStyle(self.options.style.button,true)).html(self.options.content.title.button).prependTo(self.elements.title).click(function(event)
{if(self.status.disabled)return true;return Boolean(self.onButtonClick.call(self));});}}
function assignEvents()
{var self,targets,inactiveMethod,events;self=this;targets={show:self.options.show.when.target,hide:self.options.hide.when.target};events={show:self.options.show.when.event,hide:(self.options.hide.when.event===false)?'mouseout':self.options.hide.when.event,inactive:['click','dblclick','mousedown','mouseup','mousemove','mouseout','mouseover']};if(self.options.hide.fixed)targets.hide=targets.hide.add(self.elements.tooltip);if(events.hide==='inactive')
{inactiveMethod=function(event)
{if(self.status.disabled===true)return;clearTimeout(self.timers.inactive);self.timers.inactive=setTimeout(function(){self.hide(event);},self.options.hide.delay);};targets.show.bind('qtip-inactive',inactiveMethod);$(events.inactive).each(function(){targets.hide.add(self.elements.content).bind(this+'.qtip-inactive',inactiveMethod);});}
else if(self.options.hide.fixed===true)
self.elements.tooltip.bind('mouseover.qtip',function(){if(self.status.disabled!==true)clearTimeout(self.timers.hide);});function hideMethod(event)
{if(self.status.disabled===true)return;clearTimeout(self.timers.show);clearTimeout(self.timers.hide);if(self.options.hide.when.event!==false)
{if(self.options.hide.fixed===true&&events.hide.search(/mouse(out|leave)/i)!==-1&&$(event.relatedTarget).parents('div.qtip[qtip]').length>0)
{event.stopPropagation();event.preventDefault();clearTimeout(self.timers.hide);return false;}
self.elements.tooltip.stop(true,true);self.timers.hide=setTimeout(function(){self.hide(event);},self.options.hide.delay);}}
function showMethod(event)
{if(self.status.disabled===true)return;if(events.hide==='inactive')targets.show.trigger('qtip-inactive');clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.timers.show=setTimeout(function()
{if(!self.options.content.url.once)
{var options=self.options.content.url,ajax=contentAjax.call(self);self.loadContent(options.path,options.data,options.method||'get',ajax,true);}
self.show(event);},self.options.show.delay);}
if((self.options.show.when.target.add(self.options.hide.when.target).length===1&&events.show===events.hide&&events.hide!=='inactive')||events.hide==='unfocus')
{targets.show.bind(events.show+'.qtip',function(event)
{if(self.status.hidden)showMethod(event);else hideMethod(event);});}
else
{targets.show.bind(events.show+'.qtip',showMethod);if(events.hide!=='inactive')targets.hide.bind(events.hide+'.qtip',hideMethod);if(events.show==='mouseover')targets.hide.bind('mouseout.qtip',hideMethod);}
if(self.options.position.type.search(/(fixed|absolute)/)!==-1)
self.elements.tooltip.bind('mouseover.qtip',function(){self.focus();});if(self.options.position.target==='mouse'&&self.options.position.type!=='static')
{targets.show.bind('mousemove.qtip',function(event)
{self.cache.mouse={left:event.pageX,top:event.pageY};if(self.status.disabled===false&&self.options.position.adjust.mouse===true&&self.options.position.type!=='static'&&self.elements.tooltip.css('display')!=='none')
self.updatePosition(event);});}}
function screenAdjust(position,target,tooltip)
{var self,winScroll,newPosition,overflow;self=this;if(tooltip.corner.x==='center')return position;winScroll=$.fn.qtip.cache.scroll;newPosition={left:position.left,top:position.top,corner:tooltip.corner.clone()};overflow={left:(newPosition.left<winScroll.left),right:(newPosition.left+tooltip.size.width>=$(window).width()+winScroll.left),top:(newPosition.top<winScroll.top),bottom:(newPosition.top+tooltip.size.height>=$(window).height()+winScroll.top)};if(overflow.left&&(newPosition.corner.x==='right'||(newPosition.corner.x!=='right'&&!overflow.right)))
{newPosition.left+=tooltip.size.width-($.fn.qtip.border?(self.options.style.border.radius*2||0):0);newPosition.corner.x='left';}
else if(overflow.right&&(newPosition.corner.x==='left'||(newPosition.corner.x!=='left'&&!overflow.left)))
{newPosition.left-=tooltip.size.width-($.fn.qtip.border?(self.options.style.border.radius*2||0):0);newPosition.corner.x='right';}
if(overflow.top&&newPosition.corner.y!=='top')
{if(self.options.position.target!=='mouse')
newPosition.top=target.position.top+target.size.height;else
newPosition.top=self.cache.mouse.top;newPosition.corner.y='top';}
else if(overflow.bottom&&newPosition.corner.y!=='bottom')
{newPosition.top-=tooltip.size.height;newPosition.corner.y='bottom';}
if(newPosition.left<0)newPosition.left+=Math.abs(newPosition.left);if(newPosition.top<0)newPosition.top+=Math.abs(newPosition.top);if($.fn.qtip.tips&&self.options.style.tip.corner!==false&&newPosition.corner.toString()!==self.cache.tip.toString())
$.fn.qtip.tips.create.call(self,newPosition.corner);return newPosition;}
function QTip(target,options,id)
{var self=this;self.id=id;self.options=options;self.status={animated:false,rendered:false,disabled:false,focused:false,hidden:true};self.elements={target:target.addClass(self.options.style.classes.target).data('qtip',true),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null};self.cache={content:{type:false,text:''},mouse:{},position:{}};self.timers={};$.extend(self,self.options.api);}
function Instantiate(id,opts)
{var config,obj;config=$.extend(true,{},opts);if(config.position.container===false)config.position.container=$(document.body);if(config.position.target===false)config.position.target=$(this);if(config.show.when.target===false)config.show.when.target=$(this);if(config.hide.when.target===false)config.hide.when.target=$(this);obj=new QTip($(this),config,id);$.fn.qtip.interfaces.push(obj);return obj;}
$.fn.qtip=function(options)
{var apis,i,interfaces,command,opts;if(typeof options==='string')
{apis=[];interfaces=$.fn.qtip.interfaces;i=interfaces.length;while(i--)
{if(interfaces[i])
{if($(this).attr('qtip')&&$(this).add(interfaces[i].elements.tooltip).length===1)
apis.unshift(interfaces[i]);else if($(this).add(interfaces[i].elements.target).length===1)
apis.push(interfaces[i]);}}
if(apis.length>0)
{command=options.toLowerCase();if(command==='id')return apis[0].id;else if(command==='api')return apis[0];else if(command==='interfaces')return apis;else
{return $(this).each(function()
{var i=apis.length;while(i--)
{if(command==='render')interfaces[i].render();else if(command==='destroy')interfaces[i].destroy();else if(interfaces[i].status.rendered===true)
{if(command==='show')interfaces[i].show();else if(command==='hide')interfaces[i].hide();else if(command==='focus')interfaces[i].focus();else if(command==='disable')interfaces[i].disable(true);else if(command==='enable')interfaces[i].disable(false);}}});}}
else
{$.fn.qtip.log.error.call(this,1,$.fn.qtip.constants.NO_TOOLTIP_PRESENT,false);return $(this);}}
else
{if(!options)options={};if(typeof options.content!=='object'||(options.content.jquery&&options.content.length>0))options.content={text:options.content};if(typeof options.content.title!=='object')options.content.title={text:options.content.title};if(typeof options.content.url!=='object')options.content.url={path:options.content.url};if(options.content.data!==null){options.content.url.data=options.content.data;delete options.content.data;}
if(options.content.method!==null){options.content.url.method=options.content.method;delete options.content.method;}
if(typeof options.position!=='object')options.position={corner:options.position};if(typeof options.position.corner!=='object')options.position.corner={target:options.position.corner,tooltip:options.position.corner};if(typeof options.show!=='object')options.show={when:options.show};if(typeof options.show.when!=='object')options.show.when={event:options.show.when};if(typeof options.show.effect!=='object')options.show.effect={type:options.show.effect};if(typeof options.show.effect.length==='number')options.show.effect={type:options.show.effect.type,duration:options.show.effect.length};if(typeof options.hide!=='object')options.hide={when:options.hide};if(typeof options.hide.when!=='object')options.hide.when={event:options.hide.when};if(typeof options.hide.effect!=='object')options.hide.effect={type:options.hide.effect};if(typeof options.hide.effect.length==='number')options.hide.effect={type:options.hide.effect.type,duration:options.hide.effect.length};if(typeof options.style!=='object')options.style={name:options.style};options.style=sanitizeStyle(options.style);opts=$.extend(true,{},$.fn.qtip.defaults,options);opts.style=buildStyle.call({options:opts},opts.style);opts.user=$.extend(true,{},options);if(opts.style.border.radius!==false&&!$.fn.qtip.border)$.fn.qtip.log.error(4,$.fn.qtip.constants.PLUGIN_MISSING_BORDER);if(opts.style.tip!==false&&!$.fn.qtip.tips)$.fn.qtip.log.error(4,$.fn.qtip.constants.PLUGIN_MISSING_TIPS);if($(opts.position.target||this).is('area')&&!$.fn.qtip.imagemap)$.fn.qtip.log.error(4,$.fn.qtip.constants.PLUGIN_MISSING_IMAGEMAP);if($('select, object').length&&$.fn.qtip.cache.ie6&&!$.fn.qtip.bgiframe)$.fn.qtip.log.error(4,$.fn.qtip.constants.PLUGIN_MISSING_BGIFRAME);if($.fn.qtip.preload)$.fn.qtip.preload(opts.content.text);return $(this).each(function(cur)
{var id,i,interfaces,self,attribute,api,targets,events,namespace;if(typeof opts.id==='string'&&opts.id.length>0&&Boolean(opts.id)!==false)
{interfaces=$.fn.qtip.interfaces;i=interfaces.length;while(i--)if(interfaces[i].id===opts.id)delete opts.id;}
id=opts.id||$.fn.qtip.nextid++;self=Instantiate.call($(this),id,opts);if(typeof self.options.content.text!=='string'&&!self.options.content.text.jquery)
{attribute=$(this).attr('title')?'title':'alt';if($(this).attr(attribute))
{self.cache.content={type:attribute,text:$(this).attr(attribute)};self.options.content.text=self.cache.content.text.replace("\\n/g",'<br />');$(this).removeAttr(attribute);}
else
{api=$(this).qtip('interfaces');api=api[api.length-1];if(api&&api.cache.content.type!==false)self.options.content.text=api.options.content.text;}}
targets={show:self.options.show.when.target,hide:self.options.hide.when.target};events={show:self.options.show.when.event,hide:(String(self.options.hide.when.event).search(/(inactive|unfocus)/i)>-1)?'mouseout':self.options.hide.when.event};if(self.options.content.prerender===false&&self.options.show.ready!==true&&self.options.show.when.event!==false)
{namespace='.qtip-'+id+'-create';targets.show.bind(events.show+namespace,{id:id},function(event)
{var mouse={left:event.pageX,top:event.pageY};self.timers.show=setTimeout(function()
{self.cache.mouse=mouse;self.render(true);targets.show.unbind(events.show+'.qtip-'+self.id+'-create');targets.hide.unbind(events.hide+'.qtip-'+self.id+'-create');},self.options.show.delay);});if(targets.show!==targets.hide&&self.options.show.when.event!==self.options.hide.when.event)
targets.hide.bind(events.hide+namespace,function(event){clearTimeout(self.timers.show);});}
else{self.cache.mouse=targets.show.offset();self.render(false);}});}};function Corner(corner)
{this.x=corner.match(/left|right|middle|center/i)[0].toLowerCase();this.y=corner.match(/top|bottom|middle|center/i)[0].toLowerCase();this.precedance=(corner.charAt(0).search(/t|b/)>-1)?'y':'x';}
Corner.prototype.toString=function(){return(this.precedance==='y')?this.y+this.x:this.x+this.y;};Corner.prototype.clone=function(){return{x:this.x,y:this.y,precedance:this.precedance,toString:this.toString};};QTip.prototype.render=function(show)
{var self=this,content,ajax,options;if(self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_ALREADY_RENDERED,'render');self.beforeRender.call(self);self.elements.tooltip='<div qtip="'+self.id+'" '+' class="qtip '+(self.options.style.classes.tooltip||self.options.style)+'" '+' style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;'+' position:'+self.options.position.type+';">'+'  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">'+'    <div class="qtip-contentWrapper" style="overflow:hidden;">'+'       <div class="qtip-content '+self.options.style.classes.content+'"></div>'+'</div></div></div>';self.elements.tooltip=$(self.elements.tooltip);self.elements.tooltip.appendTo(self.options.position.container).data('qtip',true);self.elements.wrapper=self.elements.tooltip.children('div:first');self.elements.contentWrapper=self.elements.wrapper.children('div:first').css({background:self.options.style.background});self.elements.content=self.elements.contentWrapper.children('div:first').css(jQueryStyle(self.options.style));self.status.rendered=true;self.options.position.corner.target=new Corner(self.options.position.corner.target);self.options.position.corner.tooltip=new Corner(self.options.position.corner.tooltip);if($.fn.qtip.tips&&self.options.style.tip.corner!==false)self.options.style.tip.corner=new Corner(self.options.style.tip.corner);if($.fn.qtip.tips&&self.options.style.tip.type!==false)self.options.style.tip.type=new Corner(self.options.style.tip.type);if($.fn.qtip.imagemap&&self.options.position.target.is('area')===true)$.fn.qtip.imagemap.setup.call(self);if($('<canvas/>').get(0).getContext||$.browser.msie)
{if($.fn.qtip.border&&self.options.style.border.radius>0)
$.fn.qtip.border.create.call(self);else
{self.elements.contentWrapper.css({borderWidth:self.options.style.border.width||0,borderColor:self.options.style.border.color||'',borderStyle:'solid'});}
if($.fn.qtip.tips&&self.options.style.tip.corner!==false)$.fn.qtip.tips.create.call(self);}
else
{self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});self.options.style.border.radius=0;self.options.style.tip.corner=false;$.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,'render');}
if((typeof self.options.content.text==='string'&&self.options.content.text.length>0)||(self.options.content.text.jquery&&self.options.content.text.length>0))
content=self.options.content.text;else
{$.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_VALID_CONTENT,'render');if(self.options.content.url.path===false)self.destroy();else content='Loading...';}
self.updateContent(content);if(self.options.content.title.text!==false)createTitle.call(self);if(self.options.content.url.path!==false)
{options=self.options.content.url;ajax=contentAjax.call(self);self.loadContent(options.path,options.data,options.method||'get',ajax,true);}
assignEvents.call(self);if(self.options.show.ready)self.show(null,self.options.show.ready);else if(show===true)self.show();self.onRender.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_RENDERED,'render');return self;};QTip.prototype.show=function(event,duration)
{var self=this,api,i;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'show');if(self.elements.target.length<1)return $.fn.qtip.log.error.call(self,4,$.fn.qtip.constants.TARGET_ELEMENT_REMOVED,'show');if(self.elements.tooltip.css('display')!=='none'){self.status.hidden=false;return self;}
if(typeof duration!=='number')duration=self.options.show.effect.duration;self.elements.tooltip.stop(true,false);if(self.beforeShow.call(self,event)===false)return self;function afterShow()
{self.elements.tooltip.css({opacity:''});if(self.options.position.type!=='static')self.focus();self.status.animated=false;self.status.hidden=false;self.onShow.call(self,event);if($.browser.msie)self.elements.tooltip.get(0).style.removeAttribute('filter');}
self.status.hidden=false;if(self.options.position.type!=='static')
self.updatePosition(event,(duration>0&&self.options.show.effect===false));if(self.options.show.solo===true)
{i=$.fn.qtip.interfaces.length;while(i--)
{api=$.fn.qtip.interfaces[i];if(api&&api.status.rendered&&!api.status.hidden)api.hide();}}
if(typeof self.options.show.effect.type==='function')
{self.options.show.effect.type.call(self,self.elements.tooltip,duration);self.elements.tooltip.queue(function(){afterShow();$(this).dequeue();});}
else
{if(self.options.show.effect.type===false)
{self.elements.tooltip.show();afterShow();}
else
{self.status.animated=true;switch(self.options.show.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeIn(duration,afterShow);break;case'slide':self.elements.tooltip.slideDown(duration,function()
{afterShow();if(self.options.position.type!=='static')self.updatePosition(event,true);});break;case'grow':self.elements.tooltip.show(duration,afterShow);break;default:self.elements.tooltip.show();afterShow();break;}}
self.elements.tooltip.addClass(self.options.style.classes.active);}
self.options.show.when.target.trigger('qtip-inactive');$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_SHOWN,'show');return self;};QTip.prototype.hide=function(event,duration)
{var self=this;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'hide');if(self.elements.tooltip.css('display')==='none'){self.status.hidden=true;return self;}
if(typeof duration!=='number')duration=self.options.hide.effect.duration;clearTimeout(self.timers.show);self.elements.tooltip.stop(true,false).css({opacity:''});if(self.beforeHide.call(self,event)===false)return self;function afterHide()
{self.elements.tooltip.css({opacity:'',height:''});self.onHide.call(self,event);self.status.animated=false;self.status.hidden=true;}
self.status.hidden=true;if(typeof self.options.hide.effect.type==='function')
{self.options.hide.effect.type.call(self,self.elements.tooltip,duration);self.elements.tooltip.queue(function(){afterHide();$(this).dequeue();});}
else
{if(self.options.hide.effect.type===false)
{self.elements.tooltip.hide();afterHide();}
else
{self.status.animated=true;switch(self.options.hide.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeOut(duration,afterHide);break;case'slide':self.elements.tooltip.slideUp(duration,afterHide);break;case'grow':self.elements.tooltip.hide(duration,afterHide);break;default:self.elements.tooltip.hide();afterHide();break;}}
self.elements.tooltip.removeClass(self.options.style.classes.active);}
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_HIDDEN,'hide');return self;};QTip.prototype.updatePosition=function(event,animate)
{var self=this,target,tooltip,newPosition,ieAdjust,ie6Adjust,offset;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updatePosition');else if(self.options.position.type==='static')return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_POSITION_STATIC,'updatePosition');target={position:{left:0,top:0},dimensions:{height:0,width:0},corner:self.options.position.corner.target};tooltip={position:self.getPosition(),size:self.getDimensions(),corner:self.options.position.corner.tooltip};ieAdjust=($.browser.msie)?1:0;ie6Adjust=($.fn.qtip.cache.ie6)?1:0;if(self.options.position.target==='mouse')
{target.position=newPosition={left:self.cache.mouse.left,top:self.cache.mouse.top,corner:tooltip.corner};target.size={height:1,width:1};}
else
{if($.fn.qtip.imagemap)target=$.fn.qtip.imagemap.getPosition.call(self,target);else if(self.options.position.target.add(document.body).length===1)
{target.size={height:$(window).height(),width:$(window).width()};target.position=$.fn.qtip.cache.scroll;}
else
{if(self.options.position.target.attr('qtip'))
target.position=self.options.position.target.qtip('api').cache.position;else
target.position=self.options.position.target.offset();target.size={height:self.options.position.target.outerHeight(),width:self.options.position.target.outerWidth()};}
newPosition=$.extend({},target.position);if(target.corner.x==='right')newPosition.left+=target.size.width;if(target.corner.y==='bottom')newPosition.top+=target.size.height;if(target.corner.x==='middle'||target.corner.x==='center')newPosition.left+=(target.size.width/2);if(target.corner.y==='middle'||target.corner.y==='center')newPosition.top+=(target.size.height/2);}
if(tooltip.corner.x==='right')newPosition.left-=tooltip.size.width;if(tooltip.corner.y==='bottom')newPosition.top-=tooltip.size.height;if(tooltip.corner.x==='middle'||tooltip.corner.x==='center')newPosition.left-=(tooltip.size.width/2);if(tooltip.corner.y==='middle'||tooltip.corner.y==='center')newPosition.top-=(tooltip.size.height/2);if($.fn.qtip.border&&self.options.style.border.radius>0)
{if(tooltip.corner.precedance==='y')
{if(tooltip.corner.x==='left')newPosition.left-=self.options.style.border.radius;else if(tooltip.corner.x==='right')newPosition.left+=self.options.style.border.radius;}
else
{if(tooltip.corner.y==='top')newPosition.top-=self.options.style.border.radius;else if(tooltip.corner.y==='bottom')newPosition.top+=self.options.style.border.radius;}}
if(ieAdjust)
{if(tooltip.corner.y==='top'){newPosition.top-=ieAdjust;}
else if(tooltip.corner.y==='bottom'){newPosition.top+=ieAdjust;}
if(tooltip.corner.x==='left'){newPosition.left-=ieAdjust;}
else if(tooltip.corner.x==='right'){newPosition.left+=ieAdjust;}
if(tooltip.corner.y==='middle'){newPosition.top-=ieAdjust;}}
if(self.options.position.adjust.screen===true)newPosition=screenAdjust.call(self,newPosition,target,tooltip);if(self.options.position.target==='mouse'&&self.options.position.adjust.mouse===true)
{newPosition.left-=(newPosition.corner.x==='right')?6:-6;newPosition.top-=(newPosition.corner.y==='bottom')?6:-6;}
if($.fn.qtip.cache.ie6&&$.fn.qtip.bgiframe&&self.elements.bgiframe===null)
{$('select, object').each(function()
{offset=$(this).offset();offset.bottom=offset.top+$(this).height();offset.right=offset.left+$(this).width();if(newPosition.top+tooltip.size.height>=offset.top&&newPosition.left+tooltip.size.width>=offset.left)
return $.fn.qtip.bgiframe.call(self);});}
newPosition.left+=self.options.position.adjust.x;newPosition.top+=self.options.position.adjust.y;if(self.beforePositionUpdate.call(self,event)===false)return self;self.cache.position=newPosition;if(animate===true)
{self.status.animated=true;self.elements.tooltip.stop(true,false).animate(newPosition,200,'swing',function(){self.status.animated=false;});}
else self.elements.tooltip.css(newPosition);self.onPositionUpdate.call(self,event);if(!event||(event.type&&event.type!=='mousemove'))$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_POSITION_UPDATED,'updatePosition');return self;};QTip.prototype.updateWidth=function(newWidth)
{var self=this,hide,zoom;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateWidth');hide=self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.title);zoom=self.elements.content.add(self.elements.wrapper).add(self.elements.title).add(self.elements.content);if(typeof newWidth==='string')newWidth=parseInt(newWidth.replace(/([0-9]+)/i,"$1"),10);else if(!newWidth)
{if(self.options.style.width.value)newWidth=self.options.style.width.value;else
{if($.browser.msie){zoom.css({zoom:'normal'});hide.hide();}
self.elements.tooltip.css({width:'auto'});newWidth=self.getDimensions().width;if(self.options.style.width.max&&newWidth>self.options.style.width.max)newWidth=self.options.style.width.max;if(self.options.style.width.min&&newWidth<self.options.style.width.min)newWidth=self.options.style.width.min;}}
if(typeof newWidth==='number'&&newWidth%2!==0)newWidth+=1;self.elements.tooltip.width(newWidth);if(typeof newWidth!=='number')newWidth=self.getDimensions().width;if($.fn.qtip.border&&self.options.style.border.radius)
self.elements.tooltip.find('.qtip-betweenCorners').css({width:newWidth-(self.options.style.border.radius*2)});if($.browser.msie)
{zoom.css({zoom:1});hide.show();if($.fn.qtip.bgiframe&&self.elements.bgiframe)
self.elements.bgiframe.width(newWidth).height(self.getDimensions().height);}
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_WIDTH_UPDATED,'updateWidth');return self;};QTip.prototype.updateStyle=function(name)
{var self=this,tip,borders,context,corner,coordinates;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateStyle');else if(typeof name!=='string'||!$.fn.qtip.styles[name])return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.STYLE_NOT_DEFINED,'updateStyle');self.options.style=buildStyle.call(self,self.options.user.style,$.fn.qtip.styles[name]);self.elements.content.css(jQueryStyle(self.options.style));if(self.options.content.title.text!==false)
self.elements.title.css(jQueryStyle(self.options.style.title,true));self.elements.contentWrapper.css({borderColor:self.options.style.border.color});if($.fn.qtip.tips&&self.options.style.tip.corner!==false)
{if($('<canvas/>').get(0).getContext)
{tip=self.elements.tooltip.find('.qtip-tip canvas:first');context=tip.get(0).getContext('2d');context.clearRect(0,0,300,300);coordinates=$.fn.qtip.tips.calculate.call(self,self.cache.tip,self.options.style.tip.size.width,self.options.style.tip.size.height);$.fn.qtip.tips.draw.call(self,tip,coordinates,self.options.style.tip.color||self.options.style.border.color);}
else if($.browser.msie)
{tip=self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');tip.attr('fillcolor',self.options.style.tip.color||self.options.style.border.color);}}
if($.fn.qtip.border&&self.options.style.border.radius>0)
{self.elements.tooltip.find('.qtip-betweenCorners').css({backgroundColor:self.options.style.border.color});if($('<canvas/>').get(0).getContext)
{borders=$.fn.qtip.border.calculate(self.options.style.border.radius);self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
{context=$(this).get(0).getContext('2d');context.clearRect(0,0,300,300);corner=$(this).parent('div[rel]:first').attr('rel');$.fn.qtip.border.draw.call(self,$(this),borders[corner],self.options.style.border.radius,self.options.style.border.color);});}
else if($.browser.msie)
{self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
{$(this).attr('fillcolor',self.options.style.border.color);});}}
self.updateWidth();self.updatePosition(null,true);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_STYLE_UPDATED,'updateStyle');return self;};QTip.prototype.updateContent=function(content,reposition)
{var self=this,images,loadedImages,preloaded;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateContent');else if(!content)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateContent');if(self.beforeContentUpdate.call(self,content)===false)return;if(content.jquery&&content.length>0)
{if(self.options.content.clone===true)
self.elements.content.html(content.clone(true).removeAttr('id').css({display:'block'}));else
self.elements.content.append(content.css({display:'block'}));}
else self.elements.content.html(content);function afterLoad()
{if(!self.options.style.width.value)self.updateWidth();if(reposition!==false)
{if(self.options.position.type!=='static')self.updatePosition();if($.fn.qtip.tips)$.fn.qtip.tips.position.call(self);}
self.onContentUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_UPDATED,'loadContent');}
loadedImages=0;images=self.elements.content.find('img')
if(images.length)
{if($.fn.qtip.preload)
{images.each(function()
{preloaded=$('body > img[src="'+$(this).attr('src')+'"]:first');if(preloaded.length>0)$(this).attr('width',preloaded.innerWidth()).attr('height',preloaded.innerHeight());});afterLoad();}
else images.bind('load error',function(){if(++loadedImages===images.length)afterLoad();});}
else afterLoad();return self;};QTip.prototype.loadContent=function(url,data,method,ajax,reposition)
{var self=this,returned,request;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'loadContent');if(self.beforeContentLoad.call(self)===false)return self;function setupContent(content,status)
{if(request.extended&&$.isFunction(request.extended.success)&&request.extended.success(content,status)===false)return;returned=self.onContentLoad.call(self,content);if(typeof returned==='string')content=returned;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_LOADED,'loadContent');self.updateContent(content,reposition);}
function errorHandler(xhr,status,error)
{if(request.extended&&$.isFunction(request.extended.error)&&request.extended.error(xhr,status,error)===false)return;var message=$.fn.qtip.constants.AJAX_ERROR+'['+status+']: '+error;$.fn.qtip.log.error.call(self,1,message,'loadContent');self.updateContent($.fn.qtip.constants.AJAX_ERROR,reposition);}
request=$.extend({},ajax,{url:url,type:method,data:data,extended:ajax,success:setupContent,error:errorHandler});$.ajax(request);return self;};QTip.prototype.updateTitle=function(content)
{var self=this;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateTitle');if(!content)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateTitle');if(self.beforeTitleUpdate.call(self)===false)return self;if(self.elements.title)
{if(self.elements.button)self.elements.button=self.elements.button.clone(true);self.elements.title.html(content);if(self.elements.button)self.elements.title.prepend(self.elements.button);}
else
{self.options.content.title.text=content;createTitle.call(self);}
self.onTitleUpdate.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_TITLE_UPDATED,'updateTitle');return self;};QTip.prototype.focus=function(event)
{var self=this,i,api,curIndex,newIndex,elemIndex;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'focus');else if(self.options.position.type==='static')return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_FOCUS_STATIC,'focus');curIndex=parseInt(self.elements.tooltip.css('z-index'),10);newIndex=$.fn.qtip.constants.baseIndex+$.fn.qtip.interfaces.length;if(!self.status.focused&&curIndex!==newIndex)
{if(self.beforeFocus.call(self,event)===false)return self;i=$.fn.qtip.interfaces.length;while(i--)
{api=$.fn.qtip.interfaces[i];if(api&&api.status.rendered)
{elemIndex=parseInt(api.elements.tooltip.css('z-index'),10);if(typeof elemIndex==='number'&&elemIndex>-1)api.elements.tooltip.css({zIndex:elemIndex-1});api.status.focused=false;}}
self.elements.tooltip.css({zIndex:newIndex});self.status.focused=true;self.onFocus.call(self,event);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_FOCUSED,'focus');}
return self;};QTip.prototype.disable=function(state)
{var self=this;if((state&&self.status.disabled)||(!state&&!self.status.disabled))
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,'disable');if(state)
self.status.disabled=!$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DISABLED,'disable');else
self.status.disabled=$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_ENABLED,'disable');return self;};QTip.prototype.destroy=function()
{var self=this,i,interfaces;if(self.beforeDestroy.call(self)===false)return self;if(self.status.rendered)
{self.options.show.when.target.unbind('mousemove.qtip',self.updatePosition);self.options.show.when.target.unbind('mouseout.qtip',self.hide);self.options.show.when.target.unbind(self.options.show.when.event+'.qtip');self.options.hide.when.target.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind('mouseover.qtip',self.focus);self.elements.tooltip.remove();}
else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-'+self.id+'-create');interfaces=$.fn.qtip.interfaces;i=interfaces.length;while(i--)if(interfaces[i]&&interfaces[i].id===self.id)interfaces.splice(i,1);if(!self.elements.target.qtip('interfaces'))self.elements.target.removeData('qtip');if(self.cache.content.type!==false)self.elements.target.attr(self.cache.content.type,self.cache.content.text);self.onDestroy.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DESTROYED,'destroy');return self.elements.target;};QTip.prototype.getPosition=function()
{var self=this,show,offset;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getPosition');show=(self.elements.tooltip.css('display')!=='none')?false:true;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();offset=self.elements.tooltip.offset();if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return offset;};QTip.prototype.getDimensions=function()
{var self=this,show,dimensions;if(!self.status.rendered)return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getDimensions');show=(!self.elements.tooltip.is(':visible'))?true:false;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();dimensions={height:self.elements.tooltip.outerHeight(),width:self.elements.tooltip.outerWidth()};if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return dimensions;};$.fn.qtip.nextid=0;$.fn.qtip.interfaces=[];$.fn.qtip.log={error:function(){return false;}};$.fn.qtip.cache={content:{},scroll:{left:0,top:0},ie6:($.browser.msie&&parseInt($.browser.version,10)===6)};$(function()
{$(window).bind('resize.qtip scroll.qtip',function(event)
{var i,api;if(event.type==='scroll')$.fn.qtip.cache.scroll={left:$(window).scrollLeft(),top:$(window).scrollTop()};i=$.fn.qtip.interfaces.length;while(i--)
{api=$.fn.qtip.interfaces[i];if(api&&api.status.rendered&&!api.status.hidden&&api.options.position.type!=='static'&&((api.options.position.adjust.scroll&&event.type==='scroll')||(api.options.position.adjust.resize&&event.type==='resize')))
api.updatePosition(event,true);}}).trigger('scroll');$(document).bind('mousedown.qtip',function(event)
{var i,api;if($(event.target).parents('div.qtip').length===0)
{i=$.fn.qtip.interfaces.length;while(i--)
{api=$.fn.qtip.interfaces[i];if(api&&api.options.hide.when.event==='unfocus'&&!api.status.hidden&&!api.status.disabled&&$(event.target).add(api.elements.target).length>1)
api.hide(event);}}});});$.fn.qtip.constants={baseIndex:6000};$.fn.qtip.defaults={id:false,content:{prerender:false,text:false,clone:true,url:{path:false,data:null,method:'GET',once:true},title:{text:false,button:false}},position:{target:false,corner:{target:'bottomRight',tooltip:'topLeft'},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:'absolute',container:false},show:{when:{target:false,event:'mouseover'},effect:{type:'fade',duration:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:'mouseout'},effect:{type:'fade',duration:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){},onButtonClick:function(){this.hide();}}};$.fn.qtip.styles={defaults:{background:'white',color:'#111',overflow:'hidden',textAlign:'left',width:{min:0,max:250},padding:'5px 9px',border:{width:1,radius:0,color:'#d3d3d3'},tip:{corner:false,type:false,color:false,size:{width:13,height:13}},title:{background:'#e1e1e1',fontWeight:'bold',padding:'7px 12px',zoom:1},button:{cursor:'pointer'},classes:{target:'',tip:'qtip-tip',title:'qtip-title',button:'qtip-button',content:'qtip-content',active:'qtip-active'}},dark:{border:{width:1,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#000000",color:"#ffffff",classes:{tooltip:"qtip-dark"}},css:{width:'auto',border:{width:0,radius:0},tip:{corner:false,type:false,color:false,size:{width:13,height:13}},title:{},button:{}}};$.fn.qtip.styles.css.classes=$.fn.qtip.styles.defaults.classes;$.fn.qtip.styles.css.classes.tooltip='qtip-css';})(jQuery);