var et = '1';
var streamid = '1';
var browser=navigator.appName
var reloadpage = '1';
var uptime = '1';

function reload_start() {
c = document.getElementById ('stream');
if (c.playstate == '0' || c.playstate == '1' || c.playstate == '6') {
reloadpage=window.setInterval("setload()",900000)
}
}

function reload_stop(v) {
//window.clearInterval(reloadpage);
clearInterval(reloadpage);
}

function setload() {
window.clearInterval(reloadpage);
top.location.href = "http://www.startkabel.nl/";
}


function streamstatusstop() {

c = document.getElementById ('stream');

if (browser == 'Microsoft Internet Explorer' && c.playstate == '1' || browser == 'Microsoft Internet Explorer' && c.playstate == '0') {
closestream();
hidediv('stream_c1');
hidediv('stream_c2');
hidediv('stream_c3');
hidediv('stream_c5');
document.getElementById('stream_c4').className = '';
document.getElementById('rssv_c4').className = 'v4';
showdiv('rssv_c1');
showdiv('rssv_c2');
showdiv('rssv_c3'); 
} else {
streamstatus2 = setTimeout("streamstatusstop()",3000);
}


}

function streamstatus(to) {

if (browser == 'Microsoft Internet Explorer') {

c = document.getElementById ('stream'); 

if (c.playstate == '2') {

if (to == 'tv') {
showdiv('stream_c2');

d = document.getElementById ('afs');
d.innerHTML = '<a href=\"#\" onclick="javascript: showdiv(\'stream_vak\');streamplay();return false;"><font color=#FFFFFF>Afspelen</font></a>';
showdiv('afs1');
showdiv('pau');

hidediv('stream_c5');
showdiv('stream_c6');
showdiv('stream_vak');
} else {

showdiv('stream_c2');



d = document.getElementById ('afs');
d.innerHTML = '<a href=\"#\" onclick="javascript: streammuteon();return false;"><font color=#FFFFFF>Geluid uit</font></a>';

hidediv('pau');
hidediv('afs1');


d = document.getElementById ('stream_c5');
d.innerHTML = '<object bgcolor=#006698 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="50" width="388" id="radioani"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.startkabel.nl/images/startkabelradio.swf" /><param name="quality" value="high" /><embed src="http://www.startkabel.nl/images/startkabelradio.swf" quality="high" bgcolor="#006698" width="388" height="50" name="radioani" align="top" valign=top allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';


//d.innerHTML = '&nbsp;';

d = document.getElementById ('stream_c5');
d.style.background = "#006698";

showdiv('stream_c5');
showdiv('stream_c6');
hidediv('stream_vak');
}

c.mute = 'false';
streamstatus2 = setTimeout("streamstatusstop()",3000);
} else {
c.mute = 'true';
showdiv('stream_c5');
hidediv('stream_vak');
hidediv('stream_c2');
streamstatus1 = setTimeout("streamstatus(to)",2000);
} 

} else {
hidediv('stream_c5'); 
showdiv('stream_c2')
showdiv('stream_c6');
showdiv('stream_vak');
}

}

function openstream(stream,w,t) {

d = document.getElementById ('stream_c5');
d.innerHTML = '<i><font size=-2>- Bezig met laden..</font></i>';

d = document.getElementById ('stream_c5');
d.style.background = "#ffe1aa";

if (t == 'radio') {
d.innerHTML = '<object bgcolor=#006698 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="50" width="388" id="radioani"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.startkabel.nl/images/radioladen.swf" /><param name="quality" value="high" /><embed src="http://www.startkabel.nl/images/radioladen.swf" quality="high" bgcolor="#006698" width="388" height="50" name="radioani" align="top" valign=top allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
}

if (t == 'tv') {
d.innerHTML = '<object bgcolor=#006698 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="249" width="388" id="tv"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.startkabel.nl/images/tvladen.swf" /><param name="quality" value="high" /><embed src="http://www.startkabel.nl/images/tvladen.swf" quality="high" bgcolor="#006698" width="388" height="50" name="tv" align="top" valign=top allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
}


if (t == 'tv') {

site = stream.split('.');
 
if (site[1] == 'youtube') {
var externplayer = '1';
}

if (site[1] == 'google') {
var externplayer = '1';
}

 
if (site[1] == 'youtube') {

playmovie = stream.split('v=');

d = document.getElementById ('stream_c5');
d.style.background = "#ffe1aa";
d.innerHTML = '<embed src="http://www.youtube.com/v/'+playmovie[1]+'" type="application/x-shockwave-flash" width="401" height="330"></embed>';
showdiv('stream_c1');
showdiv('stream_c5');
showdiv('stream_c3');
hidediv('rssv_c1');
hidediv('rssv_c2');
hidediv('rssv_c3');
}

if (site[1] == 'google') {

playmovie = stream.split('docid=');

alert(playmovie[1]);


d = document.getElementById ('stream_c5');
d.style.background = "#ffe1aa";
d.innerHTML = '<embed style="width:401px; height:280px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId='+playmovie[1]+'"> </embed>';
showdiv('stream_c1');
showdiv('stream_c5');
showdiv('stream_c3');
hidediv('rssv_c1');
hidediv('rssv_c2');
hidediv('rssv_c3');
}
 
 
}

if (externplayer != '1') {

var d = new Date()   
st = d.getTime()     

var startkliks = new Image()
startkliks.src = "http://www.startkabel.nl/js/h.php?&n="+ w +"&st="+ st +"&et="+ et;
//updateplaytime(w);
}

to = t;

reload_stop();
window.clearInterval(uptime); 


if (t == 'radio') {
d = document.getElementById ('stream_c10');
d.innerHTML = '&nbsp;Online radio';
} else {
d = document.getElementById ('stream_c10');
d.innerHTML = '&nbsp;Online televisie';
}


if (externplayer != '1') {
if (browser == 'Microsoft Internet Explorer') {
c = document.getElementById ('stream');
c.stop();
}

showdiv('stream_c5');
hidediv('stream_c2');

streamstatus1 = setTimeout("streamstatus(to)",2000);
	
document.getElementById('stream_c4').className = 'v4tv';
document.getElementById('rssv_c4').className = '';

var browser=navigator.appName

if (browser == 'Microsoft Internet Explorer') {
c = document.getElementById ('stream');
c.autostart = 'true';
c.filename = stream;
} else {
c = document.getElementById ('stream1');
c.src = stream; 
}

hidediv('rssv_c1');
hidediv('rssv_c2');
hidediv('rssv_c3');


showdiv('stream_c1');
showdiv('stream_c3');

et = st;
window.clearInterval(uptime); 
uptime = window.setInterval('updateplaytime("")',10000);
}

}


