function initSurMesure(){
    document.getElementById('SurMesureRecapEnTete').style.display = 'none';
    document.getElementById('boutons').style.display = 'none';


}


function surMesureRecap(form){
    document.getElementById('SurMesureEnTete').style.display = 'none';
    document.getElementById('SurMesureRecapEnTete').style.display = '';
    document.getElementById('obligation').style.display = 'none';
    document.getElementById('notes').style.display = 'none';
    document.getElementById('validation').style.display = 'none';
    document.getElementById('boutons').style.display = '';
    document.getElementById('zone').style.display = 'none';
    document.getElementById('dest2').style.clear = 'both';
    document.getElementById('dest3').style.clear = 'both';
    document.getElementById('dur').style.clear = 'both';
    document.getElementById('dest2').style.marginTop = '5px';
    document.getElementById('dest3').style.marginTop = '5px';
    document.getElementById('dur').style.marginTop = '5px';
    document.getElementById('agesAdultes').style.display = 'none';
    document.getElementById('agesEnfants').style.display = 'none';
    document.getElementById('agesBebes').style.display = 'none';
    window.location.href='#haut-de-page';

    for(var i=1; i<=9; i++){
        document.getElementById('etoile'+i).style.display = 'none';

    }
    for (var i = 0; i < form.elements.length; i++) {
        var el = form.elements[i];
        if (el.tagName.toLowerCase() == "select") {
            for (var j = 0; j < el.options.length; j++){
                var op = el.options[j];
                if(op.selected){
                    if(op.text=="Jour"||op.text=="Mois"){
                    document.getElementById('div'+el.id).innerHTML = "";
                    }else{
                    document.getElementById('div'+el.id).innerHTML = op.text;
                    }
                    document.getElementById('div'+el.id).style.display = '';
                    el.style.display = 'none';
                }
            }
        } else if (el.tagName.toLowerCase() == "textarea"){
                document.getElementById('div'+el.id).innerHTML = el.value.replace(new RegExp('\n','gm'),'<br>');

                document.getElementById('div'+el.id).style.display= '';
                el.style.display = 'none';
        } else if (el.tagName.toLowerCase() == "input"){
            if (el.type.toLowerCase() == "text"){
                el.style.border = 0;
                el.style.backgroundColor = '#f3f6f9';
                if((el.name == 'NomVoyageur') || (el.name == 'PreNomVoyageur')){
                    el.style.backgroundColor = '#ffffff';
                }
               el.readOnly = true;
            }
            if (el.type.toLowerCase() == "radio"){
                if(el.checked == true){
                    document.getElementById('div'+el.name).innerHTML = el.value;
                    document.getElementById('div'+el.name).style.display= '';
                    document.getElementById('assurances').style.display= 'none';
                }
            }
        }
    }
}

function surMesure(form){
    document.getElementById('SurMesureEnTete').style.display = '';
    document.getElementById('SurMesureRecapEnTete').style.display = 'none';
    document.getElementById('obligation').style.display = '';
    document.getElementById('notes').style.display = '';
    document.getElementById('validation').style.display = '';
    document.getElementById('boutons').style.display = 'none';
    document.getElementById('zone').style.display = '';
    document.getElementById('dest2').style.float = 'left';
    document.getElementById('dest2').style.clear = '';
    document.getElementById('dest3').style.float = 'left';
    document.getElementById('dest3').style.clear = '';
    document.getElementById('dur').style.float = 'left';
    document.getElementById('dur').style.clear = '';
    document.getElementById('agesAdultes').style.display = '';
    document.getElementById('agesEnfants').style.display = '';
    document.getElementById('agesBebes').style.display = '';
    document.getElementById('dest2').style.marginTop = '0px';
    document.getElementById('dest3').style.marginTop = '0px';
    window.location.href='#haut-de-page';

    for(var i=1; i<=9; i++){
        document.getElementById('etoile'+i).style.display = '';

    }
    for (var i = 0; i < form.elements.length; i++) {
        var el = form.elements[i];
        if (el.tagName.toLowerCase() == "select") {
            for (var j = 0; j < el.options.length; j++){
                var op = el.options[j];
                if(op.selected){
                    document.getElementById('div'+el.id).style.display = 'none';
                    el.style.display = '';
                }
            }
        } else if (el.tagName.toLowerCase() == "textarea"){
                el.value = document.getElementById('div'+el.id).innerHTML.replace(new RegExp('<br>','gm'),'\n').replace(new RegExp('<BR>','gm'),'\n');
                document.getElementById('div'+el.id).style.display = 'none';
                el.style.display = '';
        } else if (el.tagName.toLowerCase() == "input"){
            if (el.type.toLowerCase() == "text"){
            if(el.name!="NomAgence"){
                el.style.border = '1px #a5acb2 solid';
                el.style.backgroundColor = '#ffffff';

                el.readOnly = false;
                }
            }
            if (el.type.toLowerCase() == "radio"){
                if(el.checked == true){
                    el.value = document.getElementById('div'+el.name).innerHTML;
                    document.getElementById('div'+el.name).style.display= 'none';
                    document.getElementById('assurances').style.display= '';
                }
            }
        }
    }
}


function indentDestination1(){
    var destination = document.getElementById("ddlDestination1");
    for (i = 0; i < destination.length; i++){
        var val = destination.options[i].id;
        var strText = destination.options[i].text;
        if (val.indexOf(".") == -1 && val != ""){
            destination.options[i].style.backgroundColor = "#e8edf3";
	   }
        if (val.indexOf(".") > -1 && val != ""){
            destination.options[i].className = "space";
            destination.options[i].text = strText;
            destination.options[i].text = "   " + strText;
        }
    }
}

