
//<script language="javascript">

// insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement()
// for Netscape 6/Mozilla by Thor Larholm thor@jscript.dk
// Usage: include this code segment at the beginning of your document
// before any other Javascript contents.
var WS;

if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){

	HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode){
	
		switch (where){
			case 'beforeBegin':
				this.parentNode.insertBefore(parsedNode,this)
				break;
			case 'afterBegin':
				this.insertBefore(parsedNode,this.firstChild);
				break;
			case 'beforeEnd':
				this.appendChild(parsedNode);
				break;
			case 'afterEnd':
				if (this.nextSibling) 
					this.parentNode.insertBefore(parsedNode,this.nextSibling);
				else 
					this.parentNode.appendChild(parsedNode);
				break;
		}
		
	}

	HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr)	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}


	HTMLElement.prototype.insertAdjacentText = function (where,txtStr) {
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}

function retreiveXML(src){
	//generieke functie om XML te ontvangen via XMLHTTP
	//xml is resultaat van functie (ongecheckt)
	var xmlhttp;
	
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}

	if(xmlhttp) {
		xmlhttp.open('GET', src, false);
		xmlhttp.send('');
		return xmlhttp.responseText;
	}

}


var ob=null;
var oh=null;
var obm=null;
var ohm=null;
var boolSlides= true;
var cBaseURL='http://v3.quadiatv.com';
var cSession_guid = '{25DA662B-BC10-4D12-A021-3349B7203152}';
var cClient_id = '98';
var arrPlayState=new Array();


arrPlayState[0]='Undefined';
arrPlayState[1]='Stopped';
arrPlayState[2]='Paused';
arrPlayState[3]='Playing';
arrPlayState[4]='ScanForward';
arrPlayState[5]='ScanReverse';
arrPlayState[6]='Buffering';
arrPlayState[7]='Waiting';
arrPlayState[8]='Ended';
arrPlayState[9]='Transitioning';
arrPlayState[10]='Ready';
arrPlayState[11]='Reconnecting';
arrPlayState[12]='Last';

var sPlayState;

var wachttimeout;
var timeoutID;
var timeoutID_cmdPlay;
var timeoutID_showPos;
var timeoutID_playWhenReady;

var sPlaylistItem;
var objPlayer = new Object();

var arrSlider=new Array();

var endform;
var saved_pos;



//dat is slide1, false is slide2

var boolSlide=true;
if (isElement('slide1')) document.getElementById('slide1').src='images/transparent.gif';
if (isElement('slide2')) document.getElementById('slide2').src='images/transparent.gif';
if (isElement('slide1')) document.getElementById('slide1').style.display='block';
//set current slide position
var curChapter=-1;
var curSlide=-1;
var prevSlide=-1;
var curSubtitle=-1;
var curAction=-1;
var prevAction=-1;

//declare variable to keep track of setTimeout function
var timeoutID;
var intervalID;
var boolGo=true;

//set array's
var arrDownload = new Array();
var arrLink = new Array();
var arrSponsoredLink = new Array();
var arrSponsoredDownload = new Array();
var arrSponsoredLogo = new Array();
var arrSponsoredProgram = new Array();
var arrTimer=new Array();
var arrSlide=new Array();
var arrChapter=new Array();
var arrSubtitle=new Array();
var arrContent=new Array();
var arrAction=new Array();
var arrPls=new Array();
var arrPres=new Array();
var arrPresName=new Array();
var arrPresChap=new Array();

var filename;
var curStream;
var curPres;
var pls;
var mplayereventtimeout;
var doeietsgeks;
var prevState;
var originalPlayerStreamHeight;
var originalMplayerHeight;

//FUNCTIONS

function alerter(blaf){
    if(document.getElementById('chapterlist'))
    {
        document.getElementById('chapterlist').innerHTML = blaf;    
    }
   // document.getElementById('contactbuttons').innerHTML = blaf;
}

function alerter2(blaf){
    if(document.getElementById('downL'))
    {
        document.getElementById('downL').innerHTML += blaf;    
    }
}

//START CONSTRUCTORS
    function set_arrTimer(arr) {
	    arrTimer=arr;
    }

    function set_endform(end) {
    
	    endform=end;
    }
     function set_endform(end) {
	    endform=end;
    }
    function set_arrDownload(dl) {
	    arrDownload=dl;
    }
    function set_arrLink(link) {
	    arrLink=link;
    }
    
    function set_arrSponsoredLink(splink) {
	    arrSponsoredLink=splink;
    }
    function set_arrSponsoredDownload(spdownload) {
	    arrSponsoredDownload=spdownload;
    }
    function set_arrSponsoredLogo(splogo) {
	    arrSponsoredLogo=splogo;
    }
    function set_arrSponsoredProgram(spprogram) {
	    arrSponsoredProgram=spprogram;
    }
    
    function set_arrChapter(arr) {
	    arrChapter=arr;
    }

    function set_arrSlide(arr) {
	    arrSlide=arr;
    }

    function set_arrSubtitle(arr) {
	    arrSubtitle=arr;
    }
    function set_arrAction(arr) {
        
	    arrAction=arr;
    }

    function set_arrPls(arr) {
	    arrPls=arr;
    }

    function set_arrPres(arr) {
	    arrPres=arr;
    }

    function set_arrPresName(arr) {
	    arrPresName=arr;
    }

    function set_filename(fn) {
	    filename=fn;
    }

    function set_curStream(sid) {
	    curStream=sid;
    }

    function set_curPres(sid) {
	    curPres=sid;
    }

    function set_pls(sid) {
	    pls=sid;
    }
//END CONSTRUCTORS

function checkObject(obj){

	if (!obj) {
	    return false;
	}
	
	if (obj.id == undefined) {
	    return false;
	}
	
	return true;
}

//START CONTROLS

    function playWhenReady(){
    //wait for movie to be loaded

	if ( (objPlayer.fgetPlayState()==0) || (objPlayer.fgetPlayState()==10) || (objPlayer.fgetPlayState() == 1) || (objPlayer.fgetPlayState() == 3) ){
	    window.clearTimeout(timeoutID_playWhenReady);
		cmdPlay();
		//objPlayer.fPlay();
		showTime();
	}
	else{	
	 	timeoutID_playWhenReady = window.setTimeout('playWhenReady();', 200);
	 	}
    }

    function cmdPlay(){
	if(!checkObject(objPlayer)) return false;
	
	
	objPlayer.fPlay();

	   if (objPlayer.fgetPlayState() != 3 ){
		setHTML('streamDuration','buffering...');
		timeoutID_cmdPlay=setTimeout('cmdPlay();',1000);
	    }
	    else{
		    window.clearTimeout(timeoutID_cmdPlay);	
		    closeFrame();
		    showSlides();
		    showTime();	
		    boolGo = true;
	    }
	    return false;
    }
    
    function cmdStop(){
	if(!checkObject(objPlayer)) return false;
	window.clearTimeout(timeoutID);	
	objPlayer.fStop();  
	return false;
    }
    
    function cmdPause(){
    
	if(!checkObject(objPlayer)) return false;
		
	    objPlayer.fPause();
	    
	    if(arguments.length >0){
		    var a = arguments[0];
		    if(a >0){
		    
			    setHTML('streamDuration',arrPlayState[2] + ' ('+showTimer(a)+')');
			    setTimeout('cmdPause('+ (a-1) +');',1000);
		    }
		    else
			    cmdPlay();
	    }
	    return false;	
    	
    }


    function cmdVolumeUp(){
		if(!checkObject(objPlayer)) return false;
        var vol = objPlayer.fgetVolume;
	    if (vol < maxVol )
        {
	        objPlayer.fsetVolume = vol + 1;
	    }
	    return false;
    }

    function cmdVolumeDown(){
		if(!checkObject(objPlayer)) return false;
        var vol = objPlayer.fgetVolume;
        if (vol > minVol )
        {
	        objPlayer.fsetVolume = vol - 1;
	    }
	    return false;
    }

    function cmdMute(){
		if(!checkObject(objPlayer)) return false;
	    objPlayer.fsetVolume = 0;
	    
	    return false;
    }
//END CONTROLS


//START CORE
function initPlaylist() {
	if(el=document.getElementById('playlist_list')){
		el.innerHTML='';
		output = '';
		for(var x=0;x < arrPresName.length;x++) {
			output += '<a href="Javascript:gotoPls('+x+');" id="playlist_item_'+x+'"><span>'+arrPresName[x][0]+'</span></a>';
			// show chapterlist with active playlist, only if chapterlist is not elsewhere.
			if((x==curPres) && null==(el2=document.getElementById('chapterlist')) ) output += '<div id="chapterlist"></div>';
		}
		el.innerHTML=output; 
	}
}

