    function convDate(date, a, m, d) {
            
        
        /*var reg=new RegExp("^[0-9]{2}[/]{1}[0-9]{2}[/]{1}[0-9]{4}$","g");
        
        if (reg.test(date)) {*/

            var jour = parseInt(date.substr(0,2), 10)+d;
            var mois = parseInt(date.substr(3,2), 10)+m;
            var annee = parseInt(date.substr(6,4), 10)+a;
            
           
            

            der  = new Date(annee,mois-1,jour);
            //alert(der);
            return der;
        /*}
        else
        return 0;*/
    }
    
    CLASSE_ERREUR = new Array();
    GARE = false;
    
    function unset(array, valueOrIndex){
            var output=[];
            for(var i in array){
                    if (i!=valueOrIndex)
                            output[i]=array[i];
            }
            return output;
    }
        
    function getBaseURL() {
        var url = location.href;
        var baseURL = url.substring(0, url.indexOf('/', 14));
             
        if (baseURL.indexOf('http://localhost') != -1) {
            var pathname = location.pathname;
            var index1 = url.indexOf(pathname);
            var index2 = url.indexOf("/", index1 + 1);
            var baseLocalUrl = url.substr(0, index2);
     
            return baseLocalUrl;
        }
        else {
            return baseURL;
        }
             
    }

    function showPopup(titre, content) {
        var wwidth = screen.availWidth;
        var wheight = screen.availHeight;
        var pwidth = 562;
        
        var pleft = Math.round((wwidth-pwidth)/2);
        var ptop = 100;
        
        $('#popup').css('left', pleft+'px');
        $('#popup').css('top', ptop+'px');
        
        $('#overlay').show();
        $('body').css('overflow', 'hidden');
        
        $('#popup').show('scale', 'slow');
        
    }
    
    function showPlanGrand() {
        if ($('#planGranPopup').css('display')!='block') {
            var contenu = jQuery('#planGrand').html();
            
            $('body').append('<div id="overlay" class="planGranOverlay" align="center"><div id="planGranPopup">'+contenu+'</div></div>');
            
            $('body').css('overflow', 'hidden');
            
            $("#overlay").css('top', $(window).scrollTop());
            
            $("#planGranPopup").fadeIn('fast');
            $("#overlay").click(function () {
                 $('body').css('overflow', 'auto');
                $(this).remove();
            });
        }
    }
    

    function  consultation_compte() {
        window.scrollTo(0,0);
        $('#overlay').fadeIn();
        $("#popup.capricorne").show();
    }
    
    
    function makeSublist(parent,child,defaut,childVal)
    {
            $("body").append("<select style='display:none' id='"+parent+child+"'></select>");
            
            if ($("#"+child+" optgroup").length)
            $('#'+parent+child).html($("#"+child+" optgroup"));
            else
            $('#'+parent+child).html($("#"+child+" option"));
            
                    var parentValue = $('#'+parent).attr('value');
                    
                    if ($("#"+parent+child+" optgroup").length) {
                        $('#'+child).html($("#"+parent+child+" optgroup").clone());
                        $('#'+child+' option').map(function () {
                           
                            if (!$(this).hasClass(parentValue))
                            $(this).remove();
                        });
                        $('#'+child+' optgroup:empty').remove();
                    }
                    else
                    $('#'+child).html($("#"+parent+child+" ."+parentValue).clone());
                    
             $('#'+child).prepend("<option value='0'>"+defaut+"</option>");
                $("#"+child).val(0);
                /*if ($("#"+child+' option').length==1)
                $("#"+child).hide();
                else
                $("#"+child).show();*/
            childVal = (typeof childVal == "undefined")? "" : childVal ;
            if (childVal)
            $("#"+child).val(childVal);
            function parentChange(ss)
                    {

                            var parentValue = $('#'+parent).attr('value');

                            if ($("#"+parent+child+" optgroup").length) {

                                $('#'+child).html($("#"+parent+child+" optgroup").clone());
                                $('#'+child+' option').map(function () {

                                    if (!$(this).hasClass(parentValue))
                                    $(this).remove();
                                });
                                $('#'+child+' optgroup:empty').remove();

                            }
                            else
                            $('#'+child).html($("#"+parent+child+" ."+parentValue).clone());

                            $('#'+child).prepend("<option value='0' selected='selected'>"+defaut+"</option>");
                             $("#"+child).val(0);
                             /*if ($("#"+child+' option').length==1)
                             $("#"+child).hide();
                             else
                             $("#"+child).show();*/

                                if (ss!=1)
                                $('#'+child).trigger("change");
                            $('#'+child).focus();
                    }
            $('#'+parent).change(parentChange);
                parentChange(1);

    }
    

