 $(document).ready(function(){
	reloadmonitors();
	load_last();
	$("a#bilde").fancybox({
		'overlayShow'	: true,
	}); 	
	$('textarea#text').markItUp(mySettings);
	$('#emoticons a').click(function() {
		$("textarea#text").focus();
		emoticon = $(this).attr("title");
		$.markItUp( { replaceWith:emoticon } );
		return false;
	});
	$('#quote a').click(function() {
		$("textarea#text").focus();
		emoticon = $(this).attr("title");
		$.markItUp( { replaceWith:emoticon } );
		return false;
	});
});
 function reloadmonitors(){
		$("#monitors .server").hide().html('<br clear="both" \/><center><img src="template\/images\/lade.gif" alt="" \/><\/center><br clear="both" \/>').fadeIn('slow').each(function(){
			$(this).load("/modules/monitor_inc.php?server="+$(this).attr("id")+"");
		});
		window.setTimeout('reloadmonitors',5000);
	}
function surfs() {
		if($("#surfs").is(":hidden")){
			$("#surfs").slideDown();
		}else{
			$("#surfs").slideUp();
		}
	}

function zombie() {
		if($("#zombie").is(":hidden")){
			$("#zombie").slideDown();
		}else{
			$("#zombie").slideUp();
		}
	}
function dust() {
		if($("#dust").is(":hidden")){
			$("#dust").slideDown();
		}else{
			$("#dust").slideUp();
		}
	}
function hns() {
		if($("#hns").is(":hidden")){
			$("#hns").slideDown();
		}else{
			$("#hns").slideUp();
		}
		
	}
function sh() {
		if($("#sh").is(":hidden")){
			$("#sh").slideDown();
		}else{
			$("#sh").slideUp();
		}
	}

function load_last(){
	$(".module").hide().html('<br clear="both" \/><center><img src="template\/images\/lade.gif" alt="" \/><\/center><br clear="both" \/>').each(function(){
		$(this).load("/modules/"+$(this).attr("id")+"_inc.php").fadeIn('slow');	
	});
	window.setTimeout('load_last',5000);
}

function open_ban(ban_id) {
	$.get("/system/get_ban_sys.php",
	{ id: ban_id },
	function(response){
		$("#ban_info").html(response);
	});
}

function DraugiemSay( title, url, titlePrefix ){
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}


function resets_last() {
	$(document).ready(function(){
		$(".module").hide().html('<br clear="both" \/><center><img src="template\/images\/lade.gif" alt="" \/><\/center><br clear="both" \/>').each(function(){
			$.get("/modules/"+$(this).attr("id")+"_inc.php")
			$(this).load("/modules/"+$(this).attr("id")+"_inc.php").fadeIn('slow');
		});
	}
)};

function ratingGood(type, parentid, div) {
	$("#" + div).fadeOut("fast");
	$.get("/system/rate_sys.php",
		{ type: type,
		parentid: parentid,
		div: div,
		action: "good",
		},
	function(response){
	$("#" + div).fadeIn("fast").html(response);
	});
}

function ratingBad(type, parentid, div) {
	$("#" + div).fadeOut("fast");
	$.get("/system/rate_sys.php",
		{ type: type,
		parentid: parentid,
		div: div,
		action: "bad",
		},
	function(response){
	$("#" + div).fadeIn("fast").html(response);
	});
}


