

function get_mediainfo(mediainfoIndex) {
    switch (mediainfoIndex) {  
      


        case 0:
	        return  { "mediaUrl": "Simon Guest Keynote.wmv",
	                  "placeholderImage": "Simon Guest Keynote_Thumb.jpg",
	                  "chapters": [    
                        	            { "title": "Introduction",   "time": 0,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.00.00.jpg"} ,    
                        	            { "title": "Framework",   "time": 486.415344,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.08.06.4153440.jpg"} ,    
                        	            { "title": "Personas",   "time": 631.1187023,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.10.31.1187023.jpg"} ,    
                        	            { "title": "Purpose",   "time": 1073.7370742,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.17.53.7370742.jpg"} ,    
                        	            { "title": "Preference",   "time": 1455.8995172,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.24.15.8995172.jpg"} ,    
                        	            { "title": "Platform",   "time": 1936.7805844,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.32.16.7805844.jpg"} ,    
                        	            { "title": "Productivity",   "time": 2625.8848828,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.43.45.8848828.jpg"} ,    
                        	            { "title": "Performance",   "time": 2989.9316903,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.49.49.9316903.jpg"} ,    
                        	            { "title": "Proven",   "time": 3363.1493572,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.56.03.1493572.jpg"} ,    
                        	            { "title": "People",   "time": 3563.1008762,     "imageUrl": "Simon Guest Keynote_MarkerThumb 00.59.23.1008762.jpg"} ,    
                        	            { "title": "Proactive",   "time": 3733.780804,     "imageUrl": "Simon Guest Keynote_MarkerThumb 01.02.13.7808040.jpg"} ,    
                        	            { "title": "Conclusion",   "time": 3887.4120293,     "imageUrl": "Simon Guest Keynote_MarkerThumb 01.04.47.4120293.jpg"}  	          
	                              ] };            	                      	                      
	                      
        default:
             throw Error.invalidOperation("No such mediainfo");
     }
}

function StartWithParent(parentId, appId) {
    new StartPlayer_0(parentId);
}

function StartPlayer_0(parentId) {
    this._hostname = Sys.Preview.UI.Xaml.DomElement.getUniqueName("xamlHost");
    Sys.Silverlight.createObjectEx( { source: 'player.xaml', 
					                  parentElement: $get(parentId ||"divPlayer_0"), 
					                  id:this._hostname, 
					                  properties:{ width:'100%', height:'100%', version:'0.9' }, 
					                  events:{ onLoad:Function.createDelegate(this, this._handleLoad) } } );
    this._currentMediainfo = 0;      
}
StartPlayer_0.prototype= {
	_handleLoad: function() {
	    this._player = $create(   ExtendedPlayer.Player, 
	                              { // properties
	                                rootElement : $get(this._hostname).content.findName('Main'),
	                                autoPlay    : false, 
	                                volume      : 1.0,
	                                muted       : false,
	                                startTime   : 0.0,	                            	                          
	                                loopCount   : 1,
	                                autoScale   : true                          	                            	                        
	                              }, 
	                              { // event handlers
	                                stateChanged: Function.createDelegate(this, this._onStateChanged)
	                              },
	                              null, $get(this._hostname)  ); 
	    this._playNextVideo(); 	
	},
	
	_onStateChanged: function(sender, eventArgs) {
		if (eventArgs.get_currentState() === "Stopped")
			window.setTimeout( Function.createDelegate(this, this._playNextVideo), 2000);
	},
	
	_playNextVideo: function() {
	    var cVideos = 1;
	    if (this._currentMediainfo<cVideos)
	        this._player.set_mediainfo( get_mediainfo( this._currentMediainfo++ ) );    
	}
		
}

	
