
var currentPosition=0.0;
var currentRemaining;



      function playerSeek(time) { thisMovie('FlvPlayer').sendEvent('scrub',time/1000.0); }
      function playerTell() { return Math.round(parseFloat(currentPosition)*1000); }
	// these functions are caught by the JavascriptView object of the player.
	  function sendEvent(swf,typ,prm) { 
		  thisMovie(swf).sendEvent(typ,prm); 
		};
	  function getUpdate(typ,pr1,pr2,pid) {

		if (typ == "state" && pr1 == 3) { 
			sndReq(username, course); 
		}
		var tmp = document.getElementById("time"); if (tmp) { tmp.innerHTML = "<b>Time:</b> " + currentPosition + "&nbsp;&nbsp;<b>Remaining:</b> " + currentRemaining; }
		if(typ == "time") { 
            currentPosition = pr1; 
            try { setTime(Math.round(parseFloat(currentPosition)*1000)); } catch (e) {}
			pr2 == undefined ? null: currentRemaining = Math.round(pr2);
        }
        
        if(typ == "state") { currentState = pr1; }
        var tmp = document.getElementById("state"); 
        if (tmp) { 
        	if (currentState == 2) {
        		tmp.innerHTML = "<img src='http://www.cetc-net.com/ptdemo/public/shared/images/pause.png'>";
    		} else if (currentState == 0){
    			tmp.innerHTML = "<img src='http://www.cetc-net.com/ptdemo/public/shared/images/play.png'>";
    		}
        }
        
	};

	// This is a javascript handler for the player and is always needed.

	function thisMovie(movieName) {
	    if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	};

