var videoList = {
    container: "videoList",
    items: [],
    videos: null,
    first: null,
    header: null
}

videoList.init = function(vids){
    this.videos = vids;
    for(var sProp in vids){
        this.items.push(sProp);                
    }
    this.changeVideo(this.items[0]);
}

videoList.changeVideo = function(vid){
    
    var ofr = document.createDocumentFragment();
    var pContainer = document.getElementById(this.container);
    for(var sProp in this.videos){
  
    	var oLi = document.createElement("li");

       if(vid != sProp){
       		if (sProp) {
            var oA = document.createElement("a");
            oA.href = "javascript:videoList.changeVideo('" + sProp + "');";
            oA.appendChild(document.createTextNode(this.videos[sProp]));
            oLi.appendChild(oA);
       		}
       		else {
       		oLi.appendChild(document.createTextNode(this.videos[sProp]));	
       		}
       }
       
       else{
            oLi.appendChild(document.createTextNode(this.videos[sProp]));
            oLi.setAttribute('class', 'active');
            oLi.setAttribute('className', 'active');	
        }
        ofr.appendChild(oLi);
    }

    while(pContainer.hasChildNodes())
        pContainer.removeChild(pContainer.firstChild);

    pContainer.appendChild(ofr);
    
	var flashvars = {
		source: "../videos/" + vid + ".flv",
		color: "CC0000",
		mlc: "/nokia+events/ovi_event/"
	}
	swfobject.embedSWF("swf/flvplayer.swf", "videoPlayer", "480", "360", "9.0.0", "swf/expressInstall.swf", flashvars);
}
