// JavaScript Document
function show_pub()
{
	/*if (ScanCookie("pub_pack_15") == 0)
	{
	CreationCookie("pub_pack_15",true);*/
		time = 20000;
		document.getElementById("pub_pack15").style.visibility="visible";
		document.getElementById("pub_pack15").style.position = "absolute";
		document.getElementById("pub_pack15").style.left = 200+'px';
		document.getElementById("pub_pack15").style.top = 150+'px';
	//	document.getElementById("pub").innerHTML = codepub;
		tempo_pub=setTimeout("hide_pub()",time);
	//}

}

function show_pub2()
{
	time = 10000;
	document.getElementById("continous").value="1";
	
	

}

function hide_pub()
{
	if (document.getElementById("continous").value=="0")
	document.getElementById("pub_pack15").style.visibility="hidden";
}

function hide_pub2()
{
	document.getElementById("pub_pack15").style.visibility="hidden";
}


function ScanCookie(variable)
	{
	cook = document.cookie;
	variable += "=";
	place = cook.indexOf(variable,0);
	if (place <= -1)
		return("0");
	else
		{
		end = cook.indexOf(";",place)
		if (end <= -1)
			return(unescape(cook.substring(place+variable.length,cook.length)));
		else
			return(unescape(cook.substring(place+variable.length,end)));
		}
	}

function CreationCookie(nom,valeur,permanent)
	{
	if(permanent)
		{
		dateExp = new Date(2020,11,11);
		dateExp = dateExp.toGMTString();
		ifpermanent = '; expires=' + dateExp + ';';
		}
	else
		ifpermanent = '';
	document.cookie = nom + '=' + escape(valeur) + ifpermanent;
	}


function login()
{
	document.formulaire_log.method = "post";
	document.formulaire_log.action = "log.php";
	document.formulaire_log.submit();
}

function ouverture(date)

{
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
window.open("/calendar.php?id="+date, "calendrier", "top=300, left=512, toolbar=no, status=no, scrollbars=no, resizable=no, width=156, height=205");
else alert("Les navigateurs à base du moteur NETSCAPE comme FireFox, etc ...  ne prennent pas en charge certaines fonctionalitées\n vous devez rentrer la date manuellement sour la forme JJ/MM/AAAA");
}

function age()

{

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

}

function telephone()

{

window.open("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("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 = "location-voiture-etape1.php";
	document.form_temp.submit();
}

function etape2(sup_age)
{
	
		
	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.date_permis.value == "") || (document.calform.date_permis.value == "jj/mm/aaaa") )
	{
		alert ('Vous devez saisir la date d\'obtention de votre permis de conduire');
		document.calform.date_permis.focus();
	}


	else
	{
		document.calform.method = "post";
		document.calform.action = "resa_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 = '';
}
