var homeActualite = homeActualite || {};
homeActualite.slideshow = function(slideshow){
    if(slideshow == null)
    {
     var slideshow = new TINY.slideshow("slideshow");
    }
    var EcranLarg = screen.width;
            
    document.getElementById('slideshow').style.display = 'none';
    document.getElementById('wrapper').style.display = 'block';
    
    slideshow.auto = true;
    slideshow.speed = 5;
    slideshow.link = "linkhover";
    slideshow.info = "information";
    slideshow.thumbs = "slider";
    slideshow.left = "slideleft";
    slideshow.right = "slideright";
    slideshow.scrollSpeed = 4;
    slideshow.spacing = 5;
    slideshow.active = "#fff";
    slideshow.init("slideshow", "image", "imgprev", "imgnext", "imglink");
    
    var elementNbre  = jQuery('#slider img').length;
    var widthslider = 65*elementNbre;
    jQuery('#slider').css('width',+widthslider+'px');
    /*Pour la resolution */
    if(EcranLarg==1400){
         jQuery('#information').css('left','27px');
         jQuery('#thumbnails').css('margin-right','30px');
    }
    if (EcranLarg == 1440) {
    jQuery('#information').css('left', '35px');
        jQuery('#thumbnails').css('margin-right', '40px');
    }
        jQuery.each(jQuery.browser, function(i) {
        if (jQuery.browser.msie) {
            if (EcranLarg == 1440) {
                if(navigator.userAgent.match(/MSIE 6.0/)){
                    jQuery('#information').css('left','0px');
                    jQuery('#thumbnails').css('margin-right','40px');
                }
                else{
                    jQuery('#information').css('left','0px');
                    jQuery('#thumbnails').css('margin-right','80px');
                }
                
            }
            if (EcranLarg == 1400) {
                if(navigator.userAgent.match(/MSIE 6.0/)){
                    jQuery('#information').css('left','0px');
                    jQuery('#thumbnails').css('margin-right','30px');
                }
                else{
                    jQuery('#information').css('left','0px');
                    jQuery('#thumbnails').css('margin-right','60px');
                }
            }
        }
        });
    return slideshow;
};
jQuery(document).ready(function(){
   if(jQuery("#home_actualite").length != 0)
    {
        url =jQuery(".redirectLink").attr('href');
        get_actualites(url);
    }
});
var slideshow = new TINY.slideshow("slideshow");
function get_actualites(uri){
    
    empty = '';
     jQuery().ajaxSend(function(){
     jQuery('#loading').show();
     });
     
     jQuery().ajaxStop(function(){
     jQuery('#loading').hide();
     });
     
     jQuery.ajax({
     url: uri,
     success: function(result){
     jQuery('#home_actualite').html(result);
     homeActualite.slideshow(slideshow);
     
     },
     error: function(){
     jQuery('#loading').hide();
     jQuery('#home_actualite').text();
     }
     }) ;
}   


