﻿jQuery(document).ready(function(){
	$().mousemove(function(e){
		var t = e.pageY+5;
		var l = e.pageX+5;
		if (l+250 > screen.width) {
			l=l-220+"px";
		}
		$('#tooltipBox').css("top", t);
		$('#tooltipBox').css("left", l);
	});
	var otitle = null;
	$('div#content li > a').hover(function () {
		$('#tooltipBox').show("fast");
		otitle = $(this).attr("title");
		title = otitle.split(",");
		htmladd = "";
		if ($(this).attr("rel") == "tooltip") {
			if (title[0]) htmladd += "<b>Título Original:</b> "+title[0]+"<br>";
			if (title[1]) htmladd += "<b>Ano:</b> "+title[1]+"<br>";
			if (title[2]) htmladd += "<b>Gênero:</b> "+title[2]+"<br>";
			if (title[3]) htmladd += "<b>Temporada:</b> "+title[3]+"<br>";
			if (title[4]) htmladd += "<b>Formato:</b> "+title[4]+"<br>";
			if (title[5]) htmladd += "<b>Status:</b> "+title[5];
		} else if ($(this).attr("rel") == "tooltip-filme") {
			if (title[0]) htmladd += "<b>Título Original:</b> "+title[0]+"<br>";
			if (title[1]) htmladd += "<b>Título Nacional:</b> "+title[1]+"<br>";
			if (title[2]) htmladd += "<b>Ano:</b> "+title[2]+"<br>";
			if (title[3]) htmladd += "<b>Gênero:</b> "+title[3]+"<br>";
			if (title[4]) htmladd += "<b>Formato:</b> "+title[4]+"<br>";
			if (title[5]) htmladd += "<b>Duração:</b> "+title[5];
		}else if ($(this).attr("rel") == "tooltip-leg") {
			if (title[0]) htmladd += "<b>Série:</b> "+title[0]+"<br>";
			if (title[1]) htmladd += "<b>Gênero:</b> "+title[1]+"<br>";
			if (title[2]) htmladd += "<b>Episódio:</b> "+title[2]+"<br>";
			if (title[3]) htmladd += "<b>Tamanho:</b> "+title[3]+"<br>";
			if (title[4]) htmladd += "<b>Release:</b> "+title[4]+"<br>";
}
		$('#tooltipBox').html(htmladd);
		$(this).removeAttr("title");
	}, function() {
		$(this).attr("title", otitle);
		$('#tooltipBox').hide();
	});
	$('div#content li > a').mouseout(function() {
		$('#tooltipBox').hide();
	});
	$('body').mouseover(function() {
		$('#tooltipBox').hide();
	});
	$('div').mouseover(function() {
		$('#tooltipBox').hide();
	});
});