function gotoPls(x) {
	curPres=x;
	loadPres(x);
	initPlaylist(); 
}


    function loadStream(sid) {
    
		filename=null;
	    //showState('loadStream('+sid+')');
	    var script;
	    var scriptTag = document.getElementById('preso');
	    var head = document.getElementById('scriptblock')
	    if(scriptTag) head.removeChild(scriptTag);
	    script = document.createElement('script');
	    script.src = cBaseURL+'/pres/preso.js.asp?p='+pls+'&ps='+arrPls[curStream]+'&website_id=257&pres_guid={1D51E82F-7F41-4C8A-A879-3D0B34122FC9}';
	    script.type = 'text/javascript';
	    script.id = 'preso';
	    head.appendChild(script)
	    
		setTimeout('doeInit();',500);
	    setPls();
    }
	function loadPres(sid) {
		var script;
		var scriptTag = document.getElementById('pls');
		var head = document.getElementById('scriptblock')
		if(scriptTag) head.removeChild(scriptTag);
		script = document.createElement('script');
		script.src = cBaseURL+'/pres/playlist.js.asp?'+arrPres[sid];
		script.type = 'text/javascript';
		script.id = 'preso';
		head.appendChild(script)
    }
    
    function doeInit() {

        if(isElement('mplayer') ){
			
           if (Use_plugin =='QT'){
                objPlayer = document.getElementById('mplayer');
		        objPlayer.fPause = qt_Pause;
		        objPlayer.fStop = qt_Stop;
		        objPlayer.fgetCurrentPosition = qt_getCurrentPosition;
		        objPlayer.fsetCurrentPosition = qt_setCurrentPosition;
		        objPlayer.fgetPlayState = qt_getPlayState;
		        objPlayer.fgetDuration = qt_getDuration;
		        objPlayer.fPlay = qt_Play;
		        objPlayer.fsetVolume = qt_setVolume;
		        objPlayer.fgetVolume = qt_getVolume;
		        objPlayer.fsetURL = qt_setURL;	 
            }
           else if (Use_plugin =='WM')        {
				
                objPlayer = document.getElementById('mplayer');
				//objPlayer.URL = filename.toString();
			objPlayer.fPause = wm_Pause;
		        objPlayer.fStop = wm_Stop;
		        objPlayer.fgetCurrentPosition = wm_getCurrentPosition;
		        objPlayer.fsetCurrentPosition = wm_setCurrentPosition;
		        objPlayer.fgetPlayState = wm_getPlayState;
		        objPlayer.fgetDuration = wm_getDuration;
		        objPlayer.fPlay = wm_Play;
		        objPlayer.fsetVolume = wm_setVolume;
		        objPlayer.fgetVolume = wm_getVolume;
		        objPlayer.fsetURL = wm_setURL;	
		        
		        
		        //alert(objPlayer.fgetPlayState());
			}
           else if (Use_plugin =='FL')        {
                objPlayer = document.getElementById('mplayer');
		        objPlayer.fPause = fl4_Pause;
		        objPlayer.fStop = fl4_Stop;
		        objPlayer.fgetCurrentPosition = fl4_getCurrentPosition;
		        objPlayer.fsetCurrentPosition = fl4_setCurrentPosition;
		        objPlayer.fgetPlayState = fl4_getPlayState;
		        objPlayer.fgetDuration = fl4_getDuration;
		        objPlayer.fPlay = fl4_Play;
		        objPlayer.fsetVolume = fl4_setVolume;
		        objPlayer.fgetVolume = fl4_getVolume;
		        objPlayer.fsetURL = fl4_setURL;	 
			addListeners();
            }  			
            else if (Use_plugin =='WMX')        {
                objPlayer = document.getElementById('mplayer');
		        objPlayer.fPause = wm_Pause;
		        objPlayer.fStop = wm_Stop;
		        objPlayer.fgetCurrentPosition = wm_getCurrentPosition;
		        objPlayer.fsetCurrentPosition = wm_setCurrentPosition;
		        objPlayer.fgetPlayState = wm_getPlayState;
		        objPlayer.fgetDuration = wm_getDuration;
		        objPlayer.fPlay = wm_Play;
		        objPlayer.fsetVolume = wm_setVolume;
		        objPlayer.fgetVolume = wm_getVolume;
		        objPlayer.fsetURL = wm_setURL;	  

            }  
            //alerter2("init");
            //if (objPlayer.fgetPlayState() != 10)
            //{
            //        setTimeout('doeInit()',1000);
            //        alerter2(".");
            //        
            //}

			//alert(document.getElementById('mplayer').src);
		    setHTML('streamDuration',arrPlayState[objPlayer.fgetPlayState()]);
		    
	    
            boolGo=true;
            boolSlide=true;
            
           
            
            curChapter=-1;
            curSlide=-1;
            curSubtitle=-1;
            curAction=-1;
            
            
            //init
           
            initDownloads();
            initLinks();
            initSponsored();
            initPlaylist();
            initChapter();           
            initSlides();            
            initSlider();      	 
			
			
			//run al content
			showPos(); 
			 
			//play
			
            playWhenReady();   
            	
	    }
	    else {
			
			setTimeout('doeInit()',1000);
		}
    }
    

	   
    function setPos(){
        
        if (objPlayer) {
            
            //reset
            curChapter = -1; 
            prevSlide = curSlide;
            curSlide = -1;
            curSubtitle = -1
            
            var curMediaPos = objPlayer.fgetCurrentPosition();      
            var i;
            
            //get chapter
            i=0;
		for(i=0;i<arrChapter.length;i++){
			if(curMediaPos >= arrChapter[i][0]){    
				curChapter = i;     
			}                          
		}

         //   for (i in arrChapter){
         //       if(curMediaPos >= arrChapter[i][0]){    
         //           curChapter = i;     
         //       }                          
         //   }
            
            //get Slide
            i=0;
            for (i=0;i<arrSlide.length;i++){
                if(curMediaPos >= arrSlide[i][0]){    
                  curSlide = i; 
                   //alerter(  curSlide);        
                }                            
            }
   //         for (i in arrSlide){
   //             if(curMediaPos >= arrSlide[i][0]){    
   //               curSlide = i; 
   //                //alerter(  curSlide);        
   //             }                            
   //         }
            
            //get subtitle
            i=0;
           for (i=0;i<arrSubtitle.length;i++){
                if(curMediaPos >= arrSubtitle[i][0]){    
                    curSubtitle = i;           
                }                            
            }           
//            for (i in arrSubtitle){
//               if(curMediaPos >= arrSubtitle[i][0]){    
//                    curSubtitle = i;           
//                }                            
//            }                 
        }             
    }
    
    function log_time_OUD(media_pos)
    {
        var xmlScript = cBaseURL + '/pres/logger.asp?website_id=257&pres_id=4611&pls_id='+ pls + '&pls_stream_id=' + arrPls[curStream] + '&curpos=' + media_pos
        //alerter(xmlScript);
        if (window.ActiveXObject){
		    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		    xmlDoc.async=false;
		    xmlDoc.load(xmlScript);
	    }
	    else if (document.implementation && document.implementation.createDocument){
		    //laad xml text via Parser object
		    var theXML=retreiveXML(xmlScript);
		    var oParser=new DOMParser();
		    xmlDoc=oParser.parseFromString(theXML, "text/xml");
	    }
    }

    function log_time(media_pos){
	if (media_pos!='-1') {
		var media_duration = fl4_duration;
		
		var nameOffset=navigator.userAgent.lastIndexOf(' ')+1;
		var verOffset=navigator.userAgent.lastIndexOf('/');
		var browser = navigator.userAgent.substring(nameOffset,verOffset)  
        	var xmlScript = cBaseURL + '/pres/logger.asp?session_id=31201932&contact_id=&website_id=257&pres_id=4611&pls_id='+ pls + '&pls_stream_id=' + arrPls[curStream] + '&curpos=' + media_pos +'&browser='+browser+'&duration=' + media_duration;
		//alerter2(xmlScript);
		//alert(browser);
		if(browser =='Safari'){
			    xmlDocLog = false;	
			    // branch for native XMLHttpRequest object
			    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    		        try {
				        xmlDocLog = new XMLHttpRequest();
			        } catch(e) {
				        xmlDocLog = false;
			        }
			    // branch for IE/Windows ActiveX version
			    } else if(window.ActiveXObject) {
			    
       		        try {
				        xmlDocLog = new ActiveXObject("Msxml2.XMLHTTP");
      		        } catch(e) {
				        try {
			  		        xmlDocLog = new ActiveXObject("Microsoft.XMLHTTP");
				        } catch(e) {
			  		        xmlDocLog = false;
				        }
			        }
			    }    
			   
			    if(xmlDocLog) {
			        xmlDocLog.onreadystatechange = processReqChangeLog;
			        var now = new Date();
			        xmlDocLog.open("GET", xmlScript, true);
			        xmlDocLog.send(null);     
			    }
			}
			else if (document.implementation && document.implementation.createDocument){
			    xmlDocLog = document.implementation.createDocument("", "", null);
			    xmlDocLog.load(xmlScript);	

			}
			else if (window.ActiveXObject){
	   
			    browser = "IE"
			    var xmlScript = cBaseURL + '/pres/logger.asp?session_id=31201932&contact_id=&website_id=257&pres_id=4611&pls_id='+ pls + '&pls_stream_id=' + arrPls[curStream] + '&curpos=' + media_pos +'&browser='+browser+'&duration=' + media_duration;
			    xmlDocLog = new ActiveXObject("Microsoft.XMLDOM");
			    xmlDocLog.load(xmlScript);
			}
			else{
			    alert('Your browser can\'t handle this log script');
			    return;
			}
    	}
    }
    
    function processReqChange() {
        // only if req shows "loaded"
        if (xmlDoc.readyState == 4) {
       
            // only if "OK"
            if (xmlDoc.status == 200) {        
               // setTimeout('setValues()',1000);
            } else {
                alert("There was a problem retrieving the XML data:\n" +
                xmlDoc.statusText);
            }
        }
    }                           
    
	
    function processReqChangeLog() {
        // only if req shows "loaded"
        if (xmlDocLog.readyState == 4) {
       
            // only if "OK"
            if (xmlDocLog.status == 200) {        
              //  setTimeout('setValues()',1000);
            } else {
                alert("There was a problem retrieving the XML data:\n" +
                xmlDocLog.statusText);
            }
        }
    }                           
    
    function showPos(){
 	    if (objPlayer) {
 
		    if ( boolGo && objPlayer.fgetPlayState()!=0 && objPlayer.fgetPlayState() !=10 && objPlayer.fgetPlayState() !=7){	
		    //alerter(mplayer.currentMedia.duration + '-'+ mplayer.controls.currentPosition);	
		        var curMediaPos= objPlayer.fgetCurrentPosition();
    		    
		        if (objPlayer.fgetPlayState()==3) {
		        
		            //log player
		            if (curMediaPos % 5 == 0 && saved_pos != curMediaPos)
		            {
		                log_time(curMediaPos); 
		                saved_pos = curMediaPos;        
		            }	        
		            
		            //set position
    		        setPos();
		            	
		            //Chapters        
		            setChapter(curChapter);		            
    		        
		            //Slides             
		            setSlide();	             
		            
		            //Subtitle    		            
		            setSubtitle();           
    		        
		            //Action
		            setAction();  
		                		        
		            //Slider		
				    dur=parseInt(objPlayer.fgetDuration());	
				    			 
				    if(!sl_clickstate){
				        if(isElement('streamDuration')) document.getElementById('streamDuration').innerHTML=showTimer(dur-curMediaPos); 
				    }				

                    if(isElement('slider_jquery'))
                    {
                        slider_jquery_setpos(curMediaPos);
                    }

				    if(isElement('player_slider')){
				    		
					    if (!sl_clickstate){
					        
					        if(isElement('player_slider_knob')){
								//[Call 7452][ORIG][START]
								//document.getElementById('player_slider_knob').style.left = parseInt(((sl_sl-22)/100) * ((100/dur)*curMediaPos)-4) + 'px';
								//[Call 7452][ORIG][END]
								//[Call 7452][NEW][START]
								var intPixelValue;
								intPixelValue = parseInt(((sl_sl-22)/100) * ((100/dur)*curMediaPos)-4)
								if(isNumeric(intPixelValue)){
									if (intPixelValue >= 0){
										//alert(parseInt(intPixelValue + 'px'));	//[Call 7452][TEST]
										document.getElementById('player_slider_knob').style.left = intPixelValue + 'px';
									}
								}
								//[Call 7452][NEW][END]
							}
				        }						
				    }
				    
				    //Debug info
				    if (document.getElementById('debug')) {
						document.getElementById('debug').innerHTML='Mediapos: '+curMediaPos+'<br>Active slideholder: '+ slideHolder();
						document.getElementById('debug').innerHTML+='<br>Chapter '+curChapter+' displayed';
						document.getElementById('debug').innerHTML+='<br>subtitle '+curSubtitle+' displayed';
						document.getElementById('debug').innerHTML+='<br>slide '+curSlide+' displayed';
						document.getElementById('debug').innerHTML+='<br>action '+curAction+' displayed';
					}	
							    
			    }
			    else
			    {
			        
			        if (objPlayer.fgetPlayState()==8) {
			            //alert('bla');
			            nextStream();
			           
			        }
			    }
			    
		    }	
	    }
	    else
	    {
	        if (document.getElementById('debug')) document.getElementById('debug').innerHTML='niets';
	    }
    	
	    timeoutID_showPos=setTimeout('showPos();', 500);
    }
    
    function initDownloads(){
         if(isElement('downloads') ){
            document.getElementById('downloads').innerHTML = '';
          //  var i=0;
          //  for (i in arrDownload){
          //      document.getElementById('downloads').innerHTML +='<a target=dl href=/scripts/dlproxy.asp?t=d&m='+ arrDownload[i][0] +'>'+ arrDownload[i][3] +'</a>';        
	  //	
          //  } 
		for(var i=0;i < arrDownload.length;i++){
          		document.getElementById('downloads').innerHTML +='<a target=dl href=/scripts/dlproxy.asp?t=d&m='+ arrDownload[i][0] +'>'+ arrDownload[i][3] +'</a>';        
		}
            
            if (document.getElementById('downloads').innerHTML==''){
                document.getElementById('downloads').innerHTML += 'Geen downloads beschikbaar';    
            
            }           
         }       
    }
    
    function initLinks(){
         if(isElement('links') ){
            document.getElementById('links').innerHTML = '';
        //   var i=0;
        //    for (i in arrLink){
		for(var i=0;i <arrLink.length;i++){
			document.getElementById('links').innerHTML +='<a href="/pres/disclaimer.asp?id='+arrLink[i][0]+'&mediaid='+arrLink[i][1]+'" target=hyperlinks>'+arrLink[i][2]+'</a>';        
		} 
            
            if (document.getElementById('links').innerHTML==''){
                document.getElementById('links').innerHTML += 'Geen links beschikbaar';    
            
            }           
         } 
    }
    
     function initSponsored(){
         if(isElement('sponsoredlinks') ){
            document.getElementById('sponsoredlinks').innerHTML = '';
          //  var i=0;
          //  for (i in arrSponsoredLink){
		for(var i=0;i <arrSponsoredLink.length;i++){
                document.getElementById('sponsoredlinks').innerHTML +='<a href="/pres/disclaimer.asp?mediaid='+arrSponsoredLink[i][0]+'&t=sponsoredlink" target=sponsoredhyperlinks>'+arrSponsoredLink[i][1]+'</a>';        
            }         
         } 
         if(isElement('sponsoreddownload') ){
            document.getElementById('sponsoreddownload').innerHTML = '';  
            //i=0;
            //for (i in arrSponsoredDownload){
		for (var i=0;i < arrSponsoredDownload.length;i++){
                document.getElementById('sponsoreddownload').innerHTML +='<img src="'+cBaseURL+'/images/fileext/'+ arrSponsoredDownload[i][2] +'.gif" valign=baseline>&nbsp;&nbsp;<a target=dl class=linkstyle href=/scripts/dlproxy.asp?t=sponsoreddownload&m='+ arrSponsoredDownload[i][0] +'>'+ arrSponsoredDownload[i][1] +'</a><br>';        
            }        
         }
         if(isElement('sponsoredlogo') ){
            document.getElementById('sponsoredlogo').innerHTML = '';  
        // var   i=0;
        //    for (i in arrSponsoredLogo){
		for (var i=0;i < arrSponsoredLogo.length;i++){
                document.getElementById('sponsoredlogo').innerHTML +='<a class=linkstyle href="/pres/disclaimer.asp?mediaid='+arrSponsoredLogo[i][0]+'&t=sponsoredlogo" target=sponsoredhyperlinks><img border=0 src="/scripts/dlproxy.asp?t=d&m='+ arrSponsoredLogo[i][0]+'"></a>';        
            }        
         }
         if(isElement('sponsoredprogram') ){
            document.getElementById('sponsoredprogram').innerHTML = '';  
        //    var i=0;
        //   for (i in arrSponsoredProgram){
		for(var i=0;i < arrSponsoredProgram;i++){
                document.getElementById('sponsoredprogram').innerHTML +='<img src="images/bullet.gif">&nbsp;&nbsp;<a class=linkstyle href="/scripts/dlproxy.asp?t=sponsoredprogram&m='+arrSponsoredProgram[i][0]+'">'+arrSponsoredProgram[i][1]+'</a><br>';        
            }         
         }
          if(isElement('sponsoredback') ){
            document.getElementById('sponsoredback').innerHTML = '';  
            var back = '';
            if (back != '' && back != '{1D51E82F-7F41-4C8A-A879-3D0B34122FC9}'){                
                document.getElementById('sponsoredback').innerHTML = '<a href=/pres/?p='+back+'>&nbsp;</a>'; 
            
            }        
         }
         
        
    }
    
    
    function initSlides(){
        if (document.getElementById('player_content')) {  
            document.getElementById('player_content').innerHTML = '<div id=slidetable><div id=slide1 style="display:none;width:100%;height:100%;"></div><div id=slide2 style="display:none;width:100%;height:100%;"></div></div><iframe src=/pres/empty.asp class=content_iframe id=content_iframe ALLOWTRANSPARENCY="true" style="display:none;border:none;width:100%;height:100%" border=0 frameborder=0></iframe>'
            
            if(arrSlide[curSlide + 1])
            {
               // document.getElementById("chapter").innerHTML ='<br>'+ curSlide + ' load in: '+ slideHolder()+ ' slide: ' + arrSlide[curSlide+1]; 		              
                preload(slideHolder(), curSlide + 1);
            } 
        }  
        
           
    }
    
    function slideHolder(){
	    if (boolSlide)
		    return 'slide1';
	    else
		    return 'slide2';
    }

    function preload(slideholder, pos) {
        if (arrSlide.length > 0){
	        if (arrSlide[pos][1] == 1){
    	        
	            //document.getElementById(slideholder).innerHTML = '<a href="#" onClick="return false;"><img src="http://v3.quadiatv.com/scripts/contentproxy.asp?t=c&m=' + arrSlide[pos][2] + '&s='+ cSession_guid +'&c='+ cClient_id +'&p='+pls+'&ps='+arrPls[curStream] +' "></a>' ; 
	            document.getElementById(slideholder).innerHTML = '<img src="http://v3.quadiatv.com/scripts/contentproxy.asp?t=c&m=' + arrSlide[pos][2] + '&s='+ cSession_guid +'&c='+ cClient_id +'&p='+pls+'&ps='+arrPls[curStream] +' ">' ;
	        }
	        else if(arrSlide[pos][1] == 9){
	            var shtml;
	            shtml  = arrSlide[pos][3];
	            shtml = shtml.replace('\\','');
	            document.getElementById(slideholder).innerHTML = '<img src="http://v3.quadiatv.com/scripts/contentproxy.asp?t=html&m=' + arrSlide[pos][2] + '&s='+ cSession_guid +'&c='+ cClient_id +'&p='+pls+'&ps='+arrPls[curStream] +'" style="display:hidden;" >' + shtml;     
	        }
	    }	    
    }
    
    function setSlide(){
	curSlide = parseInt(curSlide)
 	if (curSlide != prevSlide){	  
		if((curSlide - prevSlide) == 1){
			//next slide
			if(document.getElementById(slideHolder())){   
    		            
    		            
    		            
    		                if (curSlide == 0){
    		                    document.getElementById(slideHolder()).style.display = 'block';
    		                    boolSlide = !boolSlide;
    		                    if(arrSlide[curSlide+1]){
    		                        //document.getElementById("chapter").innerHTML +='<br>'+ curSlide + ' preload in: '+ slideHolder()+ ' slide: ' + arrSlide[curSlide + 1]; 		              
    		                        preload(slideHolder(), curSlide+1); 
    		                    }
    		                    boolSlide = !boolSlide;  
    		                    
    		                }
    		                else{
    		                    document.getElementById(slideHolder()).style.display = 'none';
    		                    if(arrSlide[curSlide+1]){
    		                        preload(slideHolder(), curSlide+1); 
    		                        //document.getElementById("chapter").innerHTML +='<br>'+ curSlide + ' preload in: '+ slideHolder()+ ' slide: ' + arrSlide[curSlide + 1]; 		               
		                            
		                        }
		                        boolSlide = !boolSlide;
		                        document.getElementById(slideHolder()).style.display = 'block';
    		                }
    		                
    		                
		                    
		                    
		                    if (document.getElementById('slidetitle')) 
		                        document.getElementById('slidetitle').innerHTML= arrSlide[curSlide][4];
    		                    
		                    
		                    if (document.getElementById('debug')) document.getElementById('debug').innerHTML+='<br>'+arrSlide[curSlide+1]+' preloaded';	
		                
		           }
		       
		    }
		    else
		    {
		        if(document.getElementById(slideHolder())){   
		            //hide all
		            document.getElementById(slideHolder()).style.display = 'none';
		            boolSlide = !boolSlide;
		            document.getElementById(slideHolder()).style.display = 'none';
		            
		            if (document.getElementById('slidetitle')) 
		                    document.getElementById('slidetitle').innerHTML='';
    		                    
		             //load current slide
		             //document.getElementById("chapter").innerHTML += '<br>terug' + curSlide; 	
		             if(arrSlide[curSlide]){
		                preload(slideHolder(), curSlide);
		                //document.getElementById("chapter").innerHTML +='<br>'+ curSlide + ' load in: '+ slideHolder()+ ' slide: ' + arrSlide[curSlide];
		                document.getElementById(slideHolder()).style.display = 'block';
		                boolSlide = !boolSlide;	
		                
		                if (document.getElementById('slidetitle')) 
		                    document.getElementById('slidetitle').innerHTML= arrSlide[curSlide][4];	                    
		             }   
		             else if(curSlide + 1 == 0) {
		                preload(slideHolder(), curSlide+1);
		                //document.getElementById("chapter").innerHTML +='<br>'+ curSlide + ' load in: '+ slideHolder()+ ' slide: ' + arrSlide[curSlide+1];
		                //document.getElementById(slideHolder()).style.display = 'block';
		                boolSlide = !boolSlide;	
		             }
    		                    
		             //load next slide
		             if(arrSlide[curSlide+1]){
		             //document.getElementById("chapter").innerHTML +='<br>b'+ curSlide + ' preload in: '+ slideHolder() + ' slide: ' + arrSlide[curSlide+1];
		                preload(slideHolder(), curSlide+1); 
		                boolSlide = !boolSlide;	
		                if (document.getElementById('debug')) document.getElementById('debug').innerHTML+='<br>'+arrSlide[curSlide+1]+' preloaded';		                 
		            } 
		        }  		        
		    }
		     
		}            
    }
    
    function setSubtitle(){
        if (document.getElementById('subtitle')){
		    if(curSubtitle >= 0){
		        document.getElementById('subtitle').innerHTML = arrSubtitle[curSubtitle][1];
		    }
		    else{
		        document.getElementById('subtitle').innerHTML = '';
		    }		                
		}    
    }
    
    function setAction(){  
    
        var curMediaPos= objPlayer.fgetCurrentPosition();
        curAction = -1;
        var i=0;
	for (i=0;i<arrAction.length;i++){
       		// for (i in arrAction){
            if(curMediaPos == arrAction[i][0]){    
                curAction = i;           
            }                                        
         }
         
         if(arrAction[prevAction]){ 
         var tmp = parseInt(arrAction[prevAction][0]) + 1;             
                if(parseInt(tmp) == curMediaPos)
                {
                    prevAction=-1;
                }
        }
        
        if(arrAction[curAction]){            
            if (curAction != prevAction){
                prevAction = curAction;
   		          
		        if(arrAction[curAction][1]=='pause'){
		            if(arrAction[curAction][2] ==''){
		                cmdPause();
		            }
		            else
		            {
		                cmdPause(arrAction[curAction][2]);    
		            }
		        }
		        else if(arrAction[curAction][1]=='stop'){
		            cmdStop();
		        }
		        		        
		    }
        }
          
    }

    function initSlider(){
        if(document.getElementById('player_slider')){
	        showSlider();
			document.getElementById('player_slider').style.visibility = 'visible';
			if(document.getElementById('player_slider_bg')){	 
			    document.getElementById('player_slider_bg').style.width = (parseInt(document.getElementById('player_slider').style.width) - 14) + 'px';
			    sl_sl = parseInt(document.getElementById('player_slider_bg').style.width);
			}
		}
    }
    
    function initChapter(){
        if (arrChapter.length)
        {
            if (document.getElementById('chapter')) document.getElementById('chapter').style.display='block';
        }
    
	    if (document.getElementById('chapterlist')) {
	        document.getElementById('chapterlist').innerHTML = '';
	        if (arrChapter.length >0){
		        for (var i=0; i<arrChapter.length; i++) {		
		            if(document.getElementById('chapterlist')) document.getElementById('chapterlist').innerHTML+='<table cellpadding=0 cellspacing=0><tr><td class=chapterbullet valign=baseline><img src=images/bullet.gif>&nbsp;&nbsp;</td><td valign=baseline><span style="" id="c'+i+'"><a class=linkstyle href="javascript:nextChapter('+i+');">'+arrChapter[i][1]+'</a></span></td></tr></table>';	
		        }
	        }
	    }
	    
    	if (document.getElementById('chapterlist1')) {
	        document.getElementById('chapterlist1').innerHTML = '';
	       // if (arrChapter.length >0){
				
				for (var y=0; y<arrPresName.length; y++){
					if (arrPresName[y][2] == arrPls[curStream])
						document.getElementById('chapterlist1').innerHTML+= '<b><a class=linkstyle href="javascript:setStream('+y+');">'+arrPresName[y][1]+'</a></b><br>';
					else
						document.getElementById('chapterlist1').innerHTML+= '<a class=linkstyle href="javascript:setStream('+y+');">'+arrPresName[y][1]+'</a><br>';
					
					if (arrPresName[y][2] == arrPls[curStream]) {
			        for (var i=0; i<arrChapter.length; i++) {		
			            if(document.getElementById('chapterlist1')) 
							document.getElementById('chapterlist1').innerHTML+='<table cellpadding=0 cellspacing=0><tr><td class=chapterbullet valign=baseline><img src=images/bullet.gif>&nbsp;&nbsp;</td><td valign=baseline><span style="" id="c'+i+'"><a class=linkstyle href="javascript:nextChapter('+i+');">'+arrChapter[i][1]+'</a></span></td></tr></table>';	
			        }
					}
			    }
			//}
	    }
	     if (document.getElementById('chapterlistH')) {
	     document.getElementById('chapterlistH').innerHTML = '';
		    var content = "";
		    content+='<ul id=chapterul><li id=chaptitle></li><li id=chapstart></li>'
    		if (arrChapter.length >0){
		        for (var i=0; i<arrChapter.length; i++) {
		            if(document.getElementById('chapterlistH')) content+='<li class=chap id="c'+i+'"><a class=linkstyle href="javascript:nextChapter('+i+');">'+arrChapter[i][1]+'</a></li>';
		        }
		    }
		    content+='<li id=chapend></li></ul>';
		    document.getElementById('chapterlistH').innerHTML = content;
	    } 
	   
    }
    
    function setChapter(curChapter){
        if (document.getElementById('chapterlist') || document.getElementById('chapterlist1')) {
			if(document.getElementById('chapterlist')){
				var arrEl=document.getElementById('chapterlist').getElementsByTagName('SPAN');
			}
			else {
				var arrEl=document.getElementById('chapterlist1').getElementsByTagName('SPAN');
			}
		    if (curChapter>=0){    			
				    
				    for (var i=0; i<arrEl.length; i++) {
					    if( (arrEl[i].id=='c'+curChapter) || (arrEl[i].id=='cs'+curChapter)) {
						    arrEl[i].style.fontWeight='bold';
						    arrEl[i].className = 'chapterActive';
						   // arrEl[i].scrollIntoView(false);
					    } 
					    else{
						    arrEl[i].className = 'chapterInactive';
						    arrEl[i].style.fontWeight='normal';
						}
    					
				    }
    			
		    }
		    else{
		            for (var i=0; i<arrEl.length; i++) {
						    arrEl[i].className = 'chapterInactive';
						    arrEl[i].style.fontWeight='normal';
				    }				    
		    }
	    }
    	
	     if (document.getElementById('chapterlistH')) {
	        var arrEl=document.getElementById('chapterlistH').getElementsByTagName('LI');
	        
		    if (curChapter>=0){				    
				    for (var i=0; i<arrEl.length; i++) {
					    if( (arrEl[i].id=='c'+curChapter) || (arrEl[i].id=='cs'+curChapter)) {
						    arrEl[i].style.fontWeight='bold';
						    arrEl[i].className = 'chapterActive';
						    //arrEl[i].scrollIntoView(false);
					    } 
					    else{
						    arrEl[i].className = 'chapterInactive';
						    arrEl[i].style.fontWeight='normal';
					    }
    					
				    }
    			
		    }
		    else{
		            for (var i=0; i<arrEl.length; i++) {
						    arrEl[i].className = 'chapterInactive';
						    arrEl[i].style.fontWeight='normal';
				    }				    
		    }
	    }
	   	
    }
    
    function nextChapter(newPos) {
    
    
	    showPlayerState(3);
	    boolGo=false;
        
	    if(document.getElementById('streamDuration')) document.getElementById('streamDuration').innerHTML='Bezig met laden';
        
	    objPlayer.fsetCurrentPosition(parseInt(arrChapter[newPos][0]));
	    
	    curChapter = newPos;
	    setChapter(newPos);

        
	    objPlayer.fPlay();
	    closeFrame();
	    setTimeout('boolGo=true;', 500);
	    showSlides();
    }

    function clearChapter() {
	    if (document.getElementById('chapterlist')) document.getElementById('chapterlist').innerHTML='';
    	
	    if (document.getElementById('chapterlistH')) document.getElementById('chapterlistH').innerHTML='';
    }
    
     function showTime(){
		
	    var i;
	    i = parseInt(objPlayer.fgetCurrentPosition());
	    f = parseInt(objPlayer.fgetDuration())-i;
	    if(arrSlider[i]){
		    setHTML('player_content',arrSlider[i][0]);
		    eval(arrSlider[i][2]);
		    if (objPlayer.fgetPlayState()==2){
		    objPlayer.fsetCurrentPosition(i+1);}	
		    setHTML('slidetitle',arrSlider[i][1]);
	    }
	    if(objPlayer.fgetPlayState()!=3){
	    setHTML('streamDuration',arrPlayState[objPlayer.fgetPlayState()]);

		    if(arrPls){
		        if (objPlayer.fgetPlayState()==8 && sPlaylistItem < arrPls.length-1 ){ 
			        setPlaylistItem();
		        }
		    }
		    window.clearTimeout(timeoutID);
	    }
	    else{
		    setHTML('streamDuration',showTimer(f));
    		
	    }
	    if(objPlayer.fgetPlayState()!=2){
		    timeoutID=setTimeout('showTime();', 1000);}
   
    }
    
    function showTimer(sec){
	    niets='0';
	    h=Math.floor(sec/3600);
	    sec%=3600;
	    m=Math.floor(sec/60);
	    s=sec%60;
	    if (h<10) h=niets.concat(h);
	    if (m<10 && h!='00') m=niets.concat(m);
	    if (s<10) s=niets.concat(s);
	    if (h=='00')
		    return m+':'+s
	    else
		    return   h+':'+m+':'+s;
    }

    function nextPres() {
    
        clearTimeout(timeoutID_showPos);
        clearTimeout(wachttimeout);
        clearTimeout(timeoutID);
        clearTimeout(timeoutID_cmdPlay);
    
	    if (arrPres[curPres+1]) {
		    curPres++;
		    loadPres(curPres);
	    } 
	    else {
	    //alert('bla');
		    endPres();
		    
		   // alert(endform);
		    //check if there is a evaluation
		    if (endform == 1){
		        showContent(cBaseURL+'/pres/evaluation.asp?t=p&l=1');
		    }
			else if(endform==2){
				showContent(cBaseURL+'/pres/evaluation_tmp.asp?t=p&l=1');
			}
	    }
	    
	    
	    
    }
    
    function endPres(){
    
	    boolGo=false;

        //clear all timeouts
        clearTimeout(timeoutID_showPos);
        clearTimeout(wachttimeout);
        clearTimeout(timeoutID);
        clearTimeout(timeoutID_cmdPlay);

   
        if(document.getElementById(slideHolder())){
         
            preload(slideHolder(), arrSlide.length-1);
	        document.getElementById(slideHolder()).style.display = 'block';
	        boolSlide = !boolSlide;	
	        document.getElementById(slideHolder()).style.display = 'none';	        
        }
	    	               
	    
	    //set 100%
	    log_time(-100);
    }

