﻿//--- Events and functions of the new video player

/////////////////////////////////////////////////////////
// EVENT HANDLERS OF THE 'FULLSCREEN' IMAGE PLAYER
// Close button ->
// 1. Hides the div of the FULL player
// 2. Select the active image on the NORMAL player
/////////////////////////////////////////////////////////


var videoPlayerDivName = "divDigitaliaPlayer";

//--- Open the playlist
function closeListHandler()
{
	if (!activePlayer || activePlayer == "FlashMediaPlayerLayer")
	{
	    //alert("close");
        setPlayerWidth(srcName, closedWidth);
        setPlayerWidth(srcName, closedWidth);
        setStyleWidth(videoPlayerDivName, closedWidth);
        
        movie = thisMovie("DigitaliaPlayer");
        if (movie)
            movie.PlayListOpen = false;
    }
}

//--- Close the playlist
function openListHandler()
{
	if (!activePlayer || activePlayer == "FlashMediaPlayerLayer")
	{
	    //alert("open");
        setPlayerWidth(srcName, openWidth);
        setPlayerWidth(srcName, openWidth);
        setStyleWidth(videoPlayerDivName, openWidth);
        
        movie = thisMovie("DigitaliaPlayer");
        if (movie)
            movie.PlayListOpen = true;
    }
}

//--- Select an item from the playlist
function selectItemById(id) 
{
    //alert(srcName);
    thisMovie(srcName).selectItemByID(id);
}


function setPlayerWidth(playerId, width)
{
    var obj = GetObject(playerId);
    if (obj)
    {
        obj.width = width;
    }
    else
        alert("A lejátszó nem található: " + playerId);

    //alert("Object " + playerId + " width set to " + width);
}

function setStyleWidth(playerId, width)
{
    var obj = GetObject(playerId);
    if (obj)
    {
        obj.style.width = width + "px";
    }
    else
        alert("A lejátszó nem található: " + playerId);
}




