var videoPlayer;
var playlist = "";
var debug;
var currentItem = 0;

function setupVideoPlayer(){
    swfobject.flashVars = {};
    swfobject.flashVars.debug = "false";
    
    swfobject.params = {}
    swfobject.params.bgcolor = "#FFFFFF";
    swfobject.params.menu = "false";
    swfobject.params.allowFullScreen = "true";
    swfobject.params.wmode = "transparent";
    swfobject.params.AllowScriptAccess = "sameDomain";
    
    swfobject.attributes = {};
    
    swfobject.embedSWF("../../swfs/SiriusVideoPlayer.swf", "videoPlayer", "547", "395", "9.0.124", "../../swfs/expressinstall.swf", swfobject.flashVars, swfobject.params, swfobject.attributes);
}


playlist += '{';
playlist += '    "playlist": [';
playlist += '        {';
playlist += '            "title": "Small Sins",';
playlist += '            "location": "",';
playlist += '            "date": "Thursday, November 29, 2010",';
playlist += '            "path": "/en/videos/Backstage-SmallSins-Web.f4v",';
playlist += '            "desc": "Small Sins"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Hannah Georgas",';
playlist += '            "location": "",';
playlist += '            "date": "Thursday, October 28, 2010",';
playlist += '            "path": "/en/videos/Backstage-HannahGeorgas-Web.f4v",';
playlist += '            "desc": "Hannah Georgas"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "K-os",';
playlist += '            "location": "",';
playlist += '            "date": "TUESDAY, September 28, 2010",';
playlist += '            "path": "/en/videos/Sirius-Kos-Web.f4v",';
playlist += '            "desc": "K-os"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "DAN MANGAN",';
playlist += '            "location": "",';
playlist += '            "date": "TUESDAY, August 31, 2010",';
playlist += '            "path": "/en/videos/Sirius_Dan_WEB.f4v",';
playlist += '            "desc": "Dan"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "LULU HUGHES",';
playlist += '            "location": "",';
playlist += '            "date": "TUESDAY, August 10, 2010",';
playlist += '            "path": "/en/videos/Lulu-Backstage-Web.f4v",';
playlist += '            "desc": "lulu"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "STARS",';
playlist += '            "location": "",';
playlist += '            "date": "Wednesday, June 30, 2010",';
playlist += '            "path": "/en/videos/Backstage_Stars_Web.f4v",';
playlist += '            "desc": "Stars"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "JUSTIN NOZUKA",';
playlist += '            "location": "",';
playlist += '            "date": "Monday, May 31, 2010",';
playlist += '            "path": "/en/videos/Backstage_Justin_Web.f4v",';
playlist += '            "desc": "JUSTIN NOZUKA"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "JETS OVERHEAD",';
playlist += '            "location": "",';
playlist += '            "date": "Tuesday, May 3, 2010",';
playlist += '            "path": "/en/videos/Sirius_Jets_Web.f4v",';
playlist += '            "desc": "JETS OVERHEAD"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "JULLY BLACK",';
playlist += '            "location": "",';
playlist += '            "date": "Tuesday, March 30, 2010",';
playlist += '            "path": "/en/videos/Sirius_Black_Web.f4v",';
playlist += '            "desc": "JULLY BLACK"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "HAWKSLEY WORKMAN",';
playlist += '            "location": "",';
playlist += '            "date": "Friday, February 26, 2010",';
playlist += '            "path": "/en/videos/Sirius_MARCH_ENG_Workman_Web.f4v",';
playlist += '            "desc": "BASIA BULAT"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "BASIA BULAT",';
playlist += '            "location": "",';
playlist += '            "date": "Friday, January 29, 2010",';
playlist += '            "path": "/en/videos/Sirius_FEB_ENG_Basia_Web.f4v",';
playlist += '            "desc": "BASIA BULAT"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "2010 Preview",';
playlist += '            "location": "",';
playlist += '            "date": "Thursday, December 17, 2009",';
playlist += '            "path": "/en/videos/Sirius_JAN_WEB_ENG.f4v",';
playlist += '            "desc": "2010 Preview"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Jann Arden",';
playlist += '            "location": "",';
playlist += '            "date": "Friday, November 27, 2009",';
playlist += '            "path": "/en/videos/Sirius_DEC_Arden_Web.f4v",';
playlist += '            "desc": "Jann Arden"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Default",';
playlist += '            "location": "",';
playlist += '            "date": "Tuesday, November 10, 2009",';
playlist += '            "path": "/en/videos/Sirius_NOV_Default_Web.f4v",';
playlist += '            "desc": "Default"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Sierra Noble",';
playlist += '            "location": "",';
playlist += '            "date": "Thursday, October 1, 2009",';
playlist += '            "path": "/en/videos/Sirius_Oct_Noble_Web.f4v",';
playlist += '            "desc": "Sierra Noble"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Polaris",';
playlist += '            "location": "",';
playlist += '            "date": "Tuesday, September 1, 2009",';
playlist += '            "path": "/en/videos/Sirius_Polaris_Web_Final.f4v",';
playlist += '            "desc": "Polaris"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Misstress Barbara",';
playlist += '            "location": "",';
playlist += '            "date": "Monday, August 3, 2009",';
playlist += '            "path": "/en/videos/Sirius_MistressBarbara_Web.f4v",';
playlist += '            "desc": "Misstress Barbara"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Alexis on Fire",';
playlist += '            "location": "",';
playlist += '            "date": "Wednesday, July 1, 2009",';
playlist += '            "path": "/en/videos/Sirius_Alexisonfire_Web.f4v",';
playlist += '            "desc": "Alexis on Fire"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Dala",';
playlist += '            "location": "",';
playlist += '            "date": "Thursday, June 4, 2009",';
playlist += '            "path": "/en/videos/Sirius_Dala_Web.f4v",';
playlist += '            "desc": "Dala"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Joel Plaskett",';
playlist += '            "location": "",';
playlist += '            "date": "Wednesday, May 1, 2009",';
playlist += '            "path": "/en/videos/Sirius_Plaskett_Web.f4v",';
playlist += '            "desc": "Joel Plaskett"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Serena Ryder",';
playlist += '            "location": "",';
playlist += '            "date": "Wednesday, April 1, 2009",';
playlist += '            "path": "/en/videos/Serena_Web_Final.f4v",';
playlist += '            "desc": "Serena Ryder"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "2009 Juno Awards Nominees",';
playlist += '            "location": "",';
playlist += '            "date": "Monday, March 2, 2009",';
playlist += '            "path": "/en/videos/Junos_Web_Final.f4v",';
playlist += '            "desc": "2009 Juno Awards Nominees"';
playlist += '        },';
playlist += '        {';
playlist += '            "title": "Sirius Radio",';
playlist += '            "location": "",';
playlist += '            "date": "Monday, September 29, 2009",';
playlist += '            "path": "/en/videos/Woodhands_Long_Final_VP6_512K.flv",';
playlist += '            "desc": "Sirius Radio Description"';
playlist += '        }';
playlist += '    ]';
playlist += '}';


/**
 * initVideoPlayer()
 * Called from SWFObject addLoadEvent()
 *
 * Sets focus to videoPlayer
 * Transmits playlist to videoPlayer
 * (Optional) Display playlist to debug panel
 */
function initVideoPlayer(){
    videoPlayer = document.getElementById("videoPlayer");
    debug = document.getElementById("debug");
    
    //videoPlayer.focus();
    videoPlayer.transmitPlaylist(playlist);
}

/**
 * playVideo()
 * @param int videoId
 *
 * Plays the selected video
 * Transmits videoId to videoPlayer
 */
function playVideo(playlistItem){
    videoPlayer.transmitVideoId(playlistItem);
    //highlightPlaylist(playlistItem);
}

function highlightPlaylist(playlistId){
    var previousItem = currentItem;
    currentItem = playlistId;
    
    var previousTarget = document.getElementById("video_" + previousItem);
    var currentTarget = document.getElementById("video_" + currentItem);
    
    //previousTarget.className = "regular";
    //currentTarget.className = "highlight";
}

