function getVar (nomVariable)
 {
 var infos = location.href.substring(location.href.indexOf("?")+1, location.href.length)+"&"
 if (infos.indexOf("#")!=-1)
 infos = infos.substring(0,infos.indexOf("#"))+"&"
 var variable=0
 {
 nomVariable = nomVariable + "="
 var taille = nomVariable.length
 if (infos.indexOf(nomVariable)!=-1)
 variable = infos.substring(infos.indexOf(nomVariable)+taille,infos.length).substring(0,infos.substring(infos.indexOf(nomVariable)+taille,infos.length).indexOf("&"))
 }
 return variable
}

 
function OnloadEffects() {

if ((BrowserDetect.browser != "Firefox") && (BrowserDetect.browser != "Explorer"))
{

document.getElementById("user_info").innerHTML = "Le site LESPORTSANTE a été optimisé pour FIREFOX 3.0 et Internet Explorer 7.0/8.0. Nous vous conseillons d'utiliser et de mettre à jour ces navigateurs pour utiliser le site dans les meilleurs conditions.";
document.getElementById("user_info").style.display = "block";
}
if ((BrowserDetect.version != "3.0") && (BrowserDetect.browser == "Firefox"))
{
document.getElementById("user_info").innerHTML = "Le site LESPORTSANTE a été optimisé pour <a href='http://www.mozilla-europe.org/fr/'>FIREFOX 3.0</a> et <a href='http://www.microsoft.com/france/windows/products/winfamily/ie/ie8/default.aspx'>Internet Explorer 7.0/8.0</a>. Nous vous conseillons d'utiliser et de mettre à jour ces navigateurs pour utiliser le site dans les meilleurs conditions.";
document.getElementById("user_info").style.display = "block";
} else {
if ((BrowserDetect.version != "7.0") && (BrowserDetect.browser == "Explorer"))
{
document.getElementById("user_info").innerHTML = "Le site LESPORTSANTE a été optimisé pour <a href='http://www.mozilla-europe.org/fr/'>FIREFOX 3.0</a> et <a href='http://www.microsoft.com/france/windows/products/winfamily/ie/ie8/default.aspx'>Internet Explorer 7.0/8.0</a>. Nous vous conseillons d'utiliser et de mettre à jour ces navigateurs pour utiliser le site dans les meilleurs conditions.";

document.getElementById("user_info").innerHTML +=" <br>"+ "Si vous êtes sur IE 8.0 et que vous rencontrez des bugs d'affichage : <a href='http://support.microsoft.com/kb/969360/fr/' target='_new'>activer l'Affichage de compatibilité.</a>";
document.getElementById("user_info").style.display = "block";
}

}
if ((BrowserDetect.version == "3.5") && (BrowserDetect.browser == "Firefox"))
{
document.getElementById("user_info").style.display = "none";
}
if ((BrowserDetect.version == "7.0") && (BrowserDetect.browser == "Explorer"))
{
document.getElementById("user_info").style.display = "none";
}


if (getVar('p') == 'tests') {

      $('header').style.top = '170';
	  $('header').style.left = '-700';
      $('logo').style.display = 'block';
      $('header').style.display = 'block';
	  //$('appear_menu').style.display = 'block';
	  
      new Effect.Move('logo',{ x: 730, y: -170 });
	  
		Effect.Appear('appear_logo', { duration: 3.0 });
		Effect.Appear('appear_menu', { duration: 3.0 });
		
	$('content').style.display = 'none';
	

	//('content2').innerHTML ='TESTS';
	
	if (getVar('test') == 'imc') {
	
		Effect.Appear('content2', { duration: 3.5 });
	$('content2').innerHTML ="<div style='border-bottom:1px solid #15709d;'><a href='index.html' title='Accueil'><u>Accueil</u></a>&nbsp;&nbsp;&nbsp;<a href='index.html?p=tests&test=pi' title='Poids Idéal'><u>Calculer votre poids idéal</u></a>&nbsp;&nbsp;&nbsp;<a href='index.html?p=tests&test=riccigagnon' title='Questionnaire d\'activité physique'><u>Evaluer son activité physique</u></a><BR><BR></div>";
	$('content2').innerHTML +="<IFRAME src='www/imc.html' width=999px height=500px scrolling='no' frameborder=0 > </IFRAME>";
	
	}
	if (getVar('test') == 'pi') {
	
		Effect.Appear('content2', { duration: 3.5 });
	$('content2').innerHTML ="<div style='border-bottom:1px solid #15709d;'><a href='index.html' title='Accueil'><u>Accueil</u></a>&nbsp;&nbsp;&nbsp;<a href='index.html?p=tests&test=pi' title='Indice de masse corporelle'><u>Calculer mon IMC</u></a>&nbsp;&nbsp;&nbsp;<a href='index.html?p=tests&test=riccigagnon' title='Questionnaire d\'activité physique'><u>Evaluer son activité physique</u></a><BR><BR></div>";	
		
	$('content2').innerHTML +="<IFRAME src='www/pi.html' width=999px height=500px scrolling='no' frameborder=0 > </IFRAME>";
	
	
	}
	if (getVar('test') == 'riccigagnon') {
	document.location.href="./www/qcm.php?qcm=1"; 
		
	
	}

} else {

      $('header').style.top = '170';
	  $('header').style.left = '-700';
      $('logo').style.display = 'block';
      $('header').style.display = 'block';
	  //$('appear_menu').style.display = 'block';
	  
      new Effect.Move('logo',{ x: 730, y: -170 });
	  
		Effect.Appear('appear_logo', { duration: 3.0 });
	//	Effect.Appear('appear_menu', { duration: 3.0 });
		
	  bubble('action1', 0, 230, { delay:0.2, duration:1.1 });
	  bubble('action2', 185,200, { delay:0.5, duration:1.1 });
	  bubble('action3', 385,180, { delay:0.8, duration:1.1 });
	  bubble('action4', 585,200, { delay:1.2, duration:1.1 });
	  bubble('action5', 755,230, { delay:1.5, duration:1.1 });
	  



	  
///////////////////////// // MOUSE OVER ////////////////////////////// 	  
	  Event.observe('action1', 'mouseover', function() {
	 $('action1_texte').style.display = 'block';
	 
	 //$('action1-bubble').style.zIndex = "300;";
	 $('action1-bubble').setStyle({zIndex:'300'});
	  });
		
	  Event.observe('action2', 'mouseover', function() {

	 $('action2_texte').style.display = 'block';
	 $('action2-bubble').setStyle({zIndex:'300'});
	  });

	  Event.observe('action3', 'mouseover', function() {

	 $('action3_texte').style.display = 'block';
	 $('action3-bubble').setStyle({zIndex:'300'});
	  });

	  Event.observe('action4', 'mouseover', function() {

	 $('action4_texte').style.display = 'block';
	 $('action4-bubble').setStyle({zIndex:'300'});
	  });		
	  
	 Event.observe('action5', 'mouseover', function() {
	
	 $('action5_texte').style.display = 'block';
	 $('action5-bubble').setStyle({zIndex:'300'});
	  }); 
///////////////////////////////////////////////////////////////////////	  
	  
///////////////////////// // MOUSE OUT ////////////////////////////// 
	  Event.observe('action1', 'mouseout', function() {
	  $('action1_texte').style.display = 'none';
	  $('action1-bubble').setStyle({zIndex:'1'});	  
	  });
	  Event.observe('action2', 'mouseout', function() {
	  $('action2_texte').style.display = 'none';
	  $('action2-bubble').setStyle({zIndex:'1'});
	  });
	  Event.observe('action3', 'mouseout', function() {
	  $('action3_texte').style.display = 'none';
	  $('action3-bubble').setStyle({zIndex:'1'});	  
	  });
	  Event.observe('action4', 'mouseout', function() {
	  $('action4_texte').style.display = 'none';
	  $('action4-bubble').setStyle({zIndex:'1'});	  
	  });
	  
	  Event.observe('action5', 'mouseout', function() {
	  $('action5_texte').style.display = 'none';
	  $('action5-bubble').setStyle({zIndex:'1'});	  
	  });








}

	  
}

