var page = "accueil";
var lang = "fr";
var indice = "fr-FR";
var footerHeight = 255;
$(document).ready(function(){
	var tmp = $('#portail').attr("rel").split("_");
	page = tmp[0];
	lang = tmp[1];
	indice = tmp[2];
	chargement();
});

$(window).resize(function(){
	resize();
});

function chargement(){
	resize();
	swfobject.embedSWF('load.swf', 'flash', '100%', '100%', '8', false, 
					   {lang: lang, indice: indice, page: page}, 
					   {bgcolor: '#977A4F', menu: 'false', allowfullscreen: 'true', allowScriptAccess: 'always'}, 
					   {id: 'flash_swf'});
}

function resize(){
	var height = parseInt($(window).height()-43 + 180);
	
	switch(page){
		default:
		case "accueil":
			if(height < 600){ height = 600; } // Hauteur Min
			if(height > 1075){ height = 1075; } // Hauteur Max
		break;
		
		case "news":
			if(height != 970){ height = 970; } // Hauteur
		break;
	}
	
	$('#portail').height(height + footerHeight);
}

function setResize(hauteur){
	if(hauteur != 342){
		var calcul = parseInt(hauteur * 235 / 342) + 20;
		if(calcul != footerHeight){
			footerHeight = calcul;
			resize();
		}
	}
}

function popUp(page,largeur,hauteur) {
	var top=($(window).height()-hauteur)/2;
	var left=($(window).width()-largeur)/2;
	window.open(page, "", "top="+top+", left="+left+", width="+largeur+", height="+hauteur+", resizable=no, location=no,  menubar=no, status=no, scrollbars=no, menubar=no", "");
}