$(document).ready(function() {
	$("#sonda_close").click(
		function(){
			$(".sonda_kontener").removeAttr("class"); return false
		}
	);

	$("#sonda_close").click(
		function(){
			$("#sonda_nieglosowano").hide("slow"); return false
		}
	);

	$("#fastbutton").click(
		function(){
			$("#szybkaodp").toggle("slow"); return false
		}
	);
	
	$("#all_emo").click(
		function(){
			$.get("/ajax/emotki_ajx.php", 
			function(data){
                $("#emotki_in").html(data);
			}
			);
		}
	);

	$("#form_temat").change(
		function(){
			temat = $("#form_temat").val();
			if(temat.length > 5){
				$.get("/ajax/forum_duplikat_ajx.php", { t: temat }, 
	    			function(data){
	                    $("#temat_duplikat").html(data);
	                    $("#temat_duplikat").show("slow");
	    			}
				); 
				return false
			}
		}
	);	 
	
});



function pokazWarstwe(idwarstwy) {
	var str = document.getElementById(idwarstwy);
	
	if(str.style.display == "none"){
		str.style.display = "block"; return false;
	}else{
		str.style.display = "none"; return false;
	}
}

function mail(user, domain){window.location = 'mailto:'+user+'@'+domain;}

function selectAll() {
	var cheki = document.getElementById('checkall');
	var lista = document.getElementsByTagName('input');
	
	for(i=0;i<lista.length;i++){
		if(lista[i].getAttribute('type')=='checkbox'){
			if(cheki.checked == false){
				lista[i].checked = false;
			}else{
				lista[i].checked = true;
			}
			
		}
	}

	if(cheki.checked == false){
		cheki.checked = false;
	}else{
		cheki.checked = true;
	}
}
    

	function potwierdzenie(){
		return confirm('Czy napewno chcesz wykonać daną akcje ?');
	}
	
	function fastedit(text){
		$.get("/ajax/forum_fastedit_ajx.php", { post: text }, 
			function(data){
                $("#forumfe_" + text).html(data);
			}
		); 
		return false
	}
	