//TYPE DE DATE DE DEPART

function ShwDateSouhaitee(){
	document.getElementById("ShwDateSouhaitee").style.display = 'block';
	document.getElementById("ShwFlexible").style.display = 'block';
	document.getElementById("ShwPeriode").style.display = 'none';
	document.getElementById("selperiode").value = "";
}

function ShwPeriode(){
	document.getElementById("ShwDateSouhaitee").style.display = 'none';
	document.getElementById("ShwFlexible").style.display = 'none';
	document.getElementById("ShwPeriode").style.display = 'block';
	document.getElementById("txtdepart").value = "";
	document.getElementById("rdoflexibleyes").checked = false;
	document.getElementById("rdoflexibleno").checked = false;
}

//REMOVE THE RED BOX AROUND LIST BOX ADULTE
function removecssadulte(){
		if(document.getElementById("seladulte").value == 0){
			document.getElementById("redboxadulte").className = 'highlightActiveFieldSelect';
		}
		else {
			document.getElementById("redboxadulte").className = 'RemovehighlightActiveFieldSelect';	
		}
}

//REMOVE THE RED BOX AROUND LIST BOX CHAMBRE
function removecsschambre(){
		if(document.getElementById("selchambre").value == 0){
			document.getElementById("RedBoxChambre").className = 'highlightActiveFieldSelect';
		}
		else {
			document.getElementById("RedBoxChambre").className = 'RemovehighlightActiveFieldSelect';	
		}
}

//REMOVE THE RED BOX AROUND MODE DEPART RADIO BUTTON
function removecssmodedepart(){
		document.getElementById("redboxmodedepart1").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("redboxmodedepart2").className = 'RemovehighlightActiveFieldRadio';
}

//REMOVE THE RED BOX AROUND DATE DE DEPART SOUHAITEE
function removecsstxtdepart(){
		document.getElementById("txtdepart").className = 'Bordure-Bleu';
}

//REMOVE THE RED BOX AROUND DATE FLEXIBLE RADIO BUTTON
function removecssflexible(){
		document.getElementById("shwflexible1").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("shwflexible2").className = 'RemovehighlightActiveFieldRadio';
}

//REMOVE THE RED BOX AROUND LIST BOX PERIODE
function removecssperiode(){
		if(document.getElementById("selperiode").value == ""){
			document.getElementById("RedBoxPeriode").className = 'highlightActiveFieldSelect';
		}
		else {
			document.getElementById("RedBoxPeriode").className = 'RemovehighlightActiveFieldSelect';	
		}
}

//REMOVE RED BOX AROUND SEJOUR

function removecsssejour(){
		document.getElementById("RedBoxSejour1").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour2").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour3").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour4").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour5").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour6").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour7").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxSejour8").className = 'RemovehighlightActiveFieldRadio';
}

//REMOVE THE RED BOX AROUND DATE DE VOTRE MARIAGE CIVIL
function removecsstxtmariage(){
		document.getElementById("txtmarriage").className = 'Bordure-Bleu';
}

//SHOW TEXT BOX DATE DEPART
function showdepart(){
	document.getElementById("shwdepart1").style.display= 'block'; 
	document.getElementById("shwdepart2").style.display= 'block';
	document.getElementById("shwdepart3").style.display= 'block';
	document.getElementById("shwperiode1").style.display= 'none';
	document.getElementById("shwperiode2").style.display= 'none';
	document.getElementById("shwperiode3").style.display= 'none';
	document.getElementById("selperiode").value = "";
}

//SHOW SELECT BOX PERIODE
function showperiode(){
	document.getElementById("shwdepart1").style.display= 'none'; 
	document.getElementById("shwdepart2").style.display= 'none';
	document.getElementById("shwdepart3").style.display= 'none';
	document.getElementById("shwperiode1").style.display= 'block';
	document.getElementById("shwperiode2").style.display= 'block';
	document.getElementById("shwperiode3").style.display= 'block';
	document.getElementById("txtdepart").value = "";
}

//REMOVE THE RED BOX AROUND INCLURE VOL
function removecssinclurevol(){
		document.getElementById("RedBoxInclureVolOui").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxInclureVolNon").className = 'RemovehighlightActiveFieldRadio';
}

//REMOVE THE RED BOX AROUND AIRPORT

function removecssairport(){
		if(document.getElementById("selaeroport").value == 0){
			document.getElementById("shwairport2").className = 'highlightActiveField';
		}
		else {
			document.getElementById("shwairport2").className = 'RemovehighlightActiveFieldSelect';	
		}
}

//REMOVE THE RED BOX AROUND ASSURANCE ANNULATION
function removecssAssurance(){
		document.getElementById("RedBoxAssuranceOui").className = 'RemovehighlightActiveFieldRadio';
		document.getElementById("RedBoxAssuranceNon").className = 'RemovehighlightActiveFieldRadio';
}

