function loadswf(file, id, width, height, bgcolor, flashvars)
{
    var so = new SWFObject(file, id, width, height, 9, bgcolor);
    so.addParam("wmode", "transparent"); 
    so.addParam("allowFullScreen", "true");
    so.addVariable("flashvars", flashvars);
    so.write(id);
}
$(document).ready( function(){

if ($("div#hot")[0] != null){
     loadswf("/swf/player_home_01_09.swf", "hot", 300, 366, "#000", "&xmlfile=http://zates2.canal13.cl/_portadas/Itplqreddot_video_xml.html");
};

// Scroll Items    
$('div.teletrece').scrollable({ 
    size: 1,
    horizontal:true,
    speed: 00,
    navi:'ul.menu',
    activeClass:'activo',
    items: 'div.entradas'
});

$('.fondo').scrollable({
    items: ".entradas",
    size: 3
});

$('div.scroll').scrollable({
    size: 1,
    horizontal:true, 
    speed: 600,
    items: 'div.entradas'
});



// Activar Acordeon
$('div.acordeon').accordion({
    header: 'h4.titulo',
    selectedClass: 'open',
    event: 'click'
});
// Menu Dropdown
var navTimer = null;
$("#header .menu").hide();
$("#header .menu").animate({opacity:0.9});
$("#menu_prog").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_a").slideDown("slow"); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_a").slideUp('slow');
    navTimer = null;
    }, 100);
});
$("#menu_live").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_b").slideDown("slow"); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_b").slideUp('slow');
    navTimer = null;
    }, 100);
});

$("#especiales_dropdow2").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_d").show(); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_d").hide();
    navTimer = null;
    }, 100);
});
$("#m13_especiales2").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_d").show(); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_d").hide();
    navTimer = null;
    }, 100);
});

// Menu Tabs Lo ultimo 
$("#comentado").hide();
$(".comentado").addClass("apagado");
$(".ultimo").mouseover(function(){$(this).removeClass("apagado"); $(".comentado").addClass("apagado"); $("#comentado").hide();$("#ultimo").show();});
$(".comentado").mouseover(function(){$(this).removeClass("apagado"); $(".ultimo").addClass("apagado"); $("#ultimo").hide();$("#comentado").show();});

$(".toggler").click(function(){$(".player").slideToggle("slow");});

    $(".items div").each(function(i){
        $("#paging").append("<a href=\"javascript:void(0);\">" + Number(i+1) + "</a>");
    });
    $('.mediascroll').scrollable({size: 1});
    window.api = $('.mediascroll').scrollable({size: 1});
    $(".prev").click(function(){
        window.api.prev();
    });
    $(".next").click(function(){
        window.api.next();
    });
    $("#paging a").each(function(i){
        $(this).click(function(){
            api.setPage(i);
        });
    });

});