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);
}

function certificaUpdate(video){
  $('#id_iframe').attr('src', 'certifica.php?v='+video);
}

$(document).ready( function(){

if ($("div#swfplayer")[0] != null){
    loadswf("/swf/player.swf", "swfplayer", 515, 425, "#000", "&xmlfile=http://tele13online.canal13.cl/xml/config.xml");
};

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

var navTimer = null;
$("#header .menu").hide();
$("#menu_prog").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_a").show(); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_a").hide();
    navTimer = null;
    }, 100);
});
$("#menu_live").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_b").show(); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_b").hide();
    navTimer = null;
    }, 100);
});
$("#menu_nacional").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_c").show(); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_c").hide();
    navTimer = null;
    }, 100);
});
$("#m13_especiales").hover(function(){
    if ( navTimer ) {
    clearTimeout( navTimer );
    navTimer = null;
    } else
    $("#menu_d").show(); 
    }, function(){
    navTimer = setTimeout(function(){
    $("#menu_d").hide();
    navTimer = null;
    }, 100);
});



// Scroll Items    
$('div.teletrece').scrollable({ 
    size: 1,
    horizontal:true,
    speed: 00,
    navi:'ul.menu',
    activeClass:'activo',
    items: 'div.entradas'
});
$('div.destacado').scrollable({
    size: 4,
    horizontal:true, 
    speed: 600,
    items: 'div.entradas'
});
$('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 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();});

$(".fontmas").click(function(){$(".entrada").addClass("bigger");$(".entrada").removeClass("smaller");});
$(".fontmenos").click(function(){$(".entrada").addClass("smaller");$(".entrada").removeClass("bigger");});
$(".fontnormal").click(function(){$(".entrada").removeClass("bigger");$(".entrada").removeClass("smaller");});
});

