var AJAX = "includes/ajax.php";
$(document).ready(function(){
	$('#bugFormText').attr("defaut", bugFormTextDefaut);
	
	$("a.bugReport").click(function(){
		if ($('#bugForm').css("display") == "none"){
			$('#bugFormText').val($('#bugFormText').attr("defaut"));
			$('#bugForm').fadeIn(150);
		}
		else
			$('#bugForm').fadeOut(150);
	});
	$("a.guest-btn-slide").hover(function(){
		$('#bugForm').fadeOut(150);
	});

	$('#bugFormText').val($('#bugFormText').attr("defaut"));
	
	$('#bugFormText').focus(function(){
		ResetBug($(this));});
	$('#bugFormText').blur(function(){
		RestoreBug($(this));});
	
	$('a.sendBug').click(function(){
		EnvoyerBug();});
		
	$('#welcomeSlide').click(function(){
		$('#welcomeHidden').slideToggle(500);
		var heightBas = 1100;
		if ($('#bas').height() == heightBas)
			$('#bas').height(heightBas+400);
		else
			$('#bas').height(heightBas);
		
	});
});
function ResetBug(id){
	if ($(id).val() == $(id).attr("defaut") || bugThx)
		$(id).val("");
}
function RestoreBug(id){
	if (!$(id).val())
		$(id).val($(id).attr("defaut"));	
}
function EnvoyerBug(){
	if (($('#bugFormText').val() != "") && ($('#bugFormText').val() != $('#bugFormText').attr("defaut")) && ($('#bugFormText').val() != bugThx)){
		if(!$.post(AJAX, { req: "testNav" }))
			alert(alerteAjax);
		else{
			$.post(AJAX, { req: "report_bug", message: $('#bugFormText').val() } );
			$('#bugFormText').val(bugThx)
			setTimeout('$("#bugForm").fadeOut(200);', 2000);
		}
	}
}