$(document).ready(function() {
	//
	// onoff voting
	//
	$(".onoff_vote_up").livequery("click", function() {
		var onoff = this.parentNode.parentNode;

		$.post(JESUS_SCRIPT_ROOT + "onoff/vote/", {
			   onoff_id: $("a.onoff_id", onoff).html(),
			   vote: 1
			   }, function(xml){
					$("span.data", onoff).html(xml);
			});
	});
	$(".onoff_vote_down").livequery("click", function() {
		var onoff = this.parentNode.parentNode;

		$.post(JESUS_SCRIPT_ROOT + "onoff/vote/", {
			   onoff_id: $("a.onoff_id", onoff).html(),
			   vote: 0
			   }, function(xml){
					$("span.data", onoff).html(xml);
			});
	});

	//
	// News shoutbox submit
	//
	$("#article .comments #submit").livequery("click", function() {
		$.get(JESUS_SCRIPT_ROOT + 'news/shout/' + $("form#shout").serialize());
		alert("Το σχόλιό σου καταχωρήθηκε.");
	});

	//
	// Contact submit
	//
	$("form#contact div.button").livequery("click", function() {
		$.get(JESUS_SCRIPT_ROOT + 'contact/submit/' + $("form#contact").serialize(), {});
		alert("Το σχόλιό σου καταχωρήθηκε.");
	});

	//
	// Buy/sell
	//
	$("div#add_photo").livequery("click", function() {
		$("div#photos").append('<br /><div class="label">photo:</div><div class="control"><input type="file" name="photo[]" /></div>');
	});
});
