$(document).ready(function()
{
	$("#hwlink").click(function(e) 
	{
		$("#havewant_div").css('left', e.pageX-100);
		$("#havewant_div").css('top', e.pageY-10);
		$("#havewant_div").fadeIn('slow');
	});
	
	$("#havewant_div").mouseleave(function ()
	{
		$("#havewant_div").fadeOut('slow');
	});
	
	$(".edit_comment_click").click(function ()
	{
		var id = $(this).attr('id').substr(12);
		$.get("http://kolekcjonerdvd.pl/edycja_komentarza/1/"+id+"/", function(data){
			$("#area_edit_comment"+id).html(data);
			
			$("#save_comment"+id).click(function()
			{
				$.post("http://kolekcjonerdvd.pl/edycja_komentarza/2/"+id+"/", {comment: $("#comment_text"+id).val()}, function(data)
				{
					$("#area_edit_comment"+id).html(data);
				});
			});
		});
		
	});
});

var site_url = 'http://kolekcjonerdvd.pl/';



function clear_login()
{
	if (document.getElementById('login').value == "Wpisz login") 
	{
		document.getElementById('login').value = "";
	}
}

// RATING

function rating_vote(type, id)
{
	advAJAX.get({
	url: site_url+"index.php",
	parameters : {
		"section" : "content",
		"mode" : "rating_vote",
		"contentType" : type,
		"contentId" : id,
		"vote" : document.getElementById('rating').value
	},
	onSuccess : function(obj) { 
		document.getElementById('rating_panel').innerHTML = obj.responseText; 
	},
	onError : function(obj) { alert("Error: " + obj.status); }
	});
}

// END RATING

function havewant(rel, action)
{
	advAJAX.get({
	url: site_url+"index.php",
	parameters : {
		"section" : "tvseries",
		"mode" : "havewant",
		"release" : rel,
		"action" : action
	},
	onSuccess : function(obj) { 
		document.getElementById('havewant_wrapper').innerHTML = obj.responseText; 
	},
	onError : function(obj) { alert("Error: " + obj.status); }
	});
}