function index()
{
	
	test_hit();
	
	var homeSubmit = document.getElementById('home-submit');
	var btnDistrib = document.getElementById('btn-distrib');
	var input1 = document.getElementById('input1');
	var input2 = document.getElementById('input2');
	
	if(document.getElementById('footer-home-titre'))
	{
		var footerHomeTitre = document.getElementById('footer-home-titre');
	
		footerHomeTitre.onclick = function()
		{
			return false;
		}
		
		footerHomeTitre.onmousedown = function()
		{
			popup('contact.php','400','400');
		}
	}
	
	btnDistrib.onmousedown = function() {
		document.getElementById('input1').focus();
	}
	
	homeSubmit.onmousedown = function() {
		var login = input1.value;
		var code = input2.value;
		loadXMLDoc("callbackId","login_check.php?login="+login+"&code="+code,0,"GET");
	}

	rollover(homeSubmit,"../img/btn-submit-on.gif","../img/btn-submit.gif");

	input1.onfocus = function(){
		if(input1.value == "login") 
			input1.value = "";
	}

	input2.onfocus = function(){
		if(input2.value == "password") 
			input2.value = "";
	}
	
}

function goToPatient()
{
	GB_showCenter("Terms of access", "../front/terms_patient.php");
}

function patient()
{
	test_hit();
	
	navHaut();
	
	patientTitre1 = document.getElementById('patient-titre1');
	
	patientTitre1.onclick = function()
	{
		document.location.href='patient.php';
	}
	
	loadXMLDoc("navId","nav.php");
	
}

function proHealth()
{
	test_hit();
	
	navHaut();
	
	prohealthTitre1 = document.getElementById('prohealth-titre1');
	
	prohealthTitre1.onclick = function()
	{
		document.location.href='professional-healthcare.php';
	}
	
		loadXMLDoc("navId","nav.php");
}

function distributor()
{
	test_hit();
	
	navHaut();
	
	distribTitre1 = document.getElementById('distrib-titre1');
	
	distribTitre1.onclick = function()
	{
		document.location.href='distributor.php';
	}
	
	loadXMLDoc("navId","nav.php");
	
}

function navHaut()
{
	var navHautTexte1 = document.getElementById('navHaut-texte1');
	var navHautTexte2 = document.getElementById('navHaut-texte2');
	
	navHautTexte1.onclick = function()
	{
		popup('contact.php','400','400');
	}
	
	navHautTexte2.onclick = function()
	{
		popup('glossary.php','700','600');
	}
	
	rolloverTxt(navHautTexte1,"#B80C54","#5EABD5");
	rolloverTxt(navHautTexte2,"#B80C54","#5EABD5");

}

function contact()
{
	var selectid = document.getElementById('selectId');
	var pays = document.getElementById('pays');
	var raison = document.getElementById('raison');
	var adr = document.getElementById('adr');
	var ville = document.getElementById('ville');
	var tel = document.getElementById('tel');
	var fax = document.getElementById('fax');
	var email = document.getElementById('email');
	var web = document.getElementById('web');
	
	selectid.onchange = function()
	{
		i = selectid.selectedIndex ;
		if(i != '0')
		{
		
			pays.innerHTML = tabPays[i];
			raison.innerHTML = tabEnt[i]['raison'];
			adr.innerHTML = tabEnt[i]['adr']+"&nbsp;-&nbsp;"+tabEnt[i]['ville'];
			tel.innerHTML = tabEnt[i]['tel']+"&nbsp;-&nbsp;"+tabEnt[i]['fax'];
			email.innerHTML = tabEnt[i]['email'];
			web.href = "http://"+tabEnt[i]['web'];
			web.innerHTML = tabEnt[i]['web'];
			
		}
	}
	
}

function rolloverTxt(el,color_on,color_off)
{
	el.onmouseover = function()
	{
		el.style.color = color_on;
	}
	
	el.onmouseout = function()
	{
		el.style.color = color_off;
	}
}

function rollover(el,img_on,img_off)
{
	el.onmouseover = function()
	{
		el.src = img_on;
	}	
	
	el.onmouseout = function()
	{
		el.src = img_off;
	}

}

function popup(nom,tx,ty)
{
	window.open(nom,'popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width='+tx+',height='+ty);
}

function setVideo(content,video,play)
{
	
	rand = Math.random()*100000000000000000;
	
	so = new SWFObject('../data/video.swf?rand='+rand, 'suplasyn', '420', '360', '9', '#fffff',true);
	so.addVariable("param_video", video);
	so.addVariable("param_play", play);
	so.write(content);
}

function stat(fichier,id)
{
	if(!id) id = 0;

	loadXMLDoc("statZoneId","../front/stats.php?f="+fichier+'&i='+id,0,'POST');

}

function test_hit()
{
	if (google.loader.ClientLocation)
	{
		var country = google.loader.ClientLocation.address.country;
		//document.write("Your Location Is: " + google.loader.ClientLocation.address.city + ", " + google.loader.ClientLocation.address.region + ", " + google.loader.ClientLocation.address.country);
	} 
	else 
		country = "";

	loadXMLDoc('hit_resultId','../include/test_hit.php?pays='+country,0,'POST');

}