/*
###################################
#          FusionCMS v5           #
# - - - - - - - - - - - - - - - - #
#   Made by Jesper of raxezdev    #
###################################
*/

ajax1= new Image(24, 24); 
ajax1.src="theme/" + theme + "/images/ajax.gif";

ajax2= new Image(32, 32); 
ajax2.src="theme/" + theme + "/images/ajax_3.gif";

function get_online(id) {
	
	$("#realm_spot_" + id).show(500);
	$("#realm_spot_" + id + "_loader").fadeTo(1000, 1);
	$("#realm_spot_" + id + "_content").hide();
	
	$.get("inc/stats.php", { "id":id },
	function(data){
		$("#realm_spot_" + id + "_content").html(data);
		$("#realm_spot_" + id + "_loader").hide(500, function() {
			$("#realm_spot_" + id + "_content").show(500);
		});
		
	});
}

function show_who() {
	$("#who_module").show();
	$("#who_module").html("<center><img src='theme/" + theme + "/images/ajax.gif' /></center>");
	
	$.get("inc/who.php", function(data){
		$("#who_module").html(data);
	});
}

function show_results() {
	$("#poll_options").hide(500, function(){
		$("#poll_results").show(500)
	});
}

function show_vote() {
	$("#poll_results").hide(500, function(){
		$("#poll_options").show(500)
	});
}

function poll_vote(id) {
	$("#poll_options").html("<center><img src='theme/" + theme + "/images/ajax.gif' /></center>");
	$.get("inc/vote.php", { id: id }, function(data){
		show_results();
	});
}

var comment_submitted = false;

function submit_comment(name, date, newsid) {
	var msg = document.getElementById("comment_text").value;
	if(msg != "") {
		if(!comment_submitted) {
			
			$("#mycomment").html("<center><img src='theme/" + theme + "/images/ajax.gif' /></center><br />");
			$.get("inc/comment.php", { msg: msg, id: newsid }, function(data){
				$("#mycomment").html('<div class="news_comment"><b>[' + date +'] ' + name + ':</b> ' + msg + '</div>');
				$("#mycomment").show("fast");
				comment_submitted = true;
				document.getElementById("comment_text").value = "";
			});
		} else {
			alert("You may only submit one comment per page load, to prevent spamming!");
		}
	}
}

function remove_comment(id) {
	$("#comment_" + id).html('<img src="theme/' + theme + '/images/ajax_3.gif" />')
	
	$.get("inc/del_comment.php", { id: id }, function(data){
		$("#comment_" + id).hide("fast")
	});
}

function hide_reminder()
{
	$("#vote_popup").fadeTo(500, 0, function(){
		$("#vote_popup").hide();
	});
	
	$("#vote_popup_bg").fadeTo(500, 0, function(){
		$("#vote_popup_bg").hide();
	});
}