function updateplaytime(w) {

if (w != '') {
var kliks = new Image()
kliks.src = "http://www.startkabel.nl/js/h.php?&n="+ w +"&st="+ st +"&et="+ et;
//alert('new'+ w);
} else {

c = document.getElementById ('stream_c1');
if (c.style.display == "block") {

var d = new Date()  
st = d.getTime()

var kliks = new Image()
kliks.src = "http://www.startkabel.nl/js/h.php?st="+ st +"&et="+ et;

window.clearInterval(uptime); 
uptime = window.setInterval('updateplaytime("")',10000);
}
}

//alert(kliks.src);

}

function streammuteon() {

d = document.getElementById ('stream_c5');
d.innerHTML = '<object bgcolor=#006698 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="50" width="388" id="radioani"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.startkabel.nl/images/radioanimute.swf" /><param name="quality" value="high" /><embed src="http://www.startkabel.nl/images/radioanimute.swf" quality="high" bgcolor="#006698" width="388" height="50" name="radioani" align="top" valign=top allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

c.mute = 'true';
d = document.getElementById ('afs');
d.innerHTML = '<a href=\"#\" onclick="javascript: streammuteoff();return false;"><font color=#FFFFFF>Geluid aan</font></a>';
}

function streammuteoff() {

d = document.getElementById ('stream_c5');
d.innerHTML = '<object bgcolor=#006698 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="50" width="388" id="radioani"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.startkabel.nl/images/startkabelradio.swf" /><param name="quality" value="high" /><embed src="http://www.startkabel.nl/images/startkabelradio.swf" quality="high" bgcolor="#006698" width="388" height="50" name="radioani" align="top" valign=top allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

c.mute = 'false';
d = document.getElementById ('afs');
d.innerHTML = '<a href=\"#\" onclick="javascript: streammuteon();return false;"><font color=#FFFFFF>Geluid uit</font></a>';
}

function closestream() {

updateplaytime("");
clearTimeout(uptime);


hidediv('stream_c1');
hidediv('stream_c2');
hidediv('stream_c3');
document.getElementById('stream_c4').className = '';
document.getElementById('rssv_c4').className = 'v4';    
showdiv('rssv_c1');
showdiv('rssv_c2');
showdiv('rssv_c3');

}

function streamstop() {

hidediv('stream_c5');
window.clearInterval(streamstatus2);

if (browser == 'Microsoft Internet Explorer') {
stream.stop();
} 

reload_start(); 
}

function streamplay() {
if (browser == 'Microsoft Internet Explorer') {
stream.play();
} 
}