function setStream(cs) {
		
	    if (arrPresName.length > cs) {
			   clearTimeout(timeoutID);
		    boolGo=false;
		    clearTimeout(timeoutID);
		    curStream = cs;
		   loadStream(curStream);
			initPls();
			
	    } 
   }
    
    function nextStream() {
    
	    if (arrPls[curStream+1]) {
		    initPls();
		    clearTimeout(timeoutID);
		    boolGo=false;
		    clearTimeout(timeoutID);
		    curStream++;
		    loadStream(curStream);
	    } 
	    else
	    {
	    
		    nextPres();
		    
		    
		}
    }

    function prevStream() {
	    if (arrPls[curStream-1]) {
		    clearTimeout(timeoutID);
		    boolGo=false;
		    curStream--;
		    loadStream(curStream);
	    } 
    }   

    function initPls(){
	    if (document.getElementById('streamtitle')) document.getElementById('streamtitle').innerHTML='&nbsp;';
	    if (document.getElementById('slidetitle')) document.getElementById('slidetitle').innerHTML='&nbsp;';
	    if (document.getElementById('plslist')) {
		    clearPls();
		    var prescnt=0;
		    for (var i=0; i<arrPresName.length; i++){
			    if (arrPresName[i][0]) {
				     document.getElementById('plslist').innerHTML+='<span style="" id="pl'+arrPresName[i][2]+'">'+arrPresName[i][0]+'</span><br>';
				     document.getElementById('plslist').innerHTML+='<span style="" id="p'+arrPresName[i][2]+'">&nbsp;&nbsp;&nbsp;&nbsp;'+arrPresName[i][1]+'</span><br>';
				     prescnt++;
			    }
			    else document.getElementById('plslist').innerHTML+='<span style="" id="p'+arrPresName[i][2]+'">&nbsp;&nbsp;&nbsp;&nbsp;'+arrPresName[i][1]+'</span><br>';
		    }
	    }
    }

    function setPls() {
	    if (document.getElementById('streamtitle')){
		    for (var i=0; i<arrPresName.length; i++){
			    if (arrPresName[i][2]==arrPls[curStream]){
				    if (arrPresName[i][4].length>0)	
					    document.getElementById('streamtitle').innerHTML= arrPresName[i][4]+' - '+arrPresName[i][5];
				    else 
					    document.getElementById('streamtitle').innerHTML=arrPresName[i][1];
			    }
		    }
	    }
    }

    function clearPls() {
	    if (document.getElementById('plslist')) document.getElementById('plslist').innerHTML='';
    }
