(function(a){a.fn.extend({bstip:function(b){var c=a.extend({},a.fn.bstip.defaults,b);return this.each(function(g){var f=a(this).id,k=a(this).attr("title"),e=a(this);var j=e.attr("class"),d=e.attr("rel");e.addClass("souniqueithurts");if(j==""){newclass=""}else{newclass=j;newclass=newclass.replace(/ /,"")}if(f==""){newid=""}else{newid=f}if(d==""){newrel=""}else{newrel=d}if(c.type=="tip"){newclass="souniqueithurts";if(a("#bs"+g+newclass+newid+newrel).length<=0){a("body").append("<div class='"+c.color+"' id='bs"+g+newclass+newid+newrel+"'>"+c.forewrap+k+c.backwrap+"</div>")}if((a.browser.msie||a.browser.opera)&&a("#bs"+g+newclass+newid+newrel).length>0){a("#bs"+g+newclass+newid+newrel).html(c.forewrap+k+c.backwrap)}}else{if(c.type=="menu"){nextitem=a("#"+k);nextcont=nextitem.html();a("body #bg-top .kontener-center").append("<div class='"+c.color+"' id='bs"+g+newclass+newid+newrel+"'>"+c.forewrap+nextcont+c.backwrap+"</div>");nextitem.remove()}}var h=a("#bs"+g+newclass+newid+newrel);tipwidth=h.width();tipheight=h.height();offset=e.offset();left=offset.left;right=offset.right;nwidth=a(this).width();nheight=a(this).height();if(c.hook=="bottom-right"||c.hook=="mid-right"||c.hook=="top-right"){bleft=offset.left+nwidth+c.xnudge}else{if(c.hook=="bottom-mid"||c.hook=="mid-mid"||c.hook=="top-mid"){bleft=offset.left+(nwidth/2)-(tipwidth/2)+c.xnudge}else{if(c.hook=="bottom-left"||c.hook=="mid-left"||c.hook=="top-left"){if(c.type=="menu"){offset2=e.position()}bleft=offset2.left-c.xnudge+(nwidth/2)}}}if(c.hook=="top-right"||c.hook=="top-mid"||c.hook=="top-left"){btop=offset.top-c.ynudge-tipheight}else{if(c.hook=="mid-right"||c.hook=="mid-mid"||c.hook=="mid-left"){btop=offset.top+c.ynudge}else{if(c.hook=="bottom-right"||c.hook=="bottom-mid"||c.hook=="bottom-left"){btop=offset.top+nheight+c.ynudge}}}h.css({top:btop,left:bleft,position:"absolute",display:"none"});if(c.sticky=="none"){a(this).removeAttr("title").hover(function(){h.css({opacity:c.opacity}).delay(100).fadeIn(c.speed)},function(){if(c.queue==1){h.clearQueue()}t=setTimeout(function(){h.fadeOut(c.speed)},c.tack)});h.hover(function(){clearTimeout(t)},function(){if(c.queue==1){h.clearQueue()}t=setTimeout(function(){h.fadeOut(c.speed)},c.tack)})}else{if(c.sticky=="move"){a(this).removeAttr("title").mouseover(function(){h.css({opacity:c.opacity,display:"none"}).fadeIn(c.speed)}).mousemove(function(i){tipwidth=h.width();tipheight=h.height();if(c.hook=="bottom-right"||c.hook=="mid-right"||c.hook=="top-right"){bleft=i.pageX+c.xnudge}else{if(c.hook=="bottom-mid"||c.hook=="mid-mid"||c.hook=="top-mid"){bleft=i.pageX-(tipwidth/2)+c.xnudge}else{if(c.hook=="bottom-left"||c.hook=="mid-left"||c.hook=="top-left"){bleft=i.pageX-c.xnudge-tipwidth}}}if(c.hook=="top-right"||c.hook=="top-mid"||c.hook=="top-left"){btop=i.pageY-tipheight-c.ynudge}else{if(c.hook=="mid-right"||c.hook=="mid-mid"||c.hook=="mid-left"){btop=i.pageY-(tipheight/2)+c.ynudge}else{if(c.hook=="bottom-right"||c.hook=="bottom-mid"||c.hook=="bottom-left"){btop=i.pageY+c.ynudge}}}h.css({left:bleft,top:btop})}).mouseout(function(){h.fadeOut(c.speed)})}else{if(c.sticky=="slide"){a(this).removeAttr("title").mouseover(function(){h.css({opacity:c.opacity,display:"none"}).fadeIn(c.speed)}).mousemove(function(i){if(c.hook=="bottom-right"||c.hook=="mid-right"||c.hook=="top-right"){bleft=i.pageX+c.xnudge}else{if(c.hook=="bottom-mid"||c.hook=="mid-mid"||c.hook=="top-mid"){bleft=i.pageX-(tipwidth/2)+c.xnudge}else{if(c.hook=="bottom-left"||c.hook=="mid-left"||c.hook=="top-left"){bleft=i.pageX-c.xnudge-tipwidth}}}if(c.hook=="top-right"||c.hook=="top-mid"||c.hook=="top-left"){btop=top-c.ynudge-tipheight}else{if(c.hook=="mid-right"||c.hook=="mid-mid"||c.hook=="mid-left"){btop=top+c.ynudge}else{if(c.hook=="bottom-right"||c.hook=="bottom-mid"||c.hook=="bottom-left"){btop=top+nheight+c.ynudge}}}h.css({left:bleft,top:btop})}).mouseout(function(){t=setTimeout(function(){h.fadeOut(c.speed)},c.tack)});h.hover(function(){clearTimeout(t)},function(){t=setTimeout(function(){h.fadeOut(c.speed)},c.tack)})}}}})}});a.fn.bstip.defaults={sticky:"move",forewrap:"<p>",backwrap:"</p>",hook:"bottom-right",color:"bstip",speed:"fast",type:"tip",tack:0,queue:1,keep:2000,ynudge:15,xnudge:15,opacity:0.8}})(jQuery);