﻿
var $main_window_height = 1697;  //1780; // 1697;
var $timebeforescrool = 100;
var $product_height = 430;
var $pixel_secure = 21;
var $faq_height = 160;
var $quisommesnous_height = 100;
var $produit_on = 0;
var $faq_on = 0;
var $qsn_on = 0;
function hover(whattohover) {
    if (whattohover == 'home') {
        $('#button_home').css("background-image", "url(/gfx/menuover.png)");
        //out('produits', 'animated');
        //out('faq', 'animated');
        //out('quisommesnous', 'animated');
    }
    if (whattohover == 'devis') {
        $('#button_demande_devis').css("background-image", "url(/gfx/menuover.png)");
        //out('produits', 'animated');
        //out('faq', 'animated');
        //out('quisommesnous', 'animated');
    }
    if (whattohover == 'achetons') {
        $('#button_nous_achetons').css("background-image", "url(/gfx/menuover.png)");
        //out('produits', 'animated');
        //out('faq', 'animated');
        //out('quisommesnous', 'animated');
    }
    if (whattohover == 'actualites') {
        $('#button_actualites').css("background-image", "url(/gfx/menuover.png)");
        //out('produits', 'animated');
        //out('faq', 'animated');
        //out('quisommesnous', 'animated');
    }
    if (whattohover == 'produits') {
        out('faq', 'speed');
        out('quisommesnous', 'speed');
        $("#produit_separator_left").attr("src", "/gfx/separation1-r.png");
        $("#produit_separator_right").attr("src", "/gfx/separation1-l.png");
        $('#button_nos_produits').css("background-image", "url(/gfx/menuover.png)");

        if ($produit_on == 0) {
            //var t = setTimeout(function () {
                $('#menu_detail_nos_produits').animate({ height: $product_height + 'px', opacity: 'show' }, 300, 'linear', function () { });
                $('#main_window').animate({ height: ($product_height + $main_window_height + $pixel_secure) + 'px' }, 0, 'linear', function () { });
            //}, $timebeforescrool);
            //$(this).data('timeout', t);
            $produit_on = 1;
            $faq_on = 0;
            $qsn_on = 0;
        } else {
            $produit_on = 0;
            $faq_on = 0;
            $qsn_on = 0;
            out('produits', 'animated');
            
        }
                       

     }
    if (whattohover == 'produits2') {
        out('faq', 'speed');
        out('quisommesnous', 'speed');
        $('#button_nos_produits_selected span').css("color", "#FFFFCC");
        $('#button_nos_produits_selected a').css("color", "#FFFFCC");
        $("#produit2_separator_left").attr("src", "/gfx/separation1-r.png");
        $("#produit2_separator_right").attr("src", "/gfx/separation1-l.png");
        $('#button_nos_produits_selected').css("background-image", "url(/gfx/menuover.png)");

        if ($produit_on == 0) {
        //var t = setTimeout(function () {
        $('#menu_detail_nos_produits').animate({ height: $product_height + 'px', opacity: 'show' }, 300, 'linear', function () { });
        $('#main_window').animate({ height: ($product_height + $main_window_height + $pixel_secure) + 'px' }, 0, 'linear', function () { });
   // }, $timebeforescrool);
    //$(this).data('timeout', t);
    $produit_on = 1;
    $faq_on = 0;
       $qsn_on = 0;
   } else {
       $produit_on = 0;
       $qsn_on = 0;
       $faq_on = 0;
     out('produits', 'animated');
    
 }
    }
    if (whattohover == 'faq') {
        out('produits', 'speed');
        out('quisommesnous', 'speed');
        $('#button_faq').css("background-image", "url(/gfx/menuover.png)");

        if ( $faq_on == 0) {
        //var t = setTimeout(function () {
        $('#menu_detail_faq').animate({ height: $faq_height + 'px', opacity: 'show' }, 300, 'linear', function () { });
        $('#main_window').animate({ height: ($faq_height + $main_window_height + $pixel_secure) + 'px' }, 0, 'linear', function () { });
  //  }, $timebeforescrool);
   // $(this).data('timeout', t);
    $faq_on = 1;
    $produit_on = 0;
    $qsn_on = 0;
} else {
    $faq_on = 0;
    $qsn_on = 0;
    $produit_on = 0;
    out('faq', 'animated');
  
}
    }
    if (whattohover == 'quisommesnous') {
        out('produits', 'speed');
        out('faq', 'speed');
        $('#button_quisommesnous').css("background-image", "url(/gfx/menuover.png)");
        if ($qsn_on == 0) {
           // var t = setTimeout(function () {
                $('#menu_detail_quisommesnous').animate({ height: $quisommesnous_height + 'px', opacity: 'show' }, 300, 'linear', function () { });
                $('#main_window').animate({ height: ($quisommesnous_height + $main_window_height + $pixel_secure) + 'px' }, 0, 'linear', function () { });
           // }, $timebeforescrool);
           // $(this).data('timeout', t);
            $qsn_on = 1;
            $faq_on = 0;
            $produit_on = 0;
            
        } else {
            out('quisommesnous', 'animated');
            $qsn_on = 0;
            $faq_on = 0;
            $produit_on = 0;
        }
    }

}

