var preload = document.createElement('img');
preload.src = '/img/tooltip.png';
$(document).ready(function() {

	$("#navbaricon div a").hover(function() {
		$(this).next("span").stop(true, true).show().animate({opacity: 0.9, top: "-83"});
		}, function() {
		$(this).next("span").animate({opacity: "hide", top: "-93"}, "fast");
	});

	$('#navbar div').hover(function() {
		$(this).toggleClass('navbarhover');
		}, function () {
		$(this).toggleClass('navbarhover');
	});

	$('.compartir img').click(function() {
		var d = document, l = d.location, u = l.href, e = encodeURIComponent, w = 550, h = 350;

		switch($(this).attr('id'))
		{
			case 'comp-tw':
				u = 'http://twitter.com/share?related=ferjgar&url='+e(u);
				h = 450;
			break;

			case 'comp-fb':
				u = 'http://www.facebook.com/sharer.php?u='+e(u);
			break;

			case 'comp-me':
				u = 'http://meneame.net/submit.php?url='+e(u);
				window.open(u);
				return false;
			break;

			case 'comp-gr':
				u = 'http://www.google.com/reader/link?url='+e(u);
			break;

			default:
				return false;
		}

		var top = (screen.height - h) / 2, left = (screen.width - w) / 2;

		a = function()
		{
			if(!window.open(u,'compartir','toolbar=0,status=0,resizable=1,width='+w+',height='+h+',top='+top+',left='+left))
			{
				l.href = u;
			}
		}

		if(/Firefox/.test(navigator.userAgent))
		{
			setTimeout(a,0);
		}
		else
		{
			a();
		}

		return false;
	});
});