function sk_stream() {


document.write ('<div name=stream_vak id=stream_vak style="visibility:visible;display: block;">');
document.write ('<center>');
document.write ('<OBJECT ID="stream" width=100% height=250 classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"'); 
document.write ('codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902"'); 
document.write ('standby="Loading Microsoft Windows Media Player components..." TYPE="application/x-oleobject">');
document.write ('<PARAM NAME="TransparentatStart" VALUE="1">');
document.write ('<PARAM NAME="AutoStart" VALUE="0">');
document.write ('<PARAM NAME="AnimationatStart" VALUE="0">')   
document.write ('<PARAM NAME="ShowControls" VALUE="0">');
document.write ('<PARAM NAME="displaySize" VALUE="3">');
document.write ('<PARAM NAME="mute" VALUE="1">');
document.write ('<EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"'); 
document.write (' name="stream1" id="stream1"'); 
document.write ('WIDTH="100%" height="250" autostart="1"  EnableContextMenu="0"  ShowControls="0" AnimationAtStart="0"');
document.write ('ShowStatusBar="0" volume="0" displaySize="0">');
document.write ('</EMBED>');
document.write ('</OBJECT>');
document.write ('</center>');
document.write ('</div>');

document.write ('<div name=stream_c6 id=stream_c6 style="visibility:visible;display: none;">');
document.write ('<table cellspacing=0 cellpadding=0 border=0 class=zbt>');
document.write ('<tr>');

document.write ('<td>&nbsp;</td>');
document.write ('<td><div id=afs style="visibility:visible;display: block;"><a href=\"#\" onclick="javascript: showdiv(\'stream_vak\');streamplay();return false;"><font color=#FFFFFF>Afspelen</font></a></div></td>');

document.write ('<td><div id=afs1 style="visibility:visible;display: block;">&nbsp;&nbsp;</div></td>');
document.write ('<td><div id=pau style="visibility:visible;display: block;"><a href=\"#\" onclick="javascript: hidediv(\'stream_vak\');streamstop();return false;"><font color=#FFFFFF>Pause</font></a></div></td>');

document.write ('<td>&nbsp;&nbsp;</td>');
document.write ('<td><a href=\"#\" onclick="javascript: closestream();streamstop();return false;"><font color=#FFFFFF>Stoppen</font></a></td>');    


document.write ('<td>&nbsp;&nbsp;</td>');

document.write ('</tr>');
document.write ('</table>');
document.write ('</div>');

}

function showdiv(id) {
       if (document.getElementById) {
         document.getElementById(id).style.visibility = 'visible';
	 document.getElementById(id).style.display = 'block';
       }   
       else
       {
         if (document.layers) {
         document.id.visibility = 'visible';
	 document.id.display = 'block';        
 }
         else {
         document.all.id.style.visibility = 'visible';
  	document.all.id.style.display = 'block';  
         }
       }
     }

function hidediv(id) {
       if (document.getElementById) {
         document.getElementById(id).style.visibility = 'hidden';
	 document.getElementById(id).style.display = 'none';        
       }
       else
       {
         if (document.layers) {
         document.id.visibility = 'hidden';
 	document.id.display = 'none';
         }
         else {
           document.all.id.style.visibility = 'hidden';
          document.all.id.style.display = 'none';
          
	 } 
       }
     }

/////////////
// Zoeken
/////////////


function zoekb(a) {
d = document.getElementById ('zoekvak');
d.innerHTML = "&nbsp;"+ a.value;
}


function zoekensk(a) {
info = new Array();

//if (window.event.keyCode == '32') {

var q = a.value;
q = q.replace('?','');
q = q.replace('\'s','');                                    


s = new String(q)
r = s.split(" ")

var i = 0;  
while ( i < r.length) {
if (r[i] != '') {
zoekenshow(r[i]);
zoekenshow(r[i]+"en");
 
}
i++;
}


var i = 0;
while ( i < info.length) {
if (info[i] != '') {

if (!p) {
var p = "<a href=http://www.startkabel.nl/zoek/?engine=skpagina&query="+ info[i] +" class=zbl onmouseover=\"window.status='http://"+ info[i] +".startkabel.nl';return true\" onmouseout=\"window.status='';return true\"><i>"+ info[i] +"</i></a></font>&nbsp;";
} else {
var p = p+"<a href=http://www.startkabel.nl/zoek/?engine=skpagina&query="+ info[i] +" class=zbl onmouseover=\"window.status='http://"+ info[i] +".startkabel.nl';return true\" onmouseout=\"window.status='';return true\"><i>"+ info[i] +"</i></a></font>&nbsp;";
}

}   
i++;
}

if (p) {
d = document.getElementById ('tip');
d.innerHTML = "&nbsp;<font size=-2>Relevante onderwerpen:&nbsp;"+ p +"</font>";
} else {
d = document.getElementById ('tip');
d.innerHTML = '&nbsp;<font size=-2>Relevante onderwerpen:&nbsp; <i>niet beschikbaar</i>';
} 

//}

}

function zoekenshow(q) {
var i = 0; 
var pos = -1; 
var found = false;

while ( i < dochters.length && ! found) {
      if (dochters[i] == q ) {
        found = true;
        pos = i;
     } else
        i++;
    }

if (pos != -1 && q != '') {
info.push(q);
}


pos = -1;
}  

function rssk(feed) {
var kliks = new Image()
kliks.src = "http://www.startkabel.nl/js/rss.php?feed="+ feed;
}

function k(u) {
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
u = u.replace('&','*');
var kliks = new Image()
kliks.src = "http://www.startkabel.nl/k.php?url="+ u;
}

function balk(t) {  
var kliks = new Image()
kliks.src = "http://www.startkabel.nl/js/balk.php?type="+ t;
}   



