function isNumericString(chaine)
{
	if (chaine.search(/[^0-9]/) != -1)
	{
		return true;
	}
	if (!(chaine.search(/[^0-9]/) != -1))
	{
		return false;
	}
}

function detectFlash(requiredVersion, actualVersion)
{
	if (actualVersion >= requiredVersion)
	{
		hasRightVersion = true;
	}
}

function setCookieSession(nom, valeur)
{
		// On crée un cookie de session, donc pas de Date
		document.cookie = nom + "=" + escape(valeur) + ";path=/";
}

function getCookieSession(nom)
{
	var recherche = nom + "=";
	if (document.cookie.length > 0)
	{
		var offset=document.cookie.indexOf(recherche);
		// si le cookie existe
		if (offset != -1)
		{		
			// position début
			offset += recherche.length;
			// position fin
			var fin = document.cookie.indexOf(";", offset);
			if (fin == -1)
			{
				fin = document.cookie.length;
			}
		cookiePresent = true;	
		}
	}
}

function detectCookieSession(nom)
{
	getCookieSession(nom);
	if (cookiePresent)
	{
		cookieIsPresent = true;
	}
	else
	{
		setCookieSession(nom,1);
	}
}

function tools_getUrlWithAppImmo(url){
	return tools_getUrlWithApp(url, "apporteur");
}

function tools_getUrlWithAppConso(url){
	return tools_getUrlWithApp(url, "j7");
}

function tools_getUrlWithApp(url, param){
	var cookVal = utils_getCookie("ctx_apporteur");
	
	if(cookVal){
		var query = param + "=" + cookVal;
		query = (url.indexOf("?") == -1) ? "?" + query : "&" + query;
		
		url += query;
	}
	
	return url;
}

function lancerAvecApporteur(url, nvlle){
	url = tools_getUrlWithApp(url);
	
	if(nvlle){
		var fen = window.open(url, 'fen', ''); 
		fen.focus();
	}
	else{
		location.href = url;
	}
}