function effet_click(id) {
//$(id).style.display="block";
//$(id).setStyle({background:"url(blank.gif)"});
//new Effect.Scale(id, 130, {scaleFrom:100,
 //   scaleFromCenter:true});

//alert(id);
//if (id == "action1") {
//Modalbox.show('www/jtmv.html', {title: 'JE TESTE MA VITALITE', width: 800, overlayClose: false});
//}
//if (id == "action2") {
//Modalbox.show('www/vt.html', {title: 'VITALISE TOI !', width: 800, overlayClose: false});
//}
//if (id == "action3") {
//Modalbox.show('www/avmpb.php', {title: 'A VOS MARQUES, PRET ? BOUGEZ !', width: 800, overlayClose: false});
//}
//if (id == "action4") {
//Modalbox.show('www/levls.html', {title: 'LES ESCALIERS VERS LA SANTE', width: 800, overlayClose: false});
//}
//if (id == "action5") {
//Modalbox.show('www/bgmc.html', {title: 'BIEN GERER SA COMPETITION', width: 800, overlayClose: false});
//}

//$(id).style.display="none";
}

	function scaleOff(id){
	new Effect.Scale(id, 77, {scaleFrom:100,scaleFromCenter:true,duration:0.5});	
	}

      function bubble(id,x,y){
        $(id+'-bubble').setStyle({left:x+'px',top:y+'px'});
        new Effect.Scale(id+'-bubble',100, Object.extend({
          beforeStart:function(effect){
            $(effect.element).style.display = 'block';
            $(effect.element).setOpacity(0);
          //  $$('#'+id+'-bubble').each(function(){$('#'+id+'-bubble').hide()});
          },
          afterUpdate:function(effect){
            $(effect.element).setOpacity(effect.position);
          },
          scaleFrom:0,
          scaleFromCenter:true,
          afterFinish:function(effect){
            $$('#'+id+'-bubble').each(function(){
            
            });
          }
        }, arguments[3] || {}));      
      }
	  
///// MENU //////

function Mdown() {
	// $('appear_menu').style.display = 'block';
	// $('titre_menu').style.display = 'block';
	$('appear_menu').setStyle({zIndex:'300'});
	 new Effect.SlideDown('menu_content', { duration: 0.9 });

	  }

function Mup() {
	$('appear_menu').setStyle({zIndex:'1'});
	 new Effect.SlideUp('menu_content', { duration: 0.9 });
	
	}

////////////////      

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

