(function($){$.fn.wpcstooltip=function(options){var defaults={cssClass:"",delay:0,duration:500,xOffset:15,yOffset:15,opacity:0,fadeDuration:400,eventshow:'mouseover',eventhide:'mouseleave',ajaxSource:'href',closebutton:'no',fixed:false};var options=$.extend(defaults,options);return this.each(function(index){var $this=$(this);$wpcstooltip=$("#divwpcstooltip");$wpcstooltipC=$("#divwpcstooltipC");$wpcstooltipT=$("#divwpcstooltipT");$wpcstooltip.hide();if($wpcstooltip.length==0){$wpcstooltip=$('<div id="divwpcstooltip"><div id="divwpcstooltipT"></div><div id="divwpcstooltipC"></div></div>');$('body').append($wpcstooltip);$wpcstooltip.hide();}
function show(e){e=e?e:window.event;if(options.closebutton=='yes'){$wpcstooltipT.html("<div id='close'>Sluiten</div>");}
clearTimeout($wpcstooltip.data("hideTimeoutId"));$wpcstooltip.removeClass($wpcstooltip.attr("class"));$wpcstooltip.css("width","");$wpcstooltip.css("height","");$wpcstooltip.addClass(options.cssClass);$wpcstooltip.css("opacity",1-options.opacity/100);$wpcstooltip.css("position","absolute");$wpcstooltip.data("title",$this.attr("title"));$this.attr("title","");$wpcstooltip.data("alt",$this.attr("alt"));$this.attr("alt","");$wpcstooltipC.html($wpcstooltip.data("title"));var el=$this.attr(options.ajaxSource);if(el!=undefined&&el!=""&&el!="#")
$wpcstooltipC.html($.ajax({url:$this.attr(options.ajaxSource),async:false}).responseText);if(options.fixed===false){winw=$(window).width();w=$wpcstooltip.width();xOffset=options.xOffset;if(w+xOffset+50<winw-e.clientX)
$wpcstooltip.css("left",$(document).scrollLeft()+ e.clientX+xOffset);else if(w+xOffset+50<e.clientX)
$wpcstooltip.css("left",$(document).scrollLeft()+ e.clientX-(w+xOffset));else{if(e.clientX>winw/2){$wpcstooltip.width(e.clientX-50);$wpcstooltip.css("left",$(document).scrollLeft()+ 25);}
else{$wpcstooltip.width((winw-e.clientX)-50);$wpcstooltip.css("left",$(document).scrollLeft()+ e.clientX+xOffset);}}
winh=$(window).height();h=$wpcstooltip.height();yOffset=options.yOffset;if(h+yOffset+ 50<e.clientY)
$wpcstooltip.css("top",$(document).scrollTop()+ e.clientY-(h+yOffset));else if(h+yOffset+ 50<winh-e.clientY)
$wpcstooltip.css("top",$(document).scrollTop()+ e.clientY+yOffset);else
$wpcstooltip.css("top",$(document).scrollTop()+ 10);}
$wpcstooltip.data("showTimeoutId",setTimeout("$wpcstooltip.fadeIn("+options.fadeDuration+")",options.delay));}
$this.bind(options.eventshow,function(event){show(event);});$wpcstooltip.bind('mouseover',function(event){$this.stop();clearTimeout($wpcstooltip.data("hideTimeoutId"));});$wpcstooltip.bind('mouseleave',function(event){hide(event);});function hide(e){e=e?e:window.event;$this.attr("title",$wpcstooltip.data("title"));$this.attr("alt",$wpcstooltip.data("alt"));clearTimeout($wpcstooltip.data("showTimeoutId"));$wpcstooltip.data("hideTimeoutId",setTimeout("$wpcstooltip.fadeOut("+options.fadeDuration+")",options.duration));}
$this.bind(options.eventhide,function(event){hide(event);});$this.click(function(e){e.preventDefault();});$wpcstooltipT.click(function(event){hide(event);});});}})(jQuery);
