$(document).ready(function(){
	//$(".rounded").corner("round 20px");

	// custom options
	$("#mp3").jmp3({
		//filepath: "http://etapasvi.zxq.net/"
		filepath: "http://www.etapasvi.com/audio/"
	});

	// select language
	$(".lang_selector").click(
		function (event) {
			event.stopPropagation();
			if ( $("#lang_list").is(":hidden") ) {
				$("#lang_list").slideDown("fast");
			} else {
				$("#lang_list").slideUp("fast");
			}
		}
	);

	$("html").click(
		function () {
			$("#lang_list").slideUp("fast");
		}
	);
});

function showComments() 
{
	if ( $("#elComments").is(":hidden") ) {
		$("#elComments").slideDown("slow");
	} else {
		$("#elComments").slideUp("slow");
	}
}

function ideaReportAbuse(idea_id, url) 
{
	if (!idea_id || !url) return;

	// засериваем картинку
	$('#idea_report_abuse_'+idea_id).addClass( 'action_abuse_disabled');

	$.getJSON(url, function(data){		
		if (data.redirect != '') {
			window.location.href = data.redirect;
		}
	});
}

function ideaVote(idea_id, url) 
{
	if (!idea_id || !url) return;

	// засериваем картинку
	$('#idea_vote_'+idea_id).addClass( 'action_vote_disabled');	
	
	$.getJSON(url, function(data) {			
		if (data.redirect != '') {
			window.location.href = data.redirect;
		} else {
			// увеличиваем количество голосов
			$('#idea_votes_'+data.idea_id).html( $('#idea_votes_'+idea_id).html() * 1 + 1 );
		}
	});
}

// оформляем или отключаем подписку
function subscribeClick( subscribeCheckbox, url ) 
{
	if (!url) return;
	if (subscribeCheckbox.checked == true) {
		value = 1;
	} else {
		value = 0;
	}

	$.getJSON(url + "/value/" + value, function(data) {	
		if (data.redirect != '') {
			window.location.href = data.redirect;		
		}
	});
}
