﻿
/* GESTION URL NAVIGATEUR */

var pageTracker = null;

function checkBrowser(){	
	var browserCompatible = false;	
	var osType = "notWin";	
	// cheks the os
	if(navigator.platform.indexOf("Win")!= -1 ){
		osType ="Win";
	}	
	// Checks the browser
	if(navigator.userAgent.indexOf("Safari")!=-1){
		browserCompatible = false;
		//alert("No. Safari");
	}else if(osType=="notWin" && navigator.userAgent.indexOf("MSIE")!=-1){
		browserCompatible = false;
		//alert("No. IE on Mac");
	}else{
		//alert("Yes, I like this browser.");
		browserCompatible = false;
	}	
	return browserCompatible;
}
var isComp = checkBrowser();

function getURLData() 
{
	var data_str = unescape(window.top.location.href).split("#")[1] || "";
	if (!data_str.length)
	{
		data_str = unescape(window.top.location.href).split("?content=")[1] || "";
		if (!data_str.length) data_str = "Home"
	}
   	return data_str;
}
function setURLData(path){	
	//alert('setUrl '+path);
	var url_array = unescape(window.top.location.href).split("#");
	var baseURL_str = url_array[0];
	var newURL_str = baseURL_str + "#" + path;
	//if(isComp) { window.top.location.replace(newURL_str); }
	//else{ window.location.replace(newURL_str); }

    // audience
    pageTracker._trackPageview('/' + path + '.html');
}


/* GESTION OBJET FLASH */

function writeFlash(deepLink, heroDelay) 
{
	// cacher le contenu alternatif
	document.getElementById("altContent").style.display = "none";

    if (!heroDelay) heroDelay = 20;
    var flashvars = 'urlstr='+deepLink+'&heroDelay='+heroDelay;

	//alert('writing\n'+id+'\n'+swf+'\n'+w+'\n'+h);
	var  oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		+ 'width="100%" height="100%"'
		+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
		+ '<param name="movie" value="proximity.swf" /><param name="loop" value="false" />'
		+ '<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'
		+ '<param name="allowScriptAccess" value="always" /><param name="FlashVars" value="'+flashvars+'" />'
		+ '<embed src="proximity.swf" loop="false" quality="high" bgcolor="#ffffff" '
		+ 'width="100%" height="100%" name="flashfile" align="middle" '
		+ 'play="true" '
		+ 'FlashVars="'+flashvars+'" '
		+ 'loop="false" '
		+ 'quality="high" '
		+ 'allowScriptAccess="always" '
		+ 'type="application/x-shockwave-flash" '
		+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
		+ '<\/embed>'
		+ '<\/object>';
	document.write(oeTags);
}


function resetSize() {
	
	if(navigator.userAgent.indexOf("MSIE")!=-1){
		if(document.body.clientWidth>895){
			document.getElementById('proximity').style.width = document.body.clientWidth;
		}else{
			document.getElementById('proximity').style.width = 895;
		}
		
		if(document.body.clientHeight>550){
			document.getElementById('proximity').style.height = document.body.clientHeight;
		}else{
			document.getElementById('proximity').style.height = 550;
		}
		
	}else{
		document.getElementById('proximity').style.width = '100%';
		document.getElementById('proximity').style.height = '100%';
	}
}

function showSite(layerId,assetUrl){
	//document.getElementById('proximity').style.visibility = "visible";
	document.getElementById(layerId).style.visibility = "visible";
	document.getElementById(layerId).style.display = "block";
	
}
function hideSite(layerId){
	//alert('hide site');
	//document.getElementById('proximity').style.visibility = "hidden";
	document.getElementById(layerId).style.visibility = "hidden";
	document.getElementById(layerId).style.display = "none";
}

function hideHTML(){
		frames['displayframe'].location.href = "about:blank";
		hideSite('htmlFrame');
		//showSite('proximity');
		//document.getElementById(layerId).style.visibility = "hidden";
}

function showHTML(assetUrl){
		showSite('htmlFrame');
		//hideSite('proximity')
		frames['displayframe'].location.href = assetUrl;//"http://www.google.co.uk";

}
