(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);

(function( win, $ ){
	
	$(function(){
		
		var html = "<div id=\"dw-network\">\
			<div id=\"dw-network-sites\">\
				<h6 class=\"title first\">Dogwoof Sites</h6>\
				<ul>\
					<li class=\"site\"><a href=\"http://dogwoof.com\">Dogwoof Films</a></li>\
					<li class=\"site\"><a href=\"http://goodwithfilm.com\">Good with Film</a></li>\
					<li class=\"site\"><a href=\"http://popupcinema.net\">Popup Cinema</a></li>\
					<li class=\"site\"><a href=\"http://dogwoofdvd.com\">Dogwoof DVD Shop</a></li>\
					<li class=\"site\"><a href=\"http://dogwoof.tv\">Dogwoof TV</a></li>\
				</ul>\
				<h6 class=\"title\">Dogwoof Social</h6>\
				<ul>\
					<li class=\"twitter\"><a href=\"http://twitter.com/dogwoof\">Twitter</a></li>\
					<li class=\"facebook\"><a href=\"http://facebook.com/dogwoof\">Facebook</a></li>\
					<li class=\"youtube\"><a href=\"http://www.youtube.com/dogwoof\">Youtube</a></li>\
				</ul>\
			</div>\
			<a href=\"http://dogwoof.com\" id=\"dw-button\"><img src=\"http://dogwoof.com/dw-network/dw-logo-button1.png\" alt=\"Dogwoof Network\"></a>\
		</div>";
		
		$('body').append($(html));
		
		$('#dw-network').hoverIntent({
			over : function(){
				$(this).addClass('hover');
			},
			out : function(){
				$(this).removeClass('hover');
			},
			timeout: 300
		});

		$('#dw-button').click(false);	
	});
	
})( this, jQuery);
