// JavaScript Document
function login()
{
	document.formulaire_log.method = "post";
	document.formulaire_log.action = "http://www.ooloc.com/log.php";
	document.formulaire_log.submit();
}

function ouverture(date)

{
 alert("Vous devez rentrer la date manuellement sour la forme JJ/MM/AAAA");
}

function age()

{

window.open("http://www.ooloc.com/age.php", "age", "top=50, left=200, toolbar=no, status=no, scrollbars=no, resizable=no, width=452, height=492");

}

function telephone()

{

window.open("http://www.ooloc.com/telephone.php", "telephone", "top=50, left=200, toolbar=no, status=no, scrollbars=no, resizable=no, width=452, height=492");

}

function ouvre_info (dep,pays)
{
	window.open("http://www.ooloc.com/location-voiture-info-agence.php?ville="+dep+"&num_pays="+pays,"agence_dep","toolbar=no,status=no,scrollbars=no, resizable=no, width=452, height=492");
}

function find_retour()
{
	if ( (document.calform.ville_retour.value == "-1") && (document.calform.ville_dep.value != 8) ) document.calform.ville_retour.value = document.calform.ville_dep.value;
	
	if ( (document.calform.num_pays.value ==1) && (document.calform.ville_dep.value ==8) )
	{
		document.getElementById('ligne_dep').style.display='block';
		document.calform.autre_dep.focus();
	}
	else document.getElementById('ligne_dep').style.display='none';
	
	if ( (document.calform.num_pays.value ==1) && (document.calform.ville_retour.value ==8) )
	{
		document.getElementById('ligne_retour').style.display='block';
		document.calform.autre_retour.focus();
	}
	else document.getElementById('ligne_retour').style.display='none';

}

function affiche_autre()
{
	if ( (document.calform.num_pays.value ==1) && (document.calform.ville_dep.value ==8) )
	{
		document.getElementById('ligne_dep').style.display='block';
		document.calform.autre_dep.focus();
	}
	else document.getElementById('ligne_dep').style.display='none';
	
	if ( (document.calform.num_pays.value ==1) && (document.calform.ville_retour.value ==8) )
	{
		document.getElementById('ligne_retour').style.display='block';
		document.calform.autre_retour.focus();
	}
	else document.getElementById('ligne_retour').style.display='none';
	
}



function find_heure()
{
	if (document.calform.heure_retour.value == "-1") document.calform.heure_retour.value = document.calform.heure_dep.value;
}

function find_town()
{
	document.form_temp.num_pays.value = document.calform.num_pays.value;
	document.form_temp.method = "get";
	document.form_temp.action = "http://www.ooloc.com/location-voiture-etape1.php";
	document.form_temp.submit();
}

function etape2()
{

	if (document.calform.num_pays.value == "-1")
	{
		alert ('Vous devez choisir un pays');
		document.calform.num_pays.focus();
	}
	
	else if (document.calform.ville_dep.value == "-1")
	{
		alert ('Vous devez choisir une ville de départ');
		document.calform.ville_dep.focus();
	}

	else if (document.calform.ville_retour.value == "-1")
	{
		alert ('Vous devez choisir une ville de retour');
		document.calform.ville_retour.focus();
	}

	else if ( (document.calform.date_dep.value == "") || (document.calform.date_dep.value == "jj/mm/aaaa") )
	{
		alert ('Vous devez choisir une date de départ');
		document.calform.date_dep.focus();
	}

	else if ( (document.calform.date_retour.value == "") || (document.calform.date_retour.value == "jj/mm/aaaa") )
	{
		alert ('Vous devez choisir une date de retour');
		document.calform.date_retour.focus();
	}

	else if (document.calform.heure_dep.value == "-1")
	{
		alert ('Vous devez choisir une heure de départ');
		document.calform.heure_dep.focus();
	}
	
	else if (document.calform.heure_retour.value == "-1")
	{
		alert ('Vous devez choisir une heure de retour');
		document.calform.heure_retour.focus();
	}
	
	else if ( (document.calform.age.value == "") || (document.calform.age.value < "21"))
	{
		alert ('Nous vous rappelons que pour louer une voiture vous devez avoir au moins 21 ans révolu et 1 an de permis de conduire.');
		document.calform.age.focus();
	}

	else if (document.calform.age.value < '25')
	{
		if (confirm ('Nous vous rappelons que pour louer une voiture vous devez avoir au moins 21 ans révolu et 1 an de permis de conduire. En cliquant sur Ok vous certifiez avoir plus de 21 ans'))
		{
			document.calform.method = "get";
			document.calform.action = "http://www.ooloc.com/location-voiture-etape2.php";
			document.calform.submit();
		}
	}

	else
	{
		document.calform.method = "get";
		document.calform.action = "http://www.ooloc.com/location-voiture-etape2.php";
		document.calform.submit();
	}

}

function test_autre()
{
	if ( (document.calform.num_pays.value ==1) && (document.calform.ville_retour.value ==8) )
	{
		document.getElementById('ligne_retour').style.display='block';
		document.calform.autre_retour.focus();
	}
	else document.getElementById('ligne_retour').style.display='none';
}


function vide_dep ()
{
	if (document.calform.date_dep.value == 'jj/mm/aaaa') document.calform.date_dep.value = '';
}

function vide_retour ()
{
	if (document.calform.date_retour.value == 'jj/mm/aaaa') document.calform.date_retour.value = '';
}