//END CORE



// temp functies voor elearning test
    function response3(){
	    showContent(cBaseURL+'/pres/evaluation_tmp.asp?formtype=response');
	    return false;
    }
    function openResponse3(title){   
	    showContent(cBaseURL+'/pres/evaluation_tmp.asp?formtype=response&title='+title);	    
	    return false;
    }
    function openEvaluation3(title){
	    showContent(cBaseURL+'/pres/evaluation_tmp.asp?formtype=evaluation&title='+title);	     
	    return false;
    }
    
    function openEvaluation_id3(id){
    
	    showContent(cBaseURL+'/pres/evaluation_tmp.asp?formtype=evaluation&eval_id='+id);
	return false;
}

    function evaluation3(){
	    showContent(cBaseURL+'/pres/evaluation_tmp.asp?formtype=evaluation');
	    return false;
    }
// temp functies

//START EXTRA
    function getURL(url) {
	    window.location.href = url;
	    return false;
    }	

    function cmdFullscreen(){
	    document.mplayer.fullScreen = true;
	    return false;
    }

    function response(){
	    showContent(cBaseURL+'/pres/evaluation.asp?t=r');
	    return false;
    }
    function openResponse(title){   
	    showContent(cBaseURL+'/pres/evaluation.asp?t=r&title='+title);	    
	    return false;
    }
    function openEvaluation(title){
	    showContent(cBaseURL+'/pres/evaluation.asp?t=e&title='+title);	     
	    return false;
    }
    
    function openEvaluation_id(id){
    
	showContent(cBaseURL+'/pres/evaluation.asp?t=p&eval_id='+id);
	return false;
}

    function evaluation(){
	    showContent(cBaseURL+'/pres/evaluation.asp?t=e');
	    return false;
    }
    function openForm(typename){
	    if(typename == 'assessment')
		    showContent(cBaseURL+'/pres/assessment.asp');
	    if(typename == 'response')
		    showContent(cBaseURL+'/pres/evaluation.asp?t=r');
	    if(typename == 'evaluation')
		    showContent(cBaseURL+'/pres/evaluation.asp?t=e');
	    return false;
    }
    function qPortal(){
	    document.location.href= '/pres/?nav=portal';
	    return false;
    }
    function openPortal(){
	    document.location.href= '/pres/?nav=portal';
	    return false;
    }
    function openAssessment(){
	    document.location.href= '/pres/?nav=assessment';
	    return false;
    }
    
    function openPreAssessment(){
	    document.location.href= '/pres/?nav=preassessment';
	    return false;
    }
    
    function openSlideIndex(){
	    if(!document.getElementById('dSlideIndex')){
		    var psw,psh,nod;
		    psw = document.getElementById('player_content').offsetWidth;
		    psh = document.getElementById('player_content').offsetHeight;
		    nod = document.createElement("DIV");
		    nod.id = 'dSlideIndex';
		    nod.style.position = 'absolute';
		    nod.style.height=psh;
		    nod.style.width=psw;
		    nod.style.zIndex = 1000;
		    frm=document.createElement("IFRAME");
		    frm.id='dSlideIndex_iframe';
		    frm.style.width=psw;
		    frm.style.height=psh;
		    frm.frameBorder = 0;
    		
		    nod.appendChild(frm); 
		    document.getElementById('player_content').insertAdjacentElement('afterBegin',nod);
	    }
	    else
	    {
	        closeIndexFrame();
	        return false;
	    }
	    document.getElementById('dSlideIndex_iframe').src = '/pres/slide_index.asp?cur_stream='+arrPls[curStream];
	    return false;
	}
	
	function closeIndexFrame(){
	    var oChild=document.getElementById('dSlideIndex')
   	    document.getElementById('player_content').removeChild(oChild);
	    return false;
    }
	
	   	
    function downloads(){
	    showContent(cBaseURL+'/pres/downloads.asp?show=1');
    }
    function hyperlinks(){
	    showContent(cBaseURL+'/pres/downloads.asp?show=2');
    }
    function openProfile(){
	    document.location.href = '/pres/?nav=profile';
	    return false;
    }
    function contactform(){
	    showContent(cBaseURL+'/pres/contact.asp');
	    return false;
    }
    function openHelp(){
	    window.open(cBaseURL+'/template/help/index.html','helpwindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,copyhistory=yes,width=840,height=770');
	    return false;
    }
    function openChat(){
		    window.open(cBaseURL+'/template/chat/login.asp','chatwindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,copyhistory=yes,width=600,height=410');
	    return false;
    }
    function openContact(typename){
	    if(typename == 'friend')
		    showContent(cBaseURL+'/pres/friend.asp');
	    else
		    showContent(cBaseURL+'/pres/contact.asp?type='+typename);
	    return false;
    }
    function contactEditor(){
	    showContent(cBaseURL+'/pres/contact.asp?type=editor');
	    return false;
    }
    function contactSpeaker(){
	    showContent(cBaseURL+'/pres/contact.asp?type=speaker');
	    return false;
    }
    function openFrame(pagename){
	    showContent(pagename);
	    return false;
    }
    function closeFrame(){
		var objX = document;
		if(self.opener == undefined){
			if(!document.getElementById('content_iframe')){
				return false; // 'oplossing' voor iframesetje.
			}
		}
		else{
			objX = parent.document;	
		}
	    if( !boolSlides) {
	        if(objX.getElementById('player_content')) {
	            var height = objX.getElementById('player_content').offsetHeight;
	            var width = objX.getElementById('player_content').offsetWidth;
	            objX.getElementById('player_content').style.display='none';
				objX.getElementById('player_stream').style.height = height+'px';
	            if(originalMplayerHeight > 0){
					
					objX.getElementById('mplayer').style.height = originalMplayerHeight+'px';	            
	            }
				else
					objX.getElementById('mplayer').style.height = height+'px';
	            
				
					
//				parent.document.getElementById('player_stream').style.display = 'block';
//				parent.document.getElementById('mplayer').style.display = 'block';
	        }
	    }    	
	    if(objX.getElementById('mplayer')){
		    if(objX.getElementById('player_content')&& boolSlides) objX.getElementById('player_content').style.display='block'; 
		    if(objX.getElementById('player_stream')) objX.getElementById('player_stream').style.display='block';
		    if(objX.getElementById('mplayer')){
				if(objPlayer.fgetCurrentPosition() >= 0 && objPlayer.fgetPlayState() == 2){
					cmdPlay();
				}    
			}			
			else {
			    endPres();
				showSlides();
			}
		}
		else {
			document.getElementById('player_content').innerHTML = '<img src=images/intro.gif>';
		}
		return false;
    }
    function contactformPortal(){
	    if (document.getElementById('player_content'))
		    document.getElementById('player_content').innerHTML ='<iframe leftmargin=0 topmargin=0 frameborder=0 width=100% height=100% src='+cBaseURL+'/pres/contact.asp?p=1></iframe>';
	    return false;
    }
    function about(){
	    showContent('about.html');
	    return false;
    }
    function helpPortal(){
	    if (document.getElementById('player_content'))
		    document.getElementById('player_content').innerHTML ='<iframe leftmargin=0 style="margin:0px" topmargin=0 frameborder=0 width=448 height=336 src=portal_help.html></iframe>';
	    return false;
    }
    function helpPres(){
	    showContent('presentation_help.html');
	    return false;
    }
    function info(){
	    showContent(cBaseURL+'/pres/info.asp');
    }

    function showContent(url){
   
	    if (!document.getElementById('player_content')){

		    boolSlides=false;
		     
		    if (doeietsgeks=='undefined' || doeietsgeks==undefined) doeietsgeks=true;           
            
		    if(document.getElementById('player_stream')){
		    
		    //alert('test geen content');
			    var psw,psh,nod;
			    psw = document.getElementById('player_stream').offsetWidth;
			    psh = document.getElementById('player_stream').offsetHeight;
				originalPlayerStreamHeight = psh;
				if(document.getElementById('mplayer')){
					originalMplayerHeight = document.getElementById('mplayer').offsetHeight;
					originalPlayerStreamHeight = psh;
				}
			    nod = document.createElement("DIV");
			    nod.id = 'player_content';
			    //nod.style.position = 'relative';
			    //nod.style.border = 'none';
				nod.style.height=psh+'px';
			    if(fl4_ready) nod.style.height=(psh+20)+'px';
			    nod.style.width=psw+'px';
			    nod.style.backgroundColor='black';
				
			    frm=document.createElement("IFRAME");
			    frm.id='content_iframe';
			    frm.style.width=psw+'px';
				frm.style.height=psh+'px';
			    if(fl4_ready) frm.style.height=(psh+20)+'px';
			    frm.style.display='none';
			    frm.style.backgroundColor='white';
    			frm.style.border='0px none #990000';
    			frm.setAttribute('frameborder',0);
    			
			    nod.appendChild(frm); 
		//	   if(document.all){
			   // {  alert('click to continue');
		//	        document.getElementById('player_stream').insertAdjacentElement('beforeBegin',nod);			        
		//	   }
		//	   else{
			   
			   // if(!document.all){ 
			        document.getElementById('player_stream').insertBefore(nod,document.getElementById('mplayer'));	
	    //    }
			   // }			    
			   // else
			   // {  alert('click to continue');
			   //     document.getElementById('player_stream').insertAdjacentElement('beforeBegin',nod);			        
			   // }
			    
			    

		    }	
		    else{
			    var psw,psh,nod;
			    psw = 400;
			    psh = 300;
			    nod = document.createElement("DIV");
			    nod.id = 'player_content';
			    nod.style.position = 'relative';
			    nod.style.height=psh+'px';
				nod.style.width=psw+'px';
			    nod.style.backgroundColor='white';

			    frm=document.createElement("IFRAME");
			    frm.id='content_iframe';
			    frm.style.width=psw+'px';
			    frm.style.height=psh+'px';
				//frm.style.height = (psh+90)+'px';

			    frm.style.display='none';
			    frm.style.backgroundColor='white';
    			nod.appendChild(frm); 
			    document.getElementById('layer1').insertAdjacentElement('beforeEnd',nod);
				
		    }	
    	
	    }else if (doeietsgeks=='undefined' || doeietsgeks==undefined) doeietsgeks=false; 
	   
	    if (WS){boolSlides=false;doeietsgeks=true;}

	    if (document.getElementById('player_content')){
	     
    		
		    document.getElementById('player_content').style.display = 'block';
		    if (document.getElementById('mplayer')){
    		
			    if(!boolSlides) 
				    if(document.all && doeietsgeks) {
						if (!fl4_ready)
						document.getElementById('player_stream').style.display = 'none';
						//document.getElementById('player_stream').style.visibility = 'hidden';
						}
    			

			    boolGo=false;
			    cmdPause();
			    
			    if (document.getElementById('slidetable')) document.getElementById('slidetable').style.display='none';
			    if (document.getElementById('dSlideIndex_iframe')) document.getElementById('dSlideIndex_iframe').style.display='none';
			    
			    
			    if (document.getElementById('content_iframe')){
				    document.getElementById('content_iframe').style.display='block';
					
					if(doeietsgeks){
				    //if ((!document.all) && doeietsgeks) {
					    //if (!oh) oh=document.getElementById('mplayer').currentMedia.imageSourceHeight;
					    //if (!ohm) ohm=document.getElementById('mplayer').currentMedia.imageSourceHeight;
					    //if (!ob) ob=document.getElementById('mplayer').currentMedia.imageSourceWidth;
					    //if (!obm) obm=document.getElementById('mplayer').currentMedia.imageSourceWidth;
					   
					    if (!oh) oh=psh;
					    if (!ohm) ohm=psh;
					    if (!ob) ob=psw;
					    if (!obm) obm=psw;

					    document.getElementById('player_stream').style.height='1px';
					    document.getElementById('mplayer').style.height='1px';
					   // document.getElementById('mplayer').style.display = 'none';

					    //alert(document.getElementById('player_stream').innerHTML);	
					    document.getElementById('player_content').style.width=ob+'px';
					    document.getElementById('player_content').style.height=oh+'px';
					    document.getElementById('content_iframe').style.width=ob+'px';
					    document.getElementById('content_iframe').style.height=oh+'px';
				    }
			    }
			    
			    document.getElementById('content_iframe').src = url;
			    
			    //setTimeout('cmdPause();', 1000);

		    }
		    else{
		    
			    if (doeietsgeks){
    //				alert('hier2');
				    document.getElementById('player_content').style.position='absolute';
				    document.getElementById('player_content').style.top='100px';
				    document.getElementById('player_content').style.left='200px';
				    document.getElementById('player_content').style.width='auto';
				    document.getElementById('player_content').style.height='auto';
				    document.getElementById('player_content').style.border='solid';
				    document.getElementById('player_content').style.borderColor='black';
				    document.getElementById('player_content').style.borderWidth='1px';
			    }
			    document.getElementById('player_content').innerHTML ='<iframe leftmargin=0 style="margin:0px" topmargin=0 frameborder=0 width=448 height=336 src='+url+'></iframe>';
		    }
		    
	    } else {
	    
		   // if(!document.all){ 
		    
			    if(confirm('Klik op OK om een nieuw venster te openen.')) {
				    bla=window.open(url,'ext','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,copyhistory=yes,width=840,height=770');
				
				    setTimeout('cmdPause();', 1000);
					
				    return false;
			    }
		    //}
			//else alert('hee');
	    }
    }
