(function($){var opts={};$.fn.hotSpot=function(settings){opts.settings=$.extend({},$.fn.hotSpot.defaults,settings);$.fn.hotSpot.init();return this.each(function(){var $this=$(this);var o=opts.settings;$this.unbind('mouseover').bind('mouseover',function(){$.fn.hotSpot.show(this,o);return true;});});}
$.fn.hotSpot.init=function(){if(!$('#hotSpot').length){$('<div id="hotSpot"><div id="hotSpot_pointer"></div><div id="hotSpot_header">Реклама</div><div id="hotSpot_slider"><div id="hotSpot_content"></div><div id="hotSpot_bottom"><img src="t/template/img/loading_wide.gif" width="208" height="13" alt="" id="hotSpot_loading" /></div></div></div>').appendTo('body');$('#hotSpot, #hotSpot *').addClass('leave_open');}}
$.fn.hotSpot.show=function(el,o){$.fn.hotSpot.hide();var elPosLeft=jQuery(el).position().left;var posLeft=0;var diffLeft=0;if((elPosLeft+o.leftOffset+$('#hotSpot').width()+8)>$(document).width()){diffLeft=(elPosLeft+o.leftOffset+$('#hotSpot').width()+8)-$(document).width();posLeft=elPosLeft+o.leftOffset-diffLeft;}else{posLeft=elPosLeft+o.leftOffset;}
$.ajax({type:'GET',url:'inc/story-teller.php',data:'story='+$(el).html(),beforeSend:function(){$('#hotSpot').css({'top':(jQuery(el).position().top+jQuery(el).height()+o.topOffset)+'px','left':(posLeft)+'px'});$('#hotSpot_pointer').css({'margin-left':diffLeft+'px'});if($('#hotSpot').is(":hidden")){$('#hotSpot_content').css({'display':'none'});$('#hotSpot_loading').css({'display':'inline'});$('#hotSpot').fadeIn();}},success:function(story){if(story!=''){$('#hotSpot_content').html(story);$('#hotSpot_content *').addClass('leave_open');$('#hotSpot_loading').hide();$('#hotSpot_content').slideDown();}else{$('#hotSpot_content').html('<b style="color: red">No content on this topic!</b>');$('#hotSpot_loading').hide();$('#hotSpot_content').slideDown();setTimeout($.fn.hotSpot.hide,4000);}},error:function(){$('#hotSpot_content').html('<b style="color: red">No content on this topic!</b>');$('#hotSpot_loading').hide();$('#hotSpot_content').slideDown();setTimeout($.fn.hotSpot.hide,4000);}});$(document).bind('mousemove',function(e){if(!$(e.target).hasClass('leave_open')&&e.target.className!='intext_hotspot'){$.fn.hotSpot.hide();}});return true;}
$.fn.hotSpot.hide=function(){if(!$('#hotSpot').is(':hidden')){$('#hotSpot').fadeOut();$('#hotSpotcontent').html('');$(document).unbind('mousemove');}}
$.fn.hotSpot.defaults={topOffset:0,leftOffset:0};})(jQuery)
$(document).ready(function(){$('.intext_hotspot').hotSpot();});
