(function(d){d.fn.highlight=function(a){var b=a&&a.constructor==String?{start:a}:a||{},c={start:[255,255,128],interval:50,speed:1E3,attr:"backgroundColor"},f=b.interval||c.interval,e=b.attr||c.attr,a={linear:function(a,b,c,d){return parseInt(a+d/c*(b-a))},sinusoidal:function(a,b,c,d){return parseInt(a+Math.sin(90*(d/c)*(Math.PI/180))*(b-a))},exponential:function(a,b,c,d){return parseInt(a+Math.pow(d/c,2)*(b-a))}},g=b.iterator&&b.iterator.constructor==Function?b.iterator:a[b.iterator]||a[c.iterator]||
a.linear;c.iterator&&c.iterator.constructor==Function&&(g=c.iterator);return this.each(function(){this.highlighting||(this.highlighting={});var a=this.highlighting[e]?this.highlighting[e].end:d.highlight.getBaseValue(this,e)||[255,255,255],j=d.highlight.getRGB(b.start||b.colour||b.color||c.start||[255,255,128]),k=d.speed(b.speed||c.speed),h=b["final"]||this.highlighting[e]&&this.highlighting[e].orig?this.highlighting[e].orig:d.curCSS(this,e);if(b.end||c.end)h=d.highlight.asRGBString(a=d.highlight.getRGB(b.end||
c.end));"undefined"!=typeof b["final"]&&(h=b["final"]);this.highlighting[e]&&this.highlighting[e].timer&&window.clearInterval(this.highlighting[e].timer);this.highlighting[e]={steps:k.duration/f,interval:f,currentStep:0,start:j,end:a,orig:h,attr:e};d.highlight(this,e,b.complete,g)})};d.highlight=function(a,b,c,f){a.highlighting[b].timer=window.setInterval(function(){var e=f(a.highlighting[b].start[0],a.highlighting[b].end[0],a.highlighting[b].steps,a.highlighting[b].currentStep),g=f(a.highlighting[b].start[1],
a.highlighting[b].end[1],a.highlighting[b].steps,a.highlighting[b].currentStep),i=f(a.highlighting[b].start[2],a.highlighting[b].end[2],a.highlighting[b].steps,a.highlighting[b].currentStep);d(a).css(b,d.highlight.asRGBString([e,g,i]));a.highlighting[b].currentStep++>=a.highlighting[b].steps&&(d(a).css(b,a.highlighting[b].orig||""),window.clearInterval(a.highlighting[b].timer),a.highlighting[b]=null,c&&c.constructor==Function&&c.call(a))},a.highlighting[b].interval)};d.highlight.getRGB=function(a,
b){var c;return a&&a.constructor==Array&&3==a.length?a:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a))?[parseInt(c[1]),parseInt(c[2]),parseInt(c[3])]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(a))?[2.55*parseFloat(c[1]),2.55*parseFloat(c[2]),2.55*parseFloat(c[3])]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(a))?[parseInt("0x"+c[1]),parseInt("0x"+c[2]),parseInt("0x"+c[3])]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(a))?
[parseInt("0x"+c[1]+c[1]),parseInt("0x"+c[2]+c[2]),parseInt("0x"+c[3]+c[3])]:d.highlight.checkColorName(a)||b||null};d.highlight.asRGBString=function(a){return"rgb("+a.join(",")+")"};d.highlight.getBaseValue=function(a,b,c){var f,e,c=c||!1;e=b=b||"backgroundColor";do{f=d(a).css(e||"backgroundColor");if(""!=f&&"transparent"!=f||"body"==a.tagName.toLowerCase()||!c&&a.highlighting&&a.highlighting[b]&&a.highlighting[b].end)break;e=!1}while(a=a.parentNode);!c&&(a.highlighting&&a.highlighting[b]&&a.highlighting[b].end)&&
(f=a.highlighting[b].end);if(void 0==f||""==f||"transparent"==f)f=[255,255,255];return d.highlight.getRGB(f)};d.highlight.checkColorName=function(a){if(!a)return null;switch(a.replace(/^\s*|\s*$/g,"").toLowerCase()){case "aqua":return[0,255,255];case "black":return[0,0,0];case "blue":return[0,0,255];case "fuchsia":return[255,0,255];case "gray":return[128,128,128];case "green":return[0,128,0];case "lime":return[0,255,0];case "maroon":return[128,0,0];case "navy":return[0,0,128];case "olive":return[128,
128,0];case "purple":return[128,0,128];case "red":return[255,0,0];case "silver":return[192,192,192];case "teal":return[0,128,128];case "white":return[255,255,255];case "yellow":return[255,255,0]}}})(jQuery);