//END EXTRA
	

//MORE




function showSlides(){
	
	if (document.getElementById('slidetable')) {
	    if(document.getElementById('player_content')) document.getElementById('player_content').style.display='block'; 
	}

	if (document.getElementById('slidetable')) document.getElementById('slidetable').style.display='block';
	if (document.getElementById('content_iframe')) document.getElementById('content_iframe').style.display='none';
	if(WS && document.getElementById('player_content') && document.getElementById('player_stream')) {
		document.getElementById('player_content').style.display='none';
		document.getElementById('player_stream').style.display='block';
	}
}
	

function showHiddenContent(url){
	if (document.getElementById('player_content'))
		if (document.getElementById('content_iframe')) document.getElementById('content_iframe').src = url;
}

function isElement(elmt){
	if(document.getElementById(elmt)) 
		return true;
	else return false;
}

function setHTML(elmt,val){
	var objElmt = document.getElementById(elmt);
	if(isElement(elmt)){
		objElmt.innerHTML = val;
		return true;
	}
	else return false;
}

function showState(newstate) {
	if (document.getElementById("curChapter")) document.getElementById("curChapter").innerHTML = newstate+"<br>"+document.getElementById("curChapter").innerHTML;
}

function showPlayerState(NewState)
	{
	if(document.getElementById('streamDuration')) document.getElementById('streamDuration').innerHTML='Video is loading';
	if(document.getElementById('streamDuration'))
		switch (NewState){
			case 1:
				document.getElementById('streamDuration').innerHTML='Stopped';
				break;
			case 2:
				document.getElementById('streamDuration').innerHTML='Pauseds';
				break;
			case 8:
				document.getElementById('streamDuration').innerHTML='Ready';
				break;
			case 10:
				document.getElementById('streamDuration').innerHTML='Ready';
				break;
		}
//	if(document.getElementById('streamDuration') && document.mplayer)
		//if (document.mplayer.currentMedia.duration > 0) document.getElementById('streamDuration').innerHTML = document.mplayer.currentMedia.durationString;
//		if (document.mplayer.currentMedia.duration > 0) document.getElementById('streamDuration').innerHTML = 'Even wachten, Nico!';						
	if (document.getElementById('slidetitle')){ 
		if (NewState==3) 
			if (arrChapter[curChapter]) showState('chap: '+arrChapter[curChapter]);
		else {
			if(document.getElementById('streamDuration'))
				document.getElementById('streamDuration').innerHTML=arrPlayState[NewState];
		}
	}
}