function indentDestination2(){
    var destination = document.getElementById("ddlDestination2");
    for (i = 0; i < destination.length; i++){
        var val = destination.options[i].id;
        var strText = destination.options[i].text;
        if (val.indexOf(".") == -1 && val != ""){
            destination.options[i].style.backgroundColor = "#e8edf3";
       }
        if (val.indexOf(".") > -1 && val != ""){
            destination.options[i].className = "space";
            destination.options[i].text = strText;
            destination.options[i].text = "   " + strText;
        }
    }
}


function indentDestination3(){
    var destination = document.getElementById("ddlDestination3");
    for (i = 0; i < destination.length; i++){
        var val = destination.options[i].id;
        var strText = destination.options[i].text;
        if (val.indexOf(".") == -1 && val != ""){
            destination.options[i].style.backgroundColor = "#e8edf3";
       }
        if (val.indexOf(".") > -1 && val != ""){
            destination.options[i].className = "space";
            destination.options[i].text = strText;
            destination.options[i].text = "   " + strText;
        }
    }
}


//for groupe
function initGroupe(){
    document.getElementById('CotationRecapEnTete').style.display = 'none';
    document.getElementById('CotationRecapChapeau').style.display = 'none';
    document.getElementById('boutons').style.display = 'none';


}

function replaceAll(strOrg,strFind,strReplace){
 var index = 0;
 while(strOrg.indexOf(strFind,index) != -1){
  strOrg = strOrg.replace(strFind,strReplace);
  index = strOrg.indexOf(strFind,index);
 }
 return strOrg
}
function cotationRecap(form){
    document.getElementById('CotationEnTete').style.display = 'none';
    document.getElementById('CotationRecapEnTete').style.display = '';
    document.getElementById('CotationChapeau').style.display = 'none';
    document.getElementById('CotationRecapChapeau').style.display = '';
    document.getElementById('obligation').style.display = 'none';
    document.getElementById('validation').style.display = 'none';
    document.getElementById('boutons').style.display = '';
    document.getElementById('destination').style.clear = 'both';
    document.getElementById('dur').style.clear = 'both';
    document.getElementById('destination').style.marginTop = '5px';
    document.getElementById('dur').style.marginTop = '5px';
    window.location.href='#haut-de-page';

    for(var i=1; i<=12; i++){
        document.getElementById('etoile'+i).style.display = 'none';

    }
    for (var i = 0; i < form.elements.length; i++) {
        var el = form.elements[i];
        if (el.tagName.toLowerCase() == "select") {
            for (var j = 0; j < el.options.length; j++){
                var op = el.options[j];
                if(op.selected){
                     if(op.text=="Jour"||op.text=="Mois"){
                    document.getElementById('div'+el.id).innerHTML = "";
                    }else{

                    document.getElementById('div'+el.id).innerHTML = op.text;
                    }
                    document.getElementById('div'+el.id).style.display = '';
                    el.style.display = 'none';
                }
            }
        } else if (el.tagName.toLowerCase() == "textarea"){


                document.getElementById('div'+el.name).innerHTML = el.value.replace(new RegExp('\n','gm'),'<br>');

                document.getElementById('div'+el.name).style.display= '';
                el.style.display = 'none';
        } else if (el.tagName.toLowerCase() == "input"){
            if (el.type.toLowerCase() == "text"){
                el.style.border = 0;
                el.style.backgroundColor = '#f3f6f9';
                if(el.name == 'NomGroupe'||el.name == 'NbrParticipants'||el.name == 'DateRemiseDevis'){
                    el.style.backgroundColor = '#f8fafb';
                }

                el.readOnly = true;
            }
        }
    }
}

function cotation(form){
    document.getElementById('CotationEnTete').style.display = '';
    document.getElementById('CotationRecapEnTete').style.display = 'none';
    document.getElementById('CotationChapeau').style.display = '';
    document.getElementById('CotationRecapChapeau').style.display = 'none';
    document.getElementById('obligation').style.display = '';
    document.getElementById('validation').style.display = '';
    document.getElementById('boutons').style.display = 'none';
    document.getElementById('destination').style.clear = '';
    document.getElementById('destination').style.float = 'left';
    document.getElementById('dur').style.clear = '';
    document.getElementById('dur').style.float = 'left';

    window.location.href='#haut-de-page';
    for(var i=1; i<=12; i++){
        document.getElementById('etoile'+i).style.display = '';

    }
    for (var i = 0; i < form.elements.length; i++) {
        var el = form.elements[i];
        if (el.tagName.toLowerCase() == "select") {
                document.getElementById('div'+el.id).style.display = 'none';
                el.style.display = '';
        } else if (el.tagName.toLowerCase() == "textarea"){
                el.value = document.getElementById('div'+el.name).innerHTML.replace(new RegExp('<br>','gm'),'\n').replace(new RegExp('<BR>','gm'),'\n');

                document.getElementById('div'+el.name).style.display = 'none';
                el.style.display = '';
        } else if (el.tagName.toLowerCase() == "input"){
        if(el.name!="NomAgence"){
            if (el.type.toLowerCase() == "text"){
                el.style.border = '1px #a5acb2 solid';
                el.style.backgroundColor = '#ffffff';
                if(el.name == 'budget'){
                    el.style.display = '';
                }
            }
            el.readOnly = false;
        }
        }
    }
}

function indentDestinationMultiCriteres(){
    var destination = document.getElementById("ddlDestination");
    for (i = 0; i < destination.length; i++){
        var val = destination.options[i].id;
        var strText = destination.options[i].text;
        if (val.indexOf(".") == -1 && val != ""){
            destination.options[i].style.backgroundColor = "#e8edf3";
        }
        if (val.indexOf(".") > -1 && val != ""){
            destination.options[i].className = "space";
            destination.options[i].text = strText;
            destination.options[i].text = "   " + strText;
        }
    }
}