function hover2(whattohover) {
 
    if (whattohover == 'produits') {
        //out('faq', 'speed');
        //out('quisommesnous', 'speed');
        $("#produit_separator_left").attr("src", "/gfx/separation1-r.png");
        $("#produit_separator_right").attr("src", "/gfx/separation1-l.png");
        $('#button_nos_produits').css("background-image", "url(/gfx/menuover.png)");

 
    }
    if (whattohover == 'produits2') {
        //out('faq', 'speed');
        //out('quisommesnous', 'speed');
        $('#button_nos_produits_selected a').css("color", "#FFFFCC");
        $('#button_nos_produits_selected span').css("color", "#FFFFCC");
        $("#produit2_separator_left").attr("src", "/gfx/separation1-r.png");
        $("#produit2_separator_right").attr("src", "/gfx/separation1-l.png");
        $('#button_nos_produits_selected').css("background-image", "url(/gfx/menuover.png)");


    }
    if (whattohover == 'faq') {
        //out('produits', 'speed');
        //out('quisommesnous', 'speed');
        $('#button_faq').css("background-image", "url(/gfx/menuover.png)");


      
    }
    if (whattohover == 'quisommesnous') {
        //out('produits', 'speed');
        //out('faq', 'speed');
        $('#button_quisommesnous').css("background-image", "url(/gfx/menuover.png)");
     
    }

}








function out(whattohover, mode) {
    //clearTimeout($(this).data('timeout')); 
    if (whattohover == 'home') {
        $('#button_home').css("background-image", "url(/gfx/menuup.png)");
    }
    if (whattohover == 'devis') {
        $('#button_demande_devis').css("background-image", "url(/gfx/menuup.png)");
    }
    if (whattohover == 'achetons') {
        $('#button_nous_achetons').css("background-image", "url(/gfx/menuup.png)");
    }
    if (whattohover == 'actualites') {
        $('#button_actualites').css("background-image", "url(/gfx/menuup.png)");
    }
    if (whattohover == 'produits') {
        $("#produit_separator_left").attr("src", "/gfx/separation3-r.png");
        $("#produit_separator_right").attr("src", "/gfx/separation2-l.png");
        $("#produit2_separator_left").attr("src", "/gfx/separation4.png");
        $("#produit2_separator_right").attr("src", "/gfx/separation4.png");
        $('#button_nos_produits_selected').css("background-image", "url(/gfx/separation4.png)");
        $('#button_nos_produits_selected a').css("color", "#333333");
        $('#button_nos_produits').css("background-image", "url(/gfx/produit.png)");
        if (mode == 'animated') {
            $('#menu_detail_nos_produits').animate({ height: '0px', opacity: 'hide' }, 300, 'linear', function () { });
            $('#main_window').animate({ height: $main_window_height + 'px' }, 0, 'linear', function () { });
        } else {
            $('#menu_detail_nos_produits').hide();
            $('#main_window').animate({ height: $main_window_height + 'px' }, 0, 'linear', function () { });
        }

        
    }
    if (whattohover == 'faq') {
        $('#button_faq').css("background-image", "url(/gfx/menuup.png)");
        if (mode == 'animated') {
            $('#menu_detail_faq').animate({ height: '0px', opacity: 'hide' }, 300, 'linear', function () { });
            $('#main_window').animate({ height: $main_window_height + 'px' }, 0, 'linear', function () { });
        } else {
            $('#menu_detail_faq').hide();
            $('#main_window').animate({ height: $main_window_height + 'px' }, 0, 'linear', function () { });
        }

    }
    if (whattohover == 'quisommesnous') {
        $('#button_quisommesnous').css("background-image", "url(/gfx/menuup.png)");
        if (mode == 'animated') {
            $('#menu_detail_quisommesnous').animate({ height: '0px', opacity: 'hide' }, 300, 'linear', function () { });
            $('#main_window').animate({ height: $main_window_height + 'px' }, 0, 'linear', function () { });
        } else {
            $('#menu_detail_quisommesnous').hide();
            $('#main_window').animate({ height: $main_window_height + 'px' }, 0, 'linear', function () { });
        }
    }
}




function out2(whattohover) {
   // clearTimeout($(this).data('timeout'));

    if (whattohover == 'produits' || whattohover == 'produits2') {

        if ($produit_on == 0) {
            $("#produit_separator_left").attr("src", "/gfx/separation3-r.png");
            $("#produit_separator_right").attr("src", "/gfx/separation2-l.png");
            $("#produit2_separator_left").attr("src", "/gfx/separation4.png");
            $("#produit2_separator_right").attr("src", "/gfx/separation4.png");
            $('#button_nos_produits_selected').css("background-image", "url(/gfx/separation4.png)");
            $('#button_nos_produits_selected a').css("color", "#333333");
            $('#button_nos_produits_selected span').css("color", "#333333");
            $('#button_nos_produits').css("background-image", "url(/gfx/produit.png)");
        }


    }
    if (whattohover == 'faq') {
        if ($faq_on == 0) {
            $('#button_faq').css("background-image", "url(/gfx/menuup.png)");
        }

    }
    if (whattohover == 'quisommesnous') {
        if ($qsn_on == 0) {
        $('#button_quisommesnous').css("background-image", "url(/gfx/menuup.png)");
         }
    }
}

function hidehovermenu() {
$('#filter_product_menu').css('display','none');
$('#HoverMenuSousCategory').css('display', 'none');
$('#HoverMenuCategory').css('display', 'none');                        
}