function mpFlipOn(theno){
	return;
	if (theno ==1){
		document.getElementById('mp2').style.display = 'block';
		document.getElementById('mp1').style.display = 'none';
	}
	else{
		document.getElementById('mp2').style.display = 'none';
		document.getElementById('mp1').style.display = 'block';
	}
}

function doPSC(NewState,posi) {
	mplayereventtimeout=null;
	//showPlayerState(NewState);;
	showState(NewState);;
	switch (NewState){
		case 1:
			clearTimeout(wachttimeout);
			if (boolGo) {
				boolGo=false;
				showState('next');
				nextStream();
			}
	    		break;

		case 2:
			break;

		case 3:
			prevState=3;
			boolGo=true;
			break;

		case 6:
			boolGo=false;
			break;

		case 7:
			break;

		case 8:
			break;

		case 9:
			break;

		case 10:
/*
			if (boolGo && (prevState==3)) {
				prevState=0;
				boolGo=false;
				showState('next');
				nextStream();
			}
			break;
*/
		default:
		
	}	   
}

function MaximizeWindow() {
	/***********************************************
	* Auto Maximize Window Script- © Dynamic Drive (www.dynamicdrive.com)
	* This notice must stay intact for use
	* Visit http://www.dynamicdrive.com/ for this script and 100's more.
	***********************************************/

	top.window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return parseInt(curleft);
}




