var URLAppli = '';


function initApp(section){
	setSectionToURL(section);
	initFlash();
	checkSections();
}

function setSectionToURL(section){
	var currentURL = document.location.href;
	
	if (currentURL.indexOf("#") == -1){
	
	if(section=="dispatch" || section=="landing"){
	
		document.location.href = "#/page=home&data.focus=skip";
	}
	else{
	document.location.href = "#/page="+section;
	}
	
	}
	if(currentURL.indexOf("#/page=landing") !=-1){
	
	document.location.href = "#/page=home&data.focus=skip";
	} 
	else {
	
	}
}

function initFlash(){
	var urlFlash = "";
	
	var flashvars =	{
		xmlLoader:"xml/preload_v2.xml"
	};
			
	var params = {
		bgcolor : "#000000",
		scale : "noScale",
		salign : "tm",
		menu : "false",
		wmode:"window",
		allowFullScreen : "true",
		allowScriptAccess:"always"
	}
	var attributes = {
		id:"flashContainer",
		allowScriptAccess:"always" 
	};
	
	swfobject.embedSWF("loader_v2.swf", "flashContainer", "960", "640", "9.0.115","expressInstall.swf", flashvars, params, attributes);	
}

function checkSections(){
	setInterval(function(){
		isSectionHome();
	},1000);
}
function isSectionHome(){
	if (URLAppli == document.location.href) return;
	URLAppli = document.location.href;
		currentUrl = document.location.href;
	sectionAppli = URLAppli.substring(URLAppli.indexOf("#"),URLAppli.length);
	if((sectionAppli.indexOf('home') != -1) || (sectionAppli.indexOf('landing') != -1)){ document.location.href = "#/page=home&data.focus=skip";/* document.getElementById('marie-claire').className = ''; */ }
	else { /* document.getElementById('marie-claire').className = 'hidden'; */ }
	
	if((sectionAppli.indexOf('home') != -1)){ /* document.getElementById('salon-locator').className = ''; */ }
	else { /* document.getElementById('salon-locator').className = 'hidden'; */ }

					if (currentUrl.indexOf("page=home&data.focus=skip") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea533;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=inovation_technologie") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea351;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=pourquoi_preferer_inoa") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea908;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=faire_connaitre_inoa") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea070;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=produits") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea134;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=discover") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea455;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';
					}
					if (currentUrl.indexOf("page=essayer") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea843;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=nuances") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea294;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';

					}
					if (currentUrl.indexOf("page=doctrine_professionnelle") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea875;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';
					}
					if (currentUrl.indexOf("page=temoignages") >= 0) {
						var axel = Math.random() + "";
						var a = axel * 10000000000000;
						document.getElementById('floodlighttag').innerHTML='<iframe src="http://fls.doubleclick.net/activityi;src=1520086;type=lorea325;cat=lorea907;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>';
					}
}
