

$(document).ready(function(){
	$('#overlay').hide();
	$('.non').click(function (e){
		e.preventDefault();
		$('#overlay').fadeIn();
		$('#popin').fadeIn();
	})
	$('.fermer').click(function (e){
		e.preventDefault();
		$('#overlay').fadeOut();
		$('#popin').fadeOut();
	})
	$(window).bind('resize',onResize);
	onResize();
	
	/* G E S T I O N   I N T E R N A T I O N A L E */
	var currentYear = $("#birthyearmax").text();
	var selectLang = $("#index-contenu select.second");
	$("#index-contenu select.first").change(function(){
		indexPays = $("option:selected", this).val();
		$("#birthyearmax").text( currentYear - i18nConf.countriesAge[indexPays] ) ;
		var langDispo = i18nConf.assoc [ $("option:selected", this).text() ] ;
		if( undefined == langDispo ) langDispo = [i18nConf.defaultLang] ;
		$("option", selectLang).remove() ;
		$.each(langDispo, function (i, val) { 
			selectLang.append( $('<option/>').val(val).text( i18nConf.cultures[ val ] ) ) ; 
		} );
	}).change();
	$("#yes-btn").click(function(){
		$(this).attr("href" , "/?lang=" + $("option:selected", selectLang).val() );
	});
	$("select.first option:contains('"+ i18nConf.defaultCountry +"')").attr("selected", "selected").parent().change();
	/* E N D   G E S T I O N   I N T E R N A T I O N A L E */
})
function onResize(){
	$('#overlay').width($(window).width()).height($(window).height())
	$('#popin').css('left',$(window).width()*.5 - 320*.5+'px')
	$('#popin').css('top',$(window).height()*.5 - 200*.5+'px')
}

