
function initApp(section){
	var heightSWF = getHeightFlash(516);
	displayFlashApp(heightSWF);
	setSectionToURL(section);
}
function setSectionToURL(section){
	var currentURL = document.location.href;
	if (currentURL.indexOf(".") == -1){
		document.location.href = "#/page="+section;
	}
}
function navh() {
	document.write("<div id='bandeau-des-marques' class='indexBandeauMarque  bMargin'>"); 
		Danone.init(
			'bandeau-des-marques',
			'default',
			960,
			'Taillefine est une marque du Groupe Danone',
			'975ca6',
			'FFFFFF',
			'975ca6',
			'975ca6',
			true,
			'36'
		);
	   Danone.show();
   document.write("</div>");
}

function displayFlashApp(height){
	var flashvars =	{
		configXML:'/xml/config.xml',
		mainSWF:'/main.swf'
	};
	var params = {
		bgcolor : "#f5f5f5",
		scale : "noScale",
		salign : "tl",
		menu : "false",
		wmode:"opaque",
		allowfullscreen : "true",
		allowScriptAccess:"always"
	}
	var attributes = {
		id:"flashContainer",
		allowScriptAccess:"always"
	};
	swfobject.embedSWF("/loader.swf", "flashContainer", "100%", "500", "9.0.0","expressInstall.swf", flashvars, params, attributes);
}
function getHeightFlash(minHeight){
	//document.documentElement.style.overflow = 'auto';
	
	//var _self = this;
	//this.isIE = (document.all && window.print && /MSIE [567]/.test(navigator.userAgent)) || (document.compatMode && document.compatMode=="BackCompat");
	/*if (_self.isIE) {
		setInterval(function(){
			document.body.style.height = document.documentElement.clientHeight>minHeight ? '' : minHeight + 'px';
			//document.body.style.width = document.documentElement.clientWidth>minWidth ? '' : minWidth + 'px';
			var height = document.getElementById('flashContainer').setHeight = document.body.style.height - document.getElementById('bandeau-des-marques').clientHeight;
			
		},300);
	}
	else
	{*/
		var lastHeight = 0;
		setInterval(function(){
			//if(lastHeight!=document.documentElement.clientHeight) {
                                        var headerHeight = /MSIE 8/.test(navigator.userAgent) ? document.getElementById('bandeau-des-marques').clientHeight+4 : document.getElementById('bandeau-des-marques').scrollHeight;
			
				//on ajoute -1 dans le calcul pour palier a l offset de 1 rajouter par le header Danone&Vous
				var flashHeight = document.documentElement.clientHeight - headerHeight-1;
				
				if(flashHeight > minHeight) {
					var height = flashHeight;
				} else {
					var height = minHeight;
				}
				document.getElementById('flashContainer').style.height = height+'px';
				//lastHeight = document.documentElement.clientHeight;
				
				document.getElementById('page').style.width = document.documentElement.clientWidth<800 ? '800px' : 'auto';
			//}
		},200);
	//}
}	
