// JavaScript Document for Bin v1.0
jQuery(function($){
	$(document).ready(function(){
									   
    $("a.ext")
		.hover(
			function(){
				$(this).filter(function(){
					return this.hostname && this.hostname !== location.hostname;
				}).each(function() {
					var link = $(this);
					var faviconURL = link.attr('href').replace(/^(http:\/\/[^\/]+).*$/, '$1')+'/'+'favicon.ico';
					var faviconIMG = $('<img class="extIcon" src="" alt="" />')['appendTo'](link);
					var extImg = new Image();
					extImg.src = faviconURL;
					if (extImg.complete){
						faviconIMG.attr('src', faviconURL);
						link.addClass("extLink");
					} else {
						extImg.onload = function() { faviconIMG.attr('src', faviconURL); };
					}
				});
			},
			function(){
				$("img.extIcon", this).remove();
				$(this).removeClass("extLink");
			}
		);

	});
});