// 2010 - Gianluca Negrelli - Ecocerved srl

var jaaulde=window.jaaulde||{};jaaulde.utils=jaaulde.utils||{};jaaulde.utils.cookies=(function()
{var resolveOptions,assembleOptionsString,parseCookies,constructor,defaultOptions={expiresAt:null,path:'/',domain:null,secure:false};resolveOptions=function(options)
{var returnValue,expireDate;if(typeof options!=='object'||options===null)
{returnValue=defaultOptions;}
else
{returnValue={expiresAt:defaultOptions.expiresAt,path:defaultOptions.path,domain:defaultOptions.domain,secure:defaultOptions.secure};if(typeof options.expiresAt==='object'&&options.expiresAt instanceof Date)
{returnValue.expiresAt=options.expiresAt;}
else if(typeof options.hoursToLive==='number'&&options.hoursToLive!==0)
{expireDate=new Date();expireDate.setTime(expireDate.getTime()+(options.hoursToLive*60*60*1000));returnValue.expiresAt=expireDate;}
if(typeof options.path==='string'&&options.path!=='')
{returnValue.path=options.path;}
if(typeof options.domain==='string'&&options.domain!=='')
{returnValue.domain=options.domain;}
if(options.secure===true)
{returnValue.secure=options.secure;}}
return returnValue;};assembleOptionsString=function(options)
{options=resolveOptions(options);return((typeof options.expiresAt==='object'&&options.expiresAt instanceof Date?'; expires='+options.expiresAt.toGMTString():'')+'; path='+options.path+
(typeof options.domain==='string'?'; domain='+options.domain:'')+
(options.secure===true?'; secure':''));};parseCookies=function()
{var cookies={},i,pair,name,value,separated=document.cookie.split(';'),unparsedValue;for(i=0;i<separated.length;i=i+1)
{pair=separated[i].split('=');name=pair[0].replace(/^\s*/,'').replace(/\s*$/,'');try
{value=decodeURIComponent(pair[1]);}
catch(e1)
{value=pair[1];}
if(typeof JSON==='object'&&JSON!==null&&typeof JSON.parse==='function')
{try
{unparsedValue=value;value=JSON.parse(value);}
catch(e2)
{value=unparsedValue;}}
cookies[name]=value;}
return cookies;};constructor=function(){};constructor.prototype.get=function(cookieName)
{var returnValue,item,cookies=parseCookies();if(typeof cookieName==='string')
{returnValue=(typeof cookies[cookieName]!=='undefined')?cookies[cookieName]:null;}
else if(typeof cookieName==='object'&&cookieName!==null)
{returnValue={};for(item in cookieName)
{if(typeof cookies[cookieName[item]]!=='undefined')
{returnValue[cookieName[item]]=cookies[cookieName[item]];}
else
{returnValue[cookieName[item]]=null;}}}
else
{returnValue=cookies;}
return returnValue;};constructor.prototype.filter=function(cookieNameRegExp)
{var cookieName,returnValue={},cookies=parseCookies();if(typeof cookieNameRegExp==='string')
{cookieNameRegExp=new RegExp(cookieNameRegExp);}
for(cookieName in cookies)
{if(cookieName.match(cookieNameRegExp))
{returnValue[cookieName]=cookies[cookieName];}}
return returnValue;};constructor.prototype.set=function(cookieName,value,options)
{if(typeof options!=='object'||options===null)
{options={};}
if(typeof value==='undefined'||value===null)
{value='';options.hoursToLive=-8760;}
else if(typeof value!=='string')
{if(typeof JSON==='object'&&JSON!==null&&typeof JSON.stringify==='function')
{value=JSON.stringify(value);}
else
{throw new Error('cookies.set() received non-string value and could not serialize.');}}
var optionsString=assembleOptionsString(options);document.cookie=cookieName+'='+encodeURIComponent(value)+optionsString;};constructor.prototype.del=function(cookieName,options)
{var allCookies={},name;if(typeof options!=='object'||options===null)
{options={};}
if(typeof cookieName==='boolean'&&cookieName===true)
{allCookies=this.get();}
else if(typeof cookieName==='string')
{allCookies[cookieName]=true;}
for(name in allCookies)
{if(typeof name==='string'&&name!=='')
{this.set(name,null,options);}}};constructor.prototype.test=function()
{var returnValue=false,testName='cT',testValue='data';this.set(testName,testValue);if(this.get(testName)===testValue)
{this.del(testName);returnValue=true;}
return returnValue;};constructor.prototype.setOptions=function(options)
{if(typeof options!=='object')
{options=null;}
defaultOptions=resolveOptions(options);};return new constructor();})();(function()
{if(window.jQuery)
{(function($)
{$.cookies=jaaulde.utils.cookies;var extensions={cookify:function(options)
{return this.each(function()
{var i,nameAttrs=['name','id'],name,$this=$(this),value;for(i in nameAttrs)
{if(!isNaN(i))
{name=$this.attr(nameAttrs[i]);if(typeof name==='string'&&name!=='')
{if($this.is(':checkbox, :radio'))
{if($this.attr('checked'))
{value=$this.val();}}
else if($this.is(':input'))
{value=$this.val();}
else
{value=$this.html();}
if(typeof value!=='string'||value==='')
{value=null;}
$.cookies.set(name,value,options);break;}}}});},cookieFill:function()
{return this.each(function()
{var n,getN,nameAttrs=['name','id'],name,$this=$(this),value;getN=function()
{n=nameAttrs.pop();return!!n;};while(getN())
{name=$this.attr(n);if(typeof name==='string'&&name!=='')
{value=$.cookies.get(name);if(value!==null)
{if($this.is(':checkbox, :radio'))
{if($this.val()===value)
{$this.attr('checked','checked');}
else
{$this.removeAttr('checked');}}
else if($this.is(':input'))
{$this.val(value);}
else
{$this.html(value);}}
break;}}});},cookieBind:function(options)
{return this.each(function()
{var $this=$(this);$this.cookieFill().change(function()
{$this.cookify(options);});});}};$.each(extensions,function(i)
{$.fn[i]=this;});})(window.jQuery);}})();(function($){$.fn.bindTo=function(data,options){var defaults={appendTo:null,root:'data',onBind:null,onBound:null,fill:false}
var options=$.extend(defaults,options);if($.isFunction(options.onBind))
options.onBind();var template='<!--bind.template-->'+((options.fill)?this.html():this.parent().html()).replace(/%7B/g,'{').replace(/%7D/g,'}')+'<!--bind.template-->';var repeaters=this.bindTo.findRepeaters(template);var fixedData={};fixedData[options.root]=data;var content=this.bindTo.traverse('bind.template',fixedData,repeaters['<!--bind.template-->'].template,repeaters,'bind.template');if(options.fill)
this.html(content);if(options.appendTo!=null)
content=$(content).appendTo($(options.appendTo));if($.isFunction(options.onBound))
options.onBound(content,data);return content;}
$.extend($.fn.bindTo,{templates:{},traverse:function(key,data,template,repeaters,parent){if(typeof data=='string'||typeof data=='number'||typeof data=='boolean'){return template.replace(new RegExp("\{"+key+"\}","ig"),data);}else if(typeof data=='object'){if(typeof data.length=='undefined'){if(repeaters['<!--'+parent+'-->'].action)
template=$.fn.bindTo[repeaters['<!--'+parent+'-->'].action](template,data)||template;for(var item in data){if(typeof data[item]=='object'){if(typeof repeaters['<!--'+item+'-->']!='undefined'){var temp=$.fn.bindTo.traverse(item,data[item],repeaters['<!--'+item+'-->'].template,repeaters,item);template=template.replace('<!--'+item+'-->',temp);}}else{var temp=$.fn.bindTo.traverse(item,data[item],template,repeaters);template=temp;}}
return template;}else{var listTemplate='';for(var item in data){listTemplate+=$.fn.bindTo.traverse(item,data[item],repeaters['<!--'+key+'-->'].template,repeaters,key);}
return listTemplate;}}
return'';},findRepeaters:function(template){$this=this;var templates={};var reg=new RegExp('<!--[.a-zA-Z1-9]*-->','g');var regAction=new RegExp('<!--action:[$.a-zA-Z1-9]*-->','g');var matches=(template.match(reg));$.each(matches,function(){if(templates[this]!=undefined)
return true;templates[this]={};var temp=template.substring(template.indexOf(this)+this.length,template.lastIndexOf(this));var innerMatches=(temp.match(reg))||[];$.each(innerMatches,function(){if(temp.indexOf(this)>-1){var innerRepeater=temp.substring(temp.indexOf(this),temp.lastIndexOf(this)+this.length);temp=temp.replace(innerRepeater,this);}})
var actions=(temp.match(regAction))||[];var key=this;$.each(actions,function(){var action=this.substring(11,this.length-3);templates[key].action=action;temp=temp.replace(actions,'');})
templates[this].template=temp;})
return templates;}});})(jQuery);(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)
$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',$.extend(new $.fn.jGrowl(),{notifications:[],element:null,interval:null}));$(this).data('jGrowl.instance').startup(this);}
if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',corners:'10px',check:250,life:3000,speed:'normal',easing:'swing',closer:true,closeTemplate:'&times;',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);this.notifications.push({message:message,options:o});o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('<div class="jGrowl-notification ui-state-highlight ui-corner-all'+
((o.group!=undefined&&o.group!='')?' '+o.group:'')+'">'+'<div class="close">'+o.closeTemplate+'</div>'+'<div class="header">'+o.header+'</div>'+'<div class="message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();$(notification).bind("mouseover.jGrowl",function(){$('div.jGrowl-notification',self.element).data("jGrowl.pause",true);}).bind("mouseout.jGrowl",function(){$('div.jGrowl-notification',self.element).data("jGrowl.pause",false);}).bind('jGrowl.beforeOpen',function(){if(o.beforeOpen.apply(notification,[notification,message,o,self.element])!=false){$(this).trigger('jGrowl.open');}}).bind('jGrowl.open',function(){if(o.open.apply(notification,[notification,message,o,self.element])!=false){if(o.glue=='after'){$('div.jGrowl-notification:last',self.element).after(notification);}else{$('div.jGrowl-notification:first',self.element).before(notification);}
$(this).animate(o.animateOpen,o.speed,o.easing,function(){if($.browser.msie&&(parseInt($(this).css('opacity'),10)===1||parseInt($(this).css('opacity'),10)===0))
this.style.removeAttribute('filter');$(this).data("jGrowl").created=new Date();});}}).bind('jGrowl.beforeClose',function(){if(o.beforeClose.apply(notification,[notification,message,o,self.element])!=false)
$(this).trigger('jGrowl.close');}).bind('jGrowl.close',function(){$(this).data('jGrowl.pause',true);$(this).animate(o.animateClose,o.speed,o.easing,function(){$(this).remove();var close=o.close.apply(notification,[notification,message,o,self.element]);if($.isFunction(close))
close.apply(notification,[notification,message,o,self.element]);});}).trigger('jGrowl.beforeOpen');if($.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',self.element).size()>1&&$('div.jGrowl-closer',self.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer ui-state-highlight ui-corner-all').addClass(this.defaults.theme).appendTo(self.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children('div.close').trigger("click.jGrowl");if($.isFunction(self.defaults.closer)){self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);}});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl.pause")==undefined||$(this).data("jGrowl.pause")!=true)){$(this).trigger('jGrowl.beforeClose');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()<this.defaults.pool))
this.render(this.notifications.shift());if($(this.element).find('div.jGrowl-notification:parent').size()<2){$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});}},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"]){$(this.element).addClass('ie6');}},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);},close:function(){$(this.element).find('div.jGrowl-notification').each(function(){$(this).trigger('jGrowl.beforeClose');});}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());﻿
(function($){var pasteEventName=($.browser.msie?'paste':'input')+".mask";var iPhone=(window.orientation!=undefined);$.mask={definitions:{'9':"[0-9]",'a':"[A-Za-z]",'*':"[A-Za-z0-9]"}};$.fn.extend({caret:function(begin,end){if(this.length==0)return;if(typeof begin=='number'){end=(typeof end=='number')?end:begin;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(begin,end);}else if(this.createTextRange){var range=this.createTextRange();range.collapse(true);range.moveEnd('character',end);range.moveStart('character',begin);range.select();}});}else{if(this[0].setSelectionRange){begin=this[0].selectionStart;end=this[0].selectionEnd;}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();begin=0-range.duplicate().moveStart('character',-100000);end=begin+range.text.length;}
return{begin:begin,end:end};}},unmask:function(){return this.trigger("unmask");},mask:function(mask,settings){if(!mask&&this.length>0){var input=$(this[0]);var tests=input.data("tests");return $.map(input.data("buffer"),function(c,i){return tests[i]?c:null;}).join('');}
settings=$.extend({placeholder:"_",completed:null},settings);var defs=$.mask.definitions;var tests=[];var partialPosition=mask.length;var firstNonMaskPos=null;var len=mask.length;$.each(mask.split(""),function(i,c){if(c=='?'){len--;partialPosition=i;}else if(defs[c]){tests.push(new RegExp(defs[c]));if(firstNonMaskPos==null)
firstNonMaskPos=tests.length-1;}else{tests.push(null);}});return this.each(function(){var input=$(this);var buffer=$.map(mask.split(""),function(c,i){if(c!='?')return defs[c]?settings.placeholder:c});var ignore=false;var focusText=input.val();input.data("buffer",buffer).data("tests",tests);function seekNext(pos){while(++pos<=len&&!tests[pos]);return pos;};function shiftL(pos){while(!tests[pos]&&--pos>=0);for(var i=pos;i<len;i++){if(tests[i]){buffer[i]=settings.placeholder;var j=seekNext(i);if(j<len&&tests[i].test(buffer[j])){buffer[i]=buffer[j];}else
break;}}
writeBuffer();input.caret(Math.max(firstNonMaskPos,pos));};function shiftR(pos){for(var i=pos,c=settings.placeholder;i<len;i++){if(tests[i]){var j=seekNext(i);var t=buffer[i];buffer[i]=c;if(j<len&&tests[j].test(t))
c=t;else
break;}}};function keydownEvent(e){var pos=$(this).caret();var k=e.keyCode;ignore=(k<16||(k>16&&k<32)||(k>32&&k<41));if((pos.begin-pos.end)!=0&&(!ignore||k==8||k==46))
clearBuffer(pos.begin,pos.end);if(k==8||k==46||(iPhone&&k==127)){shiftL(pos.begin+(k==46?0:-1));return false;}else if(k==27){input.val(focusText);input.caret(0,checkVal());return false;}};function keypressEvent(e){if(ignore){ignore=false;return(e.keyCode==8)?false:null;}
e=e||window.event;var k=e.charCode||e.keyCode||e.which;var pos=$(this).caret();if(e.ctrlKey||e.altKey||e.metaKey){return true;}else if((k>=32&&k<=125)||k>186){var p=seekNext(pos.begin-1);if(p<len){var c=String.fromCharCode(k);if(tests[p].test(c)){shiftR(p);buffer[p]=c;writeBuffer();var next=seekNext(p);$(this).caret(next);if(settings.completed&&next==len)
settings.completed.call(input);}}}
return false;};function clearBuffer(start,end){for(var i=start;i<end&&i<len;i++){if(tests[i])
buffer[i]=settings.placeholder;}};function writeBuffer(){return input.val(buffer.join('')).val();};function checkVal(allow){var test=input.val();var lastMatch=-1;for(var i=0,pos=0;i<len;i++){if(tests[i]){buffer[i]=settings.placeholder;while(pos++<test.length){var c=test.charAt(pos-1);if(tests[i].test(c)){buffer[i]=c;lastMatch=i;break;}}
if(pos>test.length)
break;}else if(buffer[i]==test[pos]&&i!=partialPosition){pos++;lastMatch=i;}}
if(!allow&&lastMatch+1<partialPosition){input.val("");clearBuffer(0,len);}else if(allow||lastMatch+1>=partialPosition){writeBuffer();if(!allow)input.val(input.val().substring(0,lastMatch+1));}
return(partialPosition?i:firstNonMaskPos);};if(!input.attr("readonly"))
input.one("unmask",function(){input.unbind(".mask").removeData("buffer").removeData("tests");}).bind("focus.mask",function(){focusText=input.val();var pos=checkVal();writeBuffer();setTimeout(function(){if(pos==mask.length)
input.caret(0,pos);else
input.caret(pos);},0);}).bind("blur.mask",function(){checkVal();if(input.val()!=focusText)
input.change();}).bind("keydown.mask",keydownEvent).bind("keypress.mask",keypressEvent).bind(pasteEventName,function(){setTimeout(function(){input.caret(checkVal(true));},0);});checkVal();});}});})(jQuery);(function($){$.fn.wTooltip=function(o,callback){o=$.extend({content:null,ajax:null,follow:true,auto:true,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(tooltip,node,settings){},callAfter:function(tooltip,node,settings){},clickAction:function(tooltip,node){$(tooltip).hide();},delay:0,timeout:0},o||{});if(!o.style&&typeof o.style!="object"){o.style={};o.style.zIndex="1000";}
else{o.style=$.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},o.style||{});}
if(typeof callback=="function")
o.callAfter=callback||o.callAfter;o.style.display="none",o.style.position="absolute";var title,timeout,timeout2,iId,over={},firstMove=true,hovered=false,maxed=false,tooltip=document.createElement('div'),ie6=(typeof document.body.style.maxWidth=="undefined")?true:false,talk=(typeof $.talk=="function"&&typeof $.listen=="function")?true:false;if(o.id)
tooltip.id=o.id;if(o.className)
tooltip.className=o.className;o.degrade=(o.degrade&&ie6)?true:false;for(var p in o.style)
tooltip.style[p]=o.style[p];function fillTooltip(condition){if(condition){if(o.degrade)
$(tooltip).html(o.content.replace(/<\/?[^>]+>/gi,''));else
$(tooltip).html(o.content);}}
if(o.ajax){$.get(o.ajax,function(data){if(data)
o.content=data;fillTooltip(o.content);});}
function offConditions(that){function _offActions(that){if(title&&!o.content){title="";}}
function _execute(){if(!hovered&&o.auto){clearInterval(iId);if(o.fadeOut){$(tooltip).fadeOut(o.fadeOut,function(){_offActions(that);});}
else{_offActions(that);tooltip.style.display="none";}}
if(typeof o.callAfter=="function")
o.callAfter(tooltip,that,o);if(talk)
o=$.listen(o);}
if(o.timeout>0){timeout2=setTimeout(function(){_execute();},o.timeout);}
else{_execute();}}
$(tooltip).hover(function(){hovered=true;},function(){hovered=false;offConditions(over);});if(talk){o.key=tooltip;o.plugin="wTooltip";o.channel="wayfarer";$.talk(o);}
fillTooltip(o.content&&!o.ajax);$(tooltip).appendTo(o.appendTip);return this.each(function(){$(this).hover(function(){var that=this;clearTimeout(timeout2);if((this.title||this.titleMemKeep)&&!o.degrade&&!o.content){title=this.title||this.titleMemKeep;if(this.title){this.titleMemKeep=this.title;this.title="";}}
if(o.content&&o.degrade)
this.title=tooltip.innerHTML;function _execute(){if(typeof o.callBefore=="function")
o.callBefore(tooltip,that,o);if(talk)
o=$.listen(o);var display;if(o.content){if(!o.degrade)
display="block";}
else
if(title&&!o.degrade){$(tooltip).html(unescape(title));display="block";title="";}
else{display="none";}
if(o.auto){if(display=="block"&&o.fadeIn)
$(tooltip).fadeIn(o.fadeIn);else
tooltip.style.display=display;}}
if(o.delay>0){timeout=setTimeout(function(){_execute();},o.delay);}
else{_execute();}},function(){clearTimeout(timeout);var that=this;firstMove=true;if(!o.follow||maxed||((o.offsetX<0&&(0-o.offsetX<$(tooltip).outerWidth()))&&(o.offsetY>0&&0-o.offsetY<$(tooltip).outerHeight()))){setTimeout(function(){iId=setInterval(function(){offConditions(that)},1)},1);}
else{offConditions(this);}});$(this).mousemove(function(e){over=this;if(o.follow||firstMove){var scrollY=$(window).scrollTop(),scrollX=$(window).scrollLeft(),top=e.clientY+scrollY+o.offsetY,left=e.clientX+scrollX+o.offsetX,outerH=$(o.appendTip).outerHeight(),innerH=$(o.appendTip).innerHeight(),maxLeft=$(window).width()+scrollX-$(tooltip).outerWidth(),maxTop=$(window).height()+scrollY-$(tooltip).outerHeight();top=(outerH>innerH)?top-(outerH-innerH):top;maxed=(top>maxTop||left>maxLeft)?true:false;if(left-scrollX<=0&&o.offsetX<0)
left=scrollX;else
if(left>maxLeft)
left=maxLeft;if(top-scrollY<=0&&o.offsetY<0)
top=scrollY;else
if(top>maxTop)
top=maxTop;tooltip.style.top=top+"px";tooltip.style.left=left+"px";firstMove=false;}});if(typeof o.clickAction=="function"){$(this).click(function(){o.clickAction(tooltip,this);});}});}})(jQuery);