function playVideo(playerName,ti,video){
      
        swfobject.embedSWF("/files/player.swf", playerName, "400", "263", "9.0.0",false,
                {videoPath: video,chaps:ti,player:playerName},
                {wmode:"transparent",quality:"high"},
                {id:playerName,name:playerName}
            );
            var arr=ti.split(",");
    
            
            for(i=parseInt(arr.length);i<6;i++){
        
                //removeElement('chap'+playerName,playerName+'div'+i);
                
            }
    }
     var jsReady = false;
     function isReady() {
         return jsReady;
     }
     function pageInit() {
         jsReady = true;
         document.forms["form1"].output.value += "\n" + "JavaScript is ready.\n";
     }
     function thisMovie(movieName) {
         if (navigator.appName.indexOf("Microsoft") != -1) {
             return window[movieName];
         } else {
             return document[movieName];
         }
     }
     function sendToActionScript(value) {
         thisMovie("flashPlayer").sendToActionScript(value);
     }
     function sendToJavaScript(value) {
         //document.forms["form1"].output.value += "ActionScript says: " + value + "\n";
         alert(value);
     }
     
     function playChapter(value) {
         thisMovie("flashPlayer").skipTo(value);
     }
     
     function activateLink(playerName,index,time) {
         
         $(playerName+"l"+index).set('html', '<a href=javascript:playChapter("'+time+'") >Play Video</a>');
     }
            function removeElement(parentDiv, childDiv){
                 if (childDiv == parentDiv) {
                      alert("The parent div cannot be removed.");
                 }
                 else if (document.getElementById(childDiv)) {     
                      var child = document.getElementById(childDiv);
                      var parent = document.getElementById(parentDiv);
                      parent.removeChild(child);
                 }
                 else {
                      alert("Child div has already been removed or does not exist.");
                      return false;
                
                 }
            }