// Common javascript scripts goes here
//
// Poll
function pollShowResults(){
        $("#poll").empty();
        $("#poll").append('<img src="images/loader.gif">');
        $("#showres").hide();
        $("#showvote").show();
	$.ajax({
		url: "cb/poll.cb.php",
		cache: false,
                data: "action=1",
		type: "POST",
		success: function(html){
			$("#poll").empty();
			$("#poll").append(html);
		}
	});
}

function pollShowVoting(){
        $("#poll").empty();
        $("#poll").append('<img src="images/loader.gif">');
        $("#showvote").hide();
        $("#showres").show();
	$.ajax({
		url: "cb/poll.cb.php",
		cache: false,
                data: "action=2",
		type: "POST",
		success: function(html){
			$("#poll").empty();
			$("#poll").append(html);
		}
	});
}

function pollVote(opt){
        $("#poll").empty();
        $("#poll").append('<img src="images/loader.gif">');
        $("#showvote").hide();
        $("#showres").hide();
	$.ajax({
		url: "cb/poll.cb.php",
		cache: false,
                data: "action=1&vote=" + opt,
		type: "POST",
		success: function(html){
			$("#poll").empty();
			$("#poll").append(html);
		}
	});
}

//Calendar
function calShowCal(month, year){
        $("#kalendorius").empty();
        $("#kalendorius").append('<img src="images/loader.gif">');
	$.ajax({
		url: "cb/calendar.cb.php",
		cache: false,
                data: "month=" + month + "&year=" + year,
		type: "POST",
		success: function(html){
			$("#kalendorius").empty();
			$("#kalendorius").append(html);
		}
	});
}

//Newssletter
function callNewsletter(email, action){
	$.ajax({
		url: "cb/newsletter.cb.php",
		cache: false,
                data: "email=" + email + "&action=" + action,
		type: "POST",
		success: function(html){
			$("#newsletter").empty();
			$("#newsletter").append(html);
		}
	});
}