$(document).ready(function () {
    jQuery('body').show();
    jQuery('a#c1037').remove();
        
    jQuery('#piedPrecedent').attr('href', 'javascript:void(0);');
    jQuery('#piedSuivant').attr('href', 'javascript:void(0);');
    
    jQuery('#piedSuivant').click(function () {
        
        ul = $('#jcarouselPied').find('ul.colonne');
        
        lim =ul.children('li').length*154-4*154;
        
        
        var x = parseInt(ul.css('left'));
        if ((x-154)<-lim)
        x=-lim+154;
        
        ul.animate({'left': (x-154)+'px'}, 300, 'swing');
        
    });
    
    jQuery('#piedPrecedent').click(function () {
        
        ul = $('#jcarouselPied').find('ul.colonne');
        
        var x = parseInt(ul.css('left'));
        if (x+154>0)
        x=-154;
        ul.animate({'left': (x+154)+'px'}, 300, 'swing');
        
    });
    
    jQuery('#piedToggle').click(function () {

                if ($(this).attr('toggle')=='false')
                $('#chaussette').slideDown();
                else
                $('#chaussette').slideUp();
        
        });
    
    
    jQuery('.accordeon').accordion({
        header: 'h2',
        autoHeight: false
    });
    

    
    
    
    $('#fermer_popup').click(function () {
                $('body').css('overflow', 'auto');
                $('#popup').hide("scale", "slow", function () {
                    $('#overlay').hide()
                    document.aeorport_popup_form.submit();
                });
                    
                 
     });

    
    $("#visite_avion a").click(function () {
        if ($('#visite360popup').css('display')!='block') {
            
            $('body').append('<div id="overlay" class="planGranOverlay" align="center"><div id="visite360popup"></div></div>');            
            $("#overlay").css('top', $(window).scrollTop());
            
            $('#visite360popup').load($(this).attr("title"), function () {
                
                $('body').css('overflow', 'hidden');
                
                
                
                $("#visite360popup").fadeIn('fast');
                
            });
            
            $("#overlay, #visite360popup a").click(function () {
                 $('body').css('overflow', 'auto');
                $(this).remove();
            });
        }
    });
    
    /************** bouton article *****************/
    
    $('#bt_amoins').click(function () {
        
        $("#colonne_milieu").find("h1, .chapo, h3,dt,p,a").each(function () {
            var tp = parseInt($(this).css('font-size'));
            if (tp>10) {
                $('#bt_amoins').css('opacity', '1');
                $(this).css('font-size', (tp-1)+'px');
            }
            else {
                $('#bt_amoins').css('opacity', '0.5');
            }
            
        });
    });

    $('#bt_aplus').click(function () {
        
        $("#colonne_milieu").find("h1, .chapo, h3,dt,p,a, li").each(function () {
            var tp = parseInt($(this).css('font-size'));
            if (tp<22) {
                $('#bt_aplus').css('opacity', '1');
                $(this).css('font-size', (tp+1)+'px');
            }
            else {
                $('#bt_aplus').css('opacity', '0.5');
            }
            
        });
    });

    $('#bt_print').click(function () {
        window.print();    
    });
    
    $('#bt_email').click(function () {
        $('#email_box').load('fileadmin/templates/envoi_ami.php', function () {
            $('#email_box').fadeIn('slow');
        });
    }); 
    
    
   
   
});