var ALERT_HEADER = "Votre formulaire d'information Scooter est incorrect.\n\n";
var MSG = "";

function CheckForm() {
	//-------------------
	MSG = "";	
	ApplyStyleInitialisation(); // init Style
	var form = window.document.GENERIC_FORM; 
	
	//var res = CheckRequierdElement(form);
	if (document.getElementById('listMarque').value == "") 
		{
			SetStyleErr(document.getElementById('listMarque')); 
			res = true;
			if (MSG != "") {
				MSG += "\n";
			}
			MSG += "- La marque est incorrecte.";
	}
	var elmVal = document.getElementById('listModel').options[document.getElementById('listModel').selectedIndex].text;
	if (elmVal.indexOf('---') != -1 || elmVal == "")
		{
			SetStyleErr(document.getElementById('listModel')); 
			res = true;
			if (MSG != "") {
				MSG += "\n";
			}
			MSG += "- Le modèle est incorrect.";
	}
	var elvVal = document.getElementById('listVersion').options[document.getElementById('listVersion').selectedIndex].text;
	if (elvVal.indexOf('---') != -1 || elvVal == "")
		{
			SetStyleErr(document.getElementById('listVersion')); 
			res = true;
			if (MSG != "") {
				MSG += "\n";
			}
			MSG += "- La version est incorrecte.";
	}
	if (document.getElementById('VEHIC_GARAGE_POSTALCODE').value == "") 
		{
			SetStyleErr(document.getElementById('VEHIC_GARAGE_POSTALCODE')); 
			res = true;
			if (MSG != "") {
				MSG += "\n";
			}
			MSG += "- Le code postal est incorrect.";
	}
	var dateNaissance = document.getElementById('VEHIC_DATE_FIRST_USED').value;
	if (!IsDateValide(dateNaissance))
		{
			SetStyleErr(document.getElementById('VEHIC_DATE_FIRST_USED')); 
			res = true;
			if (MSG != "") {
				MSG += "\n";
			}
			MSG += "- La date de première circulation est incorrecte.";
	}
	//---------------------------	
	//if (MSG != "" || (res)) {
	if (MSG != "") {
		alert(ALERT_HEADER + MSG);
		return false;
	} else {
		return true;
	}
}

function submitForm() {
	if (CheckForm())
		window.document.GENERIC_FORM.submit();//envoyer 
}

function chargeVehicules()
{
	var pXML;
	AJAX_RadioButtonVersionVehicule(pXML,Make,Model,Carburant,BoiteVitesse,Carosserie,PuissFiscale,Version,TagnameVersion,URLVersion1,URLVersion2,URLCarburant2,URLBoite2,URLCarrosserie2,URLPuissFisc2)
	//var url = '../infos/charge_vehiculier.htm?xml='+xmlStream;
	var url = '../infos/charge_vehiculier.htm';
	//window.open(url,'Choisir','width=500, height=700, toolbar=no,directories=no,status=no, scrollbars=Auto,resizable=no ,modal=yes');
	var ligne = xmlStream.split('|');

	var hauteur = 600;
	var largeur = 475;
	var scrol = "no"
	if (ligne.length > 22)
		scrol = "yes"
	else
		hauteur = ((600/23) * ligne.length) + 130;
	var Dessus=(screen.height/2)-(hauteur/2);
	var Gauche=(screen.width/2)-(largeur/2);
	var features= 'height='+hauteur+',width='+largeur+',top='+Dessus +',left='+Gauche+", directories=no, status=no, scrollbars="+scrol;
	
	var dummy = window.open(url,'Choisir',features);
	document.getElementById('fluxXML').value = xmlStream;
}
