function gofly_load_by_page(p)
{
	/* On clean les pages link */
	$(".gofly_p_open").css('font-size','10px') ;
	$(".gofly_p_open").css('color','white') ;
	$("#gofly_p_"+p).css('font-size', '15px') ;	
	$("#gofly_p_"+p).css('color', 'red') ;	
	$.ajax({
		url: "/scripts/gofly_get_by_page.php",
		type: "POST",
		data: ({p: p}),
		dataType: "html",
		success: function(html) {
			$("#f_content").html(html) ;
		}
	}) ;
}
function gofly_open_extended_infos_frm()
{
	if($("#fly_extended_infos").val() == '1') {
		$("#fly_extended_infos").val('0') ;
	} else {
		$("#fly_extended_infos").val('1') ;
	}

	$('#flyMoreInfo').slideToggle('fast', function(){$('#flyMoreInfoLink').contents().unwrap();});
}

function gofly_comment_get_from_fid(fId)
{
	$.ajax({
		url: "/scripts/gofly_get_comments_from_fid.php",
		type: "POST",
		data: ({fid: fId}),
		dataType: "html",
		success: function(html)
		{
			$("#fly_comments_"+fId).html(html) ;
			$("#fly_comments_"+fId).show() ;
			$("#a_show_comment_"+fId).hide() ;
			$("#a_hide_comment_"+fId).show() ;
		}
	}) ;
}

function gofly_hide_comment(fId)
{
	$("#fly_comments_"+fId).hide() ;
	$("#a_show_comment_"+fId).show() ;
	$("#a_hide_comment_"+fId).hide() ;
}

function gofly_add_comment()
{
	var comment = $("#gofly_comment").val() ;
	var fId = $("#gofly_id_comment").val() ;

	$.ajax({
		url: "/scripts/gofly_add_comment.php",
		type: "POST",
		data: ({fcomment: comment, fid: fId}),
		dataType: "html",
		success: function(data) {
			gofly_comment_get_from_fid(fId) ;
			$("#flyCommentaireAdd").hide() ;
			$("#gofly_comment").val('') ;
		}
	}) ;

}

function gofly_open_add_igofly_frm(fId, e)
{
	var cX = e.clientX ;
	var cY = e.clientY ;
	$('#flyIcome').show();
	$('#flyIcome').css('top', parseInt(cY + 100) + "px") ;
	$('#flyIcome').css('left', parseInt(cX - 650) + "px") ;
	$("#gofly_id_icome").val(fId) ;

}

function gofly_open_add_comment_frm(fId, e)
{
	var cX = e.clientX ;
	var cY = e.clientY ;
	$('#flyCommentaireAdd').show();
	$('#flyCommentaireAdd').css('top', parseInt(cY - 180) + "px") ;
	$('#flyCommentaireAdd').css('left', parseInt(cX - 150) + "px") ;
	$("#gofly_id_comment").val(fId) ;
}