//////////////////////////////////////////////////////////END

function showPos2(){
	if (objPlayer) {

		if ( boolGo && objPlayer.fgetPlayState()!=0 && objPlayer.fgetPlayState() !=10){
			if (objPlayer) {
				curMediaPos=new String(objPlayer.fgetCurrentPosition());
				
				
				
				
				if ( curMediaPos.indexOf('.')>0 )
					curMediaPos=curMediaPos.substring(0, curMediaPos.indexOf('.'));
				//if (document.getElementById('controltimedisp')) document.getElementById('controltimedisp').innerHTML=showTimer(curMediaPos);
				if ( (objPlayer.fgetCurrentPosition()>=arrTimer[curChapter+1]) && arrTimer[curChapter+1]) {
					while (objPlayer.fgetCurrentPosition()>=arrTimer[curChapter+1]) curChapter++;
					if (document.getElementById(slideHolder())) document.getElementById(slideHolder()).style.display='block';
					if (document.getElementById('subtitle')) document.getElementById('subtitle').innerHTML = arrSubtitle[curChapter];
					if (document.getElementById('debug')) {
						document.getElementById('debug').innerHTML='Mediapos: '+curMediaPos+', next: '+arrTimer[curChapter+1]+'<br>Active slideholder: '+ slideHolder();
						document.getElementById('debug').innerHTML+='<br>'+arrSlide[curChapter]+' displayed';
					}
					boolSlide= !boolSlide;
					if (document.getElementById(slideHolder())) document.getElementById(slideHolder()).style.display='none';				
					if (arrSlide[curChapter+1]) {
						preload(slideHolder(), curChapter+1);
						if (document.getElementById('debug')) document.getElementById('debug').innerHTML+='<br>'+arrSlide[curChapter+1]+' preloaded';
					}
					setChapter(curChapter);			
				} 
				else {  
					if ( curChapter>=0 ){
						if  (objPlayer.fgetCurrentPosition()<arrTimer[curChapter]) {
							if (document.getElementById('debug')) document.getElementById('debug').innerHTML='';
							while(objPlayer.fgetCurrentPosition()<arrTimer[curChapter]  ) {
								curChapter--;
								if (document.getElementById('debug')) document.getElementById('debug').innerHTML+='back!';
							} 		
							if (curChapter>=0) curChapter--;			
							preload(slideHolder(),curChapter+1);
						}
					}
				}
			}
			if (objPlayer.fgetPlayState()==3) {
			
				 dur=parseInt(objPlayer.fgetDuration());
				 
				if(!sl_clickstate){document.getElementById('streamDuration').innerHTML=showTimer(dur-curMediaPos);}
				
				if(document.getElementById('player_slider')){
                    
					if (!sl_clickstate){
					    if(document.getElementById('player_slider_knob')){
						    document.getElementById('player_slider_knob').style.posLeft = ((sl_sl-22)/100) * ((100/dur)*curMediaPos)-4;
						}
				    }
						
				}
			}
		}
		else 
		
			if (document.getElementById('debug')) document.getElementById('debug').innerHTML='niets';
	}
	timeoutID=setTimeout('showPos();', 500);
}






































