$(document).ready(function () {    
        // Fix PNG for IE6 and below
    if ((/MSIE (5\.5|6\.)/).test(navigator.userAgent)) { 
            supersleight.init();
    }
    jQuery("select.DropList").addSelectUI({
        scrollbarWidth: 15,
        maxDropListHeight: 500
    });
    navigation();
    expandCollapseQuestionBox();
	nosEngagements();
	question();
});
             
function thisMovie(movieName) 
{
    if (window.document[movieName])  {
        return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet")==-1) {
        if (document.embeds && document.embeds[movieName]) {
            return document.embeds[movieName]; 
        }
    }
    else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
        return document.getElementById(movieName);
    }

}  


function navigation(){
        $("#navigation > ul > li").bind("mouseover", function() {
            $("#navigation > ul > li").removeClass("Hover");
            var self = $(this);
            this.SubMenu = self.find('.Outer li');   
            self.addClass("Hover");
    
            //binding event
    
            this.SubMenu.bind("mouseover", function () {
                return false;
            });
            return false;
        });

    $("body").bind("mouseover", function(e) {
           $("#navigation > ul > li").removeClass("Hover");
         e.stopPropagation();
    });  
}
function callExternalInterface() 
{
    thisMovie("videoplayer").stopVideo();
}
function auto2ltHomePage(){
    sIFR.replace(auto2lt, {
	  selector: '.ConseilBlock .Content h3'
	  ,css: [
	  '.sIFR-root {color: #ffffff; font-weight:bold; leading: -5 }'
	 ]
	  ,wmode: 'transparent'
	});
	sIFR.replace(auto2lt, {
	  selector: '.ConseilBlock .Content h5'
	  ,css: [
	  '.sIFR-root {color: #dbdbdb; font-weight:bold; }'
	 ]
	  ,wmode: 'transparent'
	});
    sIFR.replace(auto2lt, {
      selector: '.Container01 .TabContent .ConseilBlock .Content li'
      ,css: [
      '.sIFR-root {font-weight:bold;}'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #ffffff; text-decoration: none; }'
      ,'a:hover { color: #ffd708; }'
     ]
      ,wmode: 'transparent'
    });
}
var tab = function(id, current){

    var TabContainer = $("#" + id);
    var Tabs = TabContainer.find(".Tab");
    var TabContents = TabContainer.find(".TabContent");

    if( current == undefined || current > (Tabs.length-1)){
        current = 0;
    }
    TabContainer.find(".Tab").removeClass("Active");
    TabContainer.find(".TabContent").addClass("Hide");        
    TabContainer.find(".Tab:eq("+current+")").addClass("Active");
    TabContainer.find(".TabContent:eq("+current+")").removeClass("Hide");
    auto2ltHomePage();
    TabContainer.find(".Tab").each(
        function(index){
            $(this).bind("click", function(e){
                $(Tabs).removeClass("Active");
                $(TabContents).addClass("Hide");
                $(this).addClass("Active");
                TabContainer.find(".TabContent:eq("+ index +")").removeClass("Hide");
                jQuery(".SelectUI").addSelectUI({
                    scrollbarWidth: 15
                });
                lastAction = new Date();
				auto2ltHomePage();
                //if(index == 1){				
                    callExternalInterface();
                //}
                
                return false;
                
            });
            $(this).hover(
                function(){
                    $(this).addClass("Hover");
                },
                function(){
                    $(this).removeClass("Hover");
                }    
            )
            
    });    
    
}

function expandCollapseQuestionBox (){	
	$("#boxAns").addClass("Hide");
	$(".Vous a.BtnSavoir").show();
    $(".BtnSavoir").bind("click", function () {
        var self = $(this);
        if( !$("#boxAns").hasClass("Hide") )
        {    
            $("#boxAns").addClass("Hide");         
            self.addClass("DownStyle");
        }
        else
        {    
            $("#boxAns").removeClass("Hide");        
            self.removeClass("DownStyle");
        }
    });
}

function nosEngagements(){
	$(".NosEngagements").find("li:first").addClass("Active");
	$(".NosEngagements").find("li").click(function(){
		$(".NosEngagements").find("li").removeClass("Active");
		$(this).addClass("Active");
	})	
}

function question(){		
	var infoBox = $('.BoxInfo');			
	$(".NavRevi").find(".QuesOp").click(function(e){												 
		infoBox.addClass("ShowInfo");		
		infoBox.find(".Content").html($(this).parent().parent().find(".Info").html())
		infoBox.css({left:(e.pageX - 25) ,top: (e.pageY - 22)});				
		 e.stopPropagation();
	})	
	$("body").bind("click", function(e) {
		infoBox.removeClass("ShowInfo");
    });  
}