
function BrowserDetection() 
{
	var version;

	if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
		//test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
		var version = new Number(RegExp.$1) // capture x.x portion and store as a number
		return "FF" + version.toString();
	}
	else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{ 
		//test for MSIE x.x;
		version=new Number(RegExp.$1) // capture x.x portion and store as a number
		return "IE" + version.toString();
	}
	else return "?";
}

function PopUpWindowsCentered(Url, Name, W, H, Options) 
{

	url = window.location.pathname.toLowerCase();
	var i = url.indexOf("home.aspx", 0);
	if (i == -1) return;

    var top = (screen.height - H) / 2;
    var left = (screen.width - W) / 2;
    window.open( Url, 
                 Name, 
                'width=' + W + ',' +
                'height=' + H + ',' +
                'top=' + top + ',' +
                'left=' + left
                ,
                 Options);
}

//*******************************************************************
// Popup Javascript
//*******************************************************************

var W;
var H;

function PopUpJavascript(ImagePath, PopUpLink, Width, Height) 
{
	W = Width;
	H = Height;
	document.write('<div id=popup_div style="z-index:500;position:absolute;width:' + Width + 'px; border:0px solid #9D9DA1; cursor:default; visibility:hidden;padding:3">');
//	document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0" ><tr><td align="right" bgcolor="#000000"><a href="#" onClick="ClosePopUpJavascript()"><font color="#FF0000" face="Verdana" size="3">X</font></a></td></tr>');
	document.write('<table width="100%" border="2" cellpadding="0" cellspacing="0" style="border-style:solid; border-collapse:collapse; border-color:#001472" ><tr height="30"><td style="color:#ff7a0f; border-style:none;" bgcolor="#001472">&nbsp;&nbsp<b>COMPTOIR DE LOCTUDY : Flash !</b></td><td align="right" bgcolor="#001472" style="border-style:none;"><a href="#" onClick="ClosePopUpJavascript()"><img border="1" style="border-color:#001472" src="./Assets/Icones/close.png" title="close"></a></td></tr>');
	document.write('<tr><td colspan="2" align="left"><a href="' + PopUpLink + '" target="_blank"><img src="' + ImagePath + '" border=0 align="top"></a></td></tr></table>');
	document.write('</div>');
	OpenPopUpJavascript();
}

function OpenPopUpJavascript() 
{
	if (BrowserDetection().indexOf("IE",0)!=-1)
	{
		wLeft = (document.body.offsetWidth - 0 - W) / 2;
		wTop = (document.body.offsetHeight - 0 - H -30 ) / 2;
	}
	else {

		wLeft = (window.innerWidth - W) / 2;
		wTop = (window.innerHeight - H - 30) / 2;

	}
	document.getElementById("popup_div").style.position = "absolute";
	document.getElementById("popup_div").style.left = wLeft + "px";
	document.getElementById("popup_div").style.top = wTop + "px";
    document.getElementById("popup_div").style.visibility = "visible";
    deactiv_pop = setTimeout("ClosePopUpJavascript()", 60000);
}

function ClosePopUpJavascript() 
{
	document.getElementById("popup_div").style.visibility = "hidden";
}


//*******************************************************************
// Redirect to URL
//*******************************************************************

var URL;

function TimeoutRedirect(url, timeout) {
	URL = url;
	setTimeout('Redirect()', timeout);
}

function Redirect() 
{
	window.location = URL;
}