///////////////////////////////////////////////////////////////////////////////niet meer nodig?

function setvol(what){
	var vol_step = 20;

	if (objPlayer){
		var vol_curr = parseInt(objPlayer.fgetVolume());
		if(what == 'up')
			objPlayer.fsetVolume(vol_curr + vol_step);
		
		if(what == 'down')
			objPlayer.fsetVolume(vol_curr - vol_step);
	}
	return false;
}
		
function setvols(what){
	var arrvol=new Array(1,20,40,60,80,99);
	if (objPlayer){
		var theVol = parseInt(objPlayer.fgetVolume());
		for(i=1;i<5;i++){
				document.getElementById('txt_thanks').innerHTML += arrvol[i+what];

			if ( (theVol<=arrvol[i]) && (theVol >= arrvol[i-1])){
				document.getElementById('txt_thanks').innerHTML = theVol;
				
					
					objPlayer.fsetVolume(parseInt(arrvol[i+what]));
					//if((i+what)<6 && document.getElementById('snd_volume')) document.getElementById('snd_volume').src='/images/snd_volume'+(i+what)+'.gif';
				
			
			}
			else {
				objPlayer.fsetVolume(1);
					//document.getElementById('txt_thanks').innerHTML = 'pweeepp';

			}
		}
	}
	
	return false;
}	


function PlayPauseControl(elmt,picPlay,picPause){

	if(boolGo) {
		Pause();
		elmt.src=picPlay;}
	else{
		Play();
		elmt.src=picPause;}
	return false;
}

function PlayControl(){
	Play();
	return false;
	}

function PauseControl(){
	Pause();
	return false;
	}

function Play(){
	if(document.getElementById('player_stream') && !boolSlides){
		document.getElementById('player_stream').style.display='block';
		if (oh) document.getElementById('player_stream').style.height=oh;
//		if (ob) document.getElementById('player_stream').style.width=ob;
		if (ohm) document.getElementById('mplayer').style.height=oh;
//		if (obm) document.getElementById('mplayer').style.width=ob;
		if (obm) document.mplayer.stretchToFit=true;

		document.getElementById('player_content').style.display='none';
	}

	showSlides();
	document.mplayer.controls.play();
	boolGo=true;
	showPos();
	}

function Pause(){
	boolGo=false;
	document.mplayer.controls.pause();
}

function Stop(){
	boolGo=false;
	curChapter=-1;
	document.mplayer.controls.stop();
	document.mplayer.controls.CurrentPosition=0;
}

function zetFilmpje(fn) {
	//showState('Filmstring: '+fn);
	strfn=new String(fn);
	fnlog=new String(strfn.substring(0, strfn.indexOf('|')));
	fnstream=new String(strfn.substring(fnlog.length+1, strfn.length));
	
	//showState('Videostring: '+fnstream);
	//showState('Logstring: '+fnlog);
	//showHiddenContent(fnlog);
	if (isElement('mplayer')) {
		//document.mplayer.URL=fnstream.toString();
		//document.mplayer.uiMode = 'none';
		//document.mplayer.windowlessVideo=true;
		//alert(fnstream);
		objPlayer.fsetURL(fnstream);
	}
	return true;
	//showSlides();
}

 



function nextChapterEx() {
	if (arrTimer[curChapter+1]) {
		curChapter++;
		nextChapter(curChapter);
	}
}

function prevChapterEx() {
	if (arrTimer[curChapter-1])  {
		curChapter--;
		nextChapter(curChapter);
	}
}

function showTime2(sec){
	niets='0';
	h=Math.floor(sec/3600);
	sec%=3600;
	m=Math.floor(sec/60);
	s=sec%60;
	if (h<10) h=niets.concat(h);
	if (m<10 && h!='00') m=niets.concat(m);
	if (s<10) s=niets.concat(s);
	if (h=='00')
		return m+':'+s
	else
		return h+':'+m+':'+s;
}

function initChapter2(){
//alert('toet');
	var stmp;
	var xa;
	stmp = '<table border=0>';
	for(i=0;i<arrChapter.length;i++){
		xa = arrChapter[i][0];
		stmp +='<tr><td><a href=# id=chap'+ i +' onClick="setChapter(this,'+xa+');">'+ arrChapter[i][1] + '</a></td></tr>';}
	stmp += '</table>';
	setHTML('chapterlist',stmp);
	return true;
}

//[Call 7452]
function isNumeric(input){
   return (input - 0) == input && input.length > 0;
}