//REMOVE THE RED BOX AROUND NOM

function removecssnom(){
		document.getElementById("txtnom").className = 'Bordure-Bleu';	
}

//SORT OUT ONLY NUMERIC CHARACTERS

function onlyNumbers(evt)
{

	var e = event || evt; // for trans-browser compatibility
	var charCode = e.which || e.keyCode;

	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;

	return true;

}

//REMOVE THE RED BOX AROUND TEL FIXE & MOBILE

function ontypefixe(){
		var minLength = 10;
		if(document.getElementById("txtfixe").value == 0){
			document.getElementById("txtfixe").className = 'highlightActiveField';
		}
		else if(document.getElementById("txtfixe").value != 0 && document.getElementById("txtfixe").value.length < minLength){
				document.getElementById("txtfixe").className = 'highlightActiveField';
		}
		else if(document.getElementById("txtfixe").value != 0 && document.getElementById("txtfixe").value.length >= minLength){
				document.getElementById("txtfixe").className = 'removehighlightActiveField';
				document.getElementById("txtfixe").className = 'Bordure-Bleu';
		}
		else
		{
		}
}

function ontypemobile(){
		var minLength2 = 10;
		if(document.getElementById("txtmobile").value == 0){
			document.getElementById("txtmobile").className = 'highlightActiveField';
		}
		else if(document.getElementById("txtmobile").value != 0 && document.getElementById("txtmobile").value.length < minLength2){
				document.getElementById("txtmobile").className = 'removehighlightActiveField';
				document.getElementById("txtmobile").className = 'Bordure-Bleu';
		}
		else if(document.getElementById("txtmobile").value != 0 && document.getElementById("txtmobile").value.length >= minLength2){
				document.getElementById("txtmobile").className = 'removehighlightActiveField';
				document.getElementById("txtmobile").className = 'Bordure-Bleu';
		}
		else
		{
		}
}
// REMOVE THE RED BOX AROUND PAYS

function removecsspays(){
		if(document.getElementById("txtpays").value == "0"){
			document.getElementById("RedBoxPays").className = 'highlightActiveFieldSelect';
		}
		else {
			document.getElementById("RedBoxPays").className = 'RemovehighlightActiveFieldSelect';	
		}
}

// REMOVE THE RED BOX AROUND BUDGET

function removecssbudget(){
		if(document.getElementById("selbudget").value == "0"){
			document.getElementById("RedBoxBudget").className = 'highlightActiveFieldSelect';
		}
		else {
			document.getElementById("RedBoxBudget").className = 'RemovehighlightActiveFieldSelect';	
		}
}

//REMOVE THE RED BOX AROUND EMAIL 

function ontypetxtemail(){

		document.getElementById("txtemail").className = 'Bordure-Bleu';
}

//REMOVE THE RED BOX AROUNG EMAIL CONFIRM

function ontypetxtconfirm(){

		document.getElementById("txtconfirm").className = 'Bordure-Bleu';
}

//CHECK THE MARRIAGE DATE FORMAT AND REMOVE THE RED BOX

function checkdate(input){
var validformat=/^\d{2}\/\d{2}\/\d{4}$/ //Basic check for format validity
var returnval=false
if (!validformat.test(input.value)){
alert("Le format de la date n'est pas bon\nMettez la date en format jj/mm/aaaa");
document.getElementById("txtmarriage").className = 'highlightActiveField';
}
else{
var dayfield=input.value.split("/")[0]
var monthfield=input.value.split("/")[1]
var yearfield=input.value.split("/")[2]
var dayobj = new Date(yearfield, monthfield-1, dayfield)
if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)){
alert("Le format de la date n'est pas bon.\nMettez la date en format jj/mm/aaaa");
document.getElementById("txtmarriage").className = 'highlightActiveField';
}
else
document.getElementById("txtmarriage").className = 'Bordure-Bleu';
returnval=true
}
if (returnval==false) input.select()
return returnval
}

//CHECK FORMULE & NUIT

function checknuit(){
	var valuenuit = document.getElementsByName('selnuit');
		for(var a = 0; a < valuenuit.length; a++)
		{
			if(valuenuit[a].value==0){
				document.getElementById("rappelnuit").style.display = "block";
				}
			else {
				document.getElementById("rappelnuit").style.display = "none";
			}
		}
}

//POPUP BUDGET

function budget_popup_on(text) {
document.getElementById('budget_popup').style.display='';
document.getElementById('budget_popup').innerHTML=text;
}

function budget_popup_off() {
document.getElementById('budget_popup').style.display='none';
}
