function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('contenu').offsetHeight + 260;
			
			var footerElement = document.getElementById('pied');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'relative';
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}
window.onload = function() {
	setFooter();
}
window.onresize = function() {
	setFooter();
}


$(document).ready(function() {
/*
	if($(".bloc")) {
		var hauteur = $(".bloc").height();
		if(hauteur < 400) {
			hauteur = 400;
		}
		$(".sur_bloc").height(hauteur);
	}
*/	
	$(".ch_court, .ch_long, .ch_text").each(function() {
		$(this).attr("rel2",$(this).val());
		$(this).css("color","#cccccc");
	});	
	$(".ch_court, .ch_long, .ch_text").focus(function() {
		if($(this).val() == $(this).attr("rel2")) {
			$(this).attr("rel",$(this).val());
			$(this).val("");
			$(this).css("color","#000000");
		}
	});
	$(".ch_court, .ch_long, .ch_text").blur(function() {
		if($(this).val() == $(this).attr("rel2") || $(this).val() == "") {
			$(this).val($(this).attr("rel2"));
			$(this).css("color","#cccccc");
		}
	});
	$("#btn_contact_vide").click(function() {
		$(".ch_court, .ch_long, .ch_text").each(function() {
			$(this).val($(this).attr("rel2"));
		});
		$(".ch_court, .ch_long, .ch_text").css("color","#cccccc");								  
	});
	$("#btn_contact_envoi").click(function() {
		$(".ch_court, .ch_long, .ch_text").each(function() {
			
		});
	});
	
});

function aff_real(id,lg) {
	$(".menu").width($("#contenu").width());
	document.location.href="#";
	$("#cadre_real").html("<center><img src='./img_graph/loader.gif' border='0' alt='Chargement' /><br />Chargement en cours</center>");
	$(".real_menu_m A").removeClass("real_menu_m_A_hover");
	$("#btn_real_"+id).addClass("real_menu_m_A_hover");
	$.get("./include/ajax/aff_real.php",{
		id:id,
		lg:lg
	},function(data) {
		$("#cadre_real").html(data);
	});
}
