/**
 * 
 */
function sml(n)
{document.f.zprava.value+=" "+n+" ";}
$(document).ready(function(){
$("span[id^='anchor']").click(function(){
id = $(this).attr("id").split("-")[1];
$.scrollTo($("#comment-"+id),800);
})

var RecaptchaOptions = {
				custom_translations : {
						instructions_visual : "Zadejte oba texty z obrázku:",
						instructions_audio : "Zadejte co slyšíte:",
						play_again : "Znovu přehrát",
						cant_hear_this : "Stáhni soubor ve formátu MP3",
						visual_challenge : "Chci obrázkovou verzi",
						audio_challenge : "Chci zvukovou verzi",
						refresh_btn : "Nový obrázok",
						help_btn : "Chci pomoc",
						incorrect_try_again : "Nesprávně zadáno, zkuste to znovu",
				},
				lang : 'cz', // Unavailable while writing this code (just for audio challenge)
				theme : 'red',
		};

$("#btnOdeslat").click(function() {
$(this).attr("disabled","disabled");
$.post("/user/forum.php?action=save", { zprava:$("#zprava").val() },function (data) {
if(data.substr(0,5)!="ERROR") {
$("#board").prepend(data);
$(".latestPost").fadeIn();
$(".latestPost").removeClass(".latestPost");
$("#zprava").val("");
$("#last").html(Number($("#last").html())+1)
}else {
alert("Chyba - "+data.split("|")[1]);
}
$("#btnOdeslat").removeAttr("disabled");
} );

}
)
$('#btnNewMessagesLoad').click(function(){
var c=Number($("#current").html()); 
var l=Number($("#last").html());
$.get("/user/forum.php", { count:c-l,action:'latest' },function (data) {
$("#board").prepend(data);
$(".latestPost").fadeIn();
$(".latestPost").removeClass(".latestPost");
$("#last").html($("#current").html());
$("#btnNewMessagesLoad").fadeOut(function(){$("#btnNewMessagesLoad").html("");});
$('title').html("FANCLUB HCHK 2007 o.s.");
$("span[id^='anchor']").click(function(){
id = $(this).attr("id").split("-")[1];
$.scrollTo($("#comment-"+id),800);});
});
});
tick();
})
function quote(id)
 {
 //alert(id);
 $("#zprava").val($("#zprava").val() + "["+id+"]"); 
 }


var tout = 45000;
function tick()
{
$.get("/user/forum.php?action=count",
function(data){
$("#current").html(data);
var c=Number($("#current").html()); 
var l=Number($("#last").html());
if(c-l>0) {
$('title').html("Nových příspěvků - "+(c-l));
$('#btnNewMessagesLoad').html("Nových příspěvků - "+(c-l));
//$("#jPlayer").play();
$("#btnNewMessagesLoad").fadeIn();
} else {
$('title').html("FANCLUB HCHK 2007 o.s.");
$("#btnNewMessagesLoad").fadeOut(function(){$("#btnNewMessagesLoad").html("");});

}
});
setTimeout("tick()",tout);
}
