/* Util detecta ie6 ie7*/
var ie_old=false;
if((jQuery.browser.msie)&&(jQuery.browser.version.substr(0,1)<7)){ie_old=true;}
/* Carga ajax */

function slideSwitch() {
    var $active = jQuery('#slideshow IMG.active');
    if ($active.length == 0 ) $active = jQuery('#slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : jQuery('#slideshow IMG:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .stop().animate({opacity: 1.0}, 300, function() {
            $active.removeClass('active last-active');
        });
        jQuery('.img_buttons span').text(jQuery($next).attr('alt'));
}
function slideSwitchPrev(){
    var $active = jQuery('#slideshow IMG.active');
    if ($active.length == 0 ) $active = jQuery('#slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.prev().length ? $active.prev()
        : jQuery('#slideshow IMG:last');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .stop().animate({opacity: 1.0}, 300, function() {
            $active.removeClass('active last-active');
        });
        jQuery('.img_buttons span').text(jQuery($next).attr('alt'));
}
/* Mostrar documentales */

jQuery('.jSliderButton').css({'opacity':'0.8'});

function makeSlider(a){
    anchoContenedor=jQuery(a+' ul > li').length*134
    jQuery(a+' ul').css({'width':anchoContenedor});
    jQuery(a).children('.jSliderButton').click(function(){
        anchoMov=parseInt(jQuery(a+' ul').css('margin-left'));
        if(jQuery(this).hasClass('Next')){
            //tope Next (total del contenedor menos dos caratulas)
            if(anchoMov>(-(anchoContenedor-268))){anchoMov=anchoMov-134;}
        }else{
            //tope Prev (Menos una caratula)
            if(anchoMov<134){anchoMov=anchoMov+134;}
        }
        if(!jQuery(a+' ul').is(":animated")){
            jQuery(a+' ul').animate({'marginLeft':anchoMov},200);
        }
        return false;
    })

}

