function loadswf(file, id, width, height, bgcolor, fvars)
{
/*
    var so = new SWFObject(file, id, width, height, 9, bgcolor);
    so.addParam("wmode", "opaque"); 
    so.addParam("allowFullScreen", "true");
    so.addVariable("flashvars", flashvars);
    so.write(id);
*/
    var flashvars={
        xmlfile: fvars
    };
    var params = {
        flashvars: fvars,
	allowFullScreen: "true"
    };
    var attributes = { };
    swfobject.embedSWF(file, id, width, height, "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

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

function toogleMinimice()
{
    if ($("div#swfplayer").css("height") != "40px")
    {
        $("div#swfplayer").css("height", "40px");
    }
    else
    {
        $("div#swfplayer").css("height", "425px");
    }
}
function popup()
{
    window.open('/playerpopup.htm','_blank','scrollbars=no,resizable=no,menubar=no,width=520,height=430,left=200,top=200')
}
function social(id)
{
    switch (id)
    {
        case "email" :
            alert("Email");
            break;
        case "yahoo" :
            alert("Yahoo!");
            break;
        case "facebook" :
            alert("Facebook");
            break;
        case "delicious" :
            alert("Delicious");
            break;
    }    
}


$(document).ready( function(){

var params = {
		wmode: "opaque"
};

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

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",params);
};

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



$('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();
$("#ultimo").hide();

$(".comentado").addClass("apagado");
$(".ultimo").addClass("apagado");

$(".ultimo").click(function(){
    $(this).removeClass("apagado"); 
    $(".comentado").addClass("apagado"); 
    $("#comentado").hide();
    $(".visto").addClass("apagado"); 
    $("#visto").hide();
    $("#ultimo").show();
});


$(".comentado").click(function(){
    $(this).removeClass("apagado"); 
    $(".ultimo").addClass("apagado"); 
    $("#ultimo").hide();
    $(".visto").addClass("apagado"); 
    $("#visto").hide();
    $("#comentado").show();
});


$(".visto").click(function(){
    $(this).removeClass("apagado"); 
    $(".ultimo").addClass("apagado"); 
    $("#ultimo").hide();
    $(".comentado").addClass("apagado"); 
    $("#comentado").hide();
    $("#visto").show();
});


});
