//Faire un lien direct sous flash vers une page afin qu'elle soit chargée dans l'iframe
//Exemple :  javascript:iframeLocation('/products/fragrance/Aquasenses_Skincare_fragrance.aspx');

function iframeLocation(url){
	document.getElementsByTagName('iframe')[0].src = url;
	void(0);
}



// plusieurs chargements en onload
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

// reconstruction du site (provenance moteur de recherche)

addLoadEvent(function() {
	if(window.name == "popUpResult"){
		return;
	}
	
	var iframe = window.top.document.getElementById('subPage');
	var loc = window.top.location.href;
	var indexFile = 'index2.htm'; // index2 on International, else index
	
	if(loc == 'http://' + window.top.location.hostname +'/') {return};
	
	if(!iframe) {
		if(loc == 'http://' + location.host + '/home.html') {
			location.href = 'http://' + location.host + '/' + indexFile;
		} else {
			loc = 'http://' + location.host + '/' + indexFile + '?changeURL=' + loc;
			location.href = loc;
		}
	} else if (window.top.changeURLDone === undefined) {
		var url = loc.split('?changeURL=')[1];
		if(typeof url != 'undefined') {
			iframe.src = url;
			window.top.changeURLDone = true;
		}
	}

});
