			var http = false;
			if(navigator.appName == "Microsoft Internet Explorer") {
				http = new ActiveXObject("Microsoft.XMLHTTP");
			} else {
				http = new XMLHttpRequest();
			}
			
			var counter = 0;
			
			function loader(){
				var head = document.getElementsByTagName("head").item(0);
    			var script = document.createElement("script");
   				script.setAttribute("type", "text/javascript");
   				script.setAttribute("src", 'http://caro.omroepvoorne.nl/api/apicall.php?station=smartfm&rand=' + (new Date().getTime()));
    			head.appendChild(script);
    			delete head;
    			delete script;
			}
			
        	setInterval("loader()", 30000);
			
			function marquee(){
				counter = counter - 1;
				document.getElementById('marquee').style.left = counter + 'px';
				if(counter < -5040){
					counter = 0;
				}
			}
			
			setInterval("marquee()", 50);
			
			function show_mq_info(artist){
				document.getElementById('mq_info').innerHTML = artist;
				document.getElementById('mq_info').style.display = 'block';
			}
			
			function close_mq_info(){
				document.getElementById('mq_info').style.display = 'none';
			}
			
			function click_mq_info(id){
				show_playlist(id);
			}
			
        	function now_loader(json) {
        		var image 	= "";
        		var url 	= "";
        		var replay 	= "";
        		var sidemenu = "<p><div style=\"width:100%; text-align:right;\"><a href=\"http://caro.omroepvoorne.nl/api/multiplayer.php?station=smartfm\" onClick=\"popUp('http://caro.omroepvoorne.nl/api/multiplayer.php?station=smartfm','800','332'); return false\" class=\"sidemenu\">luister/kijk live &raquo;</a><br><a href=\"http://caro.omroepvoorne.nl/api/playlist.php&station=smartfm\" onClick=\"show_playlist(); return false\" class=\"sidemenu\">playlist &raquo;</a><br><a href=\"http://caro.omroepvoorne.nl/api/schedule.php&station=smartfm\" onClick=\"show_schedule(); return false\" class=\"sidemenu\">programmagids &raquo;</a></div>";
        		
				if(json.replay == '1'){
					replay = ' <span style="color:gray;">(h)</span>';
				}
				document.getElementById('now_name').innerHTML = '<div class="ramp_orange_white"></div>' + json.programma + replay;
				if(json.image != null){
					image = '<img src="' + json.image + '" style="margin:0px 5px 0px 5px; width:75px; cursor:pointer;" align="left" onClick="show_info_ply_fast(' + json.artist_id + ');">';
				}else{
					image = '<img src="http://caro.omroepvoorne.nl/resources/artist_images/noimage.jpg" style="margin:0px 5px 0px 5px; width:75px; cursor:pointer;" align="left" onClick="show_info_ply_fast(' + json.artist_id + ');">';
				}
				if(json.website != null){
					url = '<br><a href="' + json.website + '" target="_blanc">' + json.website + '</a>';
				}
				if(json.error == null){
					document.getElementById('now_information').innerHTML = json.beschrijving + url + '<p><div style="float:left; width:85px;">' + image + '</div><div><div style="font-size:18px; font-weight:bold; cursor: pointer;" onClick="show_info_ply_fast(' + json.artist_id + ');">' + json.artist + '</div><div style="font-size:12px; font-weight:bold; cursor:pointer;" onClick="show_info_ply_fast(' + json.artist_id + ');">' + json.track + '</div><div style="float:left;"><iframe src="http://www.facebook.com/plugins/like.php?app_id=119558414809805&amp;href=http%3A%2F%2Fcaro.omroepvoorne.nl%2Fapi%2Ffacebook%2Fsmartfm%2Fid%2F' + json.artist_id + '&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=25" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:25px;" allowTransparency="true"></iframe></div><div><a href="http://twitter.com/share?url=http://smartfm.nl/&text=Ik%20luister%20naar%20' + json.track + '%20 van %20' + json.artist + '%20op%20#SmartFM" class="twitter-share-button" rel="nofollow" target="_blank"><img src="http://caro.omroepvoorne.nl/images/tweetbutton.png" style="border:none; height:25px;"></a></div><div style="clear:left;"></div></div><div style="clear:both"></div>' + sidemenu + '</div>';
				}else{
					document.getElementById('now_information').innerHTML = json.beschrijving + url + sidemenu + '<div style="clear:both"></div>';
				}
        	}
        	
        	function next_loader(json) {
        		var image 	= "";
        		var url 	= "";
        		var replay 	= "";
				if(json.replay == '1'){
					replay = ' <span style="color:gray;">(h)</span>';
				}
				var time = new Date();
				var today = time.getDay();
				if(today == json.day){
					document.getElementById('next_label').innerHTML = 'Straks om ' + json.hour +' uur';
				}else{
					document.getElementById('next_label').innerHTML = 'Morgen om ' + json.hour +' uur';
				}
				document.getElementById('next_name').innerHTML = '<div class="ramp_orange_white"></div>' + json.programma + replay;
				if(json.website != null){
					url = '<br><a href="' + json.website + '" target="_blanc">' + json.website + '</a>';
				}
				document.getElementById('next_information').innerHTML = json.beschrijving + url + '<div style="clear:both"></div>';
        	}
        	
        	function traffic_loader(json) {
        		var traffic = "";
				document.getElementById('traffic_label').innerHTML = '<div class="ramp_orange_white"></div>' + json.summary;
				if(json.jams > 0){
					for(var b in json.jam){
						traffic = traffic + '<table><tr><td><span style="white-space:nowrap; background:' + json.jam[b].color + '; padding:2px 1px; margin: 0 1px 0 0;"><span style="white-space:nowrap; font-style:normal; text-decoration:none; letter-spacing:1px; color:' + json.jam[b].border + '; background:' + json.jam[b].color + '; padding:0 2px 0 4px; border:' + json.jam[b].border + ' solid 1px;"> ' + json.jam[b].road + '</span></span></td><td>' + json.jam[b].direction + ' <b><i>' + json.jam[b].km + ' km</i></b><br><small>' + json.jam[b].information + '</small></td></tr></table><p>';
					}
				}
				if(json.roadworks > 0){
					for(var a in json.roadwork){
						traffic = traffic + '<table><tr><td><span style="white-space:nowrap; background:' + json.roadwork[a].color + '; padding:2px 1px; margin: 0 1px 0 0;"><span style="white-space:nowrap; font-style:normal; text-decoration:none; letter-spacing:1px; color:' + json.roadwork[a].border + '; background:' + json.roadwork[a].color + '; padding:0 2px 0 4px; border:' + json.roadwork[a].border + ' solid 1px;">' + json.roadwork[a].road + '</span></span></td><td>' + json.roadwork[a].direction + '<br><small>' + json.roadwork[a].information + '</small></td></tr></table><p>';
					}
				}
				document.getElementById('traffic_information').innerHTML = traffic + '<div style="clear:both"></div>';
			}
        	
        	function twitter_loader(json) {
        		var twitter = "";
				for(var a in json.tweet){
					twitter = twitter + '<table><tr><td><img src="' + json.tweet[a].image + '"></td><td><small><b><a href="http://twitter.com/' + json.tweet[a].username + '" target="_blank">@' + json.tweet[a].username + '</a></b> ' + json.tweet[a].datetime + '</small><br>' + json.tweet[a].tweet + '</td></tr></table>';
				}
				document.getElementById('twitter_information').innerHTML = twitter + '<div style="clear:both"></div>';
			}
        	
        	function replies_loader(json) {
        		var replies = "";
				for(var a in json.reply){
					replies = replies + '<div><b>' + json.reply[a].name + '</b> uit <b>' + json.reply[a].place + '</b> reageerde op:<br><a href="/artikel/' + json.reply[a].content_id + '">' + json.reply[a].titel + '</a></div><div><small>' + json.reply[a].datetime + '</small></div><p>';
				}
				document.getElementById('replies_information').innerHTML = replies + '<div style="clear:both"></div>';
			}
        	
        	function weather_loader(json) {
        		var weather = "";
        		if(json.error == null){
					weather = '<table>';
					for(var a in json.day){
						weather = weather + '<tr><td><img src="' + json.day[a].image + '" width="30"></td><td><span style="color:gray;">' + json.day[a].day + '</span></td><td>' + json.day[a].temp + '</td><td>' + json.day[a].condition + '</td></tr>';
					}
					weather = weather + '</table>';
				}else{
					weather = 'Fout tijdens het laden van het weer.';
				}
				document.getElementById('weather_information').innerHTML = weather + '<div style="clear:both"></div>';
			}
			
			function localnews_loader(json){
			}
        	
        	function show_schedule(){
				document.getElementById("overlay").innerHTML = '<img src="http://caro.omroepvoorne.nl/images/loading.gif" width="15" vspace="5" hspace="5"> <p> <div style="margin:5px;"><a href="#" onClick="close_screen(); return false;">Annuleren</a></div>';
				http.open("GET", "/caro/api/schedule.php?station=smartfm&rand=" + (new Date().getTime()), true);
				http.onreadystatechange=function() {
					if(http.readyState == 4) {
						document.getElementById("overlay").innerHTML = http.responseText;
						var time = new Date();
						document.getElementById("scrollcase").scrollLeft = (time.getHours()*60) + ((time.getMinutes()/60)*60);
						Drag.init(document.getElementById("handle"), document.getElementById("overlay"));
					}
				}
				http.send(null);
				document.getElementById("background_one").style.height = document.body.offsetHeight + 'px';
				document.getElementById("background_one").style.display = 'block';
				document.getElementById("overlay").style.display = 'block';
			}
			
        	function show_playlist(id){
				document.getElementById("overlay").innerHTML = '<img src="http://caro.omroepvoorne.nl/images/loading.gif" width="15" vspace="5" hspace="5"> <p> <div style="margin:5px;"><a href="#" onClick="close_screen(); return false;">Annuleren</a></div>';
				http.open("GET", "/caro/api/playlist.php?station=smartfm&rand=" + (new Date().getTime()), true);
				http.onreadystatechange=function() {
					if(http.readyState == 4) {
						document.getElementById("overlay").innerHTML = http.responseText;
						Drag.init(document.getElementById("handle"), document.getElementById("overlay"));
						if(id>0){
							show_info_ply(id);
						}
					}
				}
				http.send(null);
				document.getElementById("background_one").style.height = document.body.offsetHeight + 'px';
				document.getElementById("background_one").style.display = 'block';
				document.getElementById("overlay").style.display = 'block';
			}
        	
			function changebgcolor(id){
		 		document.getElementById(id).style.backgroundColor = "#e37a7a";
				document.getElementById(id).style.textDecoration = "underline";
			}
		
			function unchangebgcolor(id, oldcolor){
		 		document.getElementById(id).style.backgroundColor = oldcolor;
				document.getElementById(id).style.textDecoration = "none";
			}
			
			function unchangebgcolor_ply(id, oldcolor){
		 		document.getElementById(id).style.backgroundColor = oldcolor;
				document.getElementById(id).style.textDecoration = "none";
				document.getElementById(id + '_a').style.textDecoration = "none";
				document.getElementById(id + '_b').style.textDecoration = "none";
				document.getElementById(id + '_c').style.textDecoration = "none";
			}	
		
			function show_info(id){
				document.getElementById("infoscreen").innerHTML = '<img src="http://caro.omroepvoorne.nl/images/loading.gif" width="15" vspace="5" hspace="5"> <p> <div style="margin:5px;"><a href="#" onClick="close_info(); return false;">Annuleren</a></div>';
				http.open("GET", "/caro/api/infoscreen.php?station=smartfm&id=" + id + "&rand=" + (new Date().getTime()), true);
				http.onreadystatechange=function() {
					if(http.readyState == 4) {
						document.getElementById("infoscreen").innerHTML = http.responseText;
						Drag.init(document.getElementById("subhandle"), document.getElementById("infoscreen"));
					}
				}
				http.send(null);
				document.getElementById("background").style.display = 'block';
				document.getElementById("infoscreen").style.display = 'block';
			}	
		
			function show_info_ply(id){
				document.getElementById("infoscreen").innerHTML = '<img src="http://caro.omroepvoorne.nl/images/loading.gif" width="15" vspace="5" hspace="5"> <p> <div style="margin:5px;"><a href="#" onClick="close_info(); return false;">Annuleren</a></div>';
				http.open("GET", "/caro/api/infoscreenply.php?station=smartfm&id=" + id + "&rand=" + (new Date().getTime()), true);
				http.onreadystatechange=function() {
					if(http.readyState == 4) {
						document.getElementById("infoscreen").innerHTML = http.responseText;
						Drag.init(document.getElementById("subhandle"), document.getElementById("infoscreen"));
					}
				}
				http.send(null);
				document.getElementById("background").style.display = 'block';
				document.getElementById("infoscreen").style.display = 'block';
			}
			
			function show_info_ply_fast(id){
				document.getElementById("overlay").innerHTML = '<img src="http://caro.omroepvoorne.nl/images/loading.gif" width="15" vspace="5" hspace="5"> <p> <div style="margin:5px;"><a href="#" onClick="close_screen(); return false;">Annuleren</a></div>';
				http.open("GET", "/caro/api/infoscreenply.php?station=smartfm&id=" + id + "&inscreen=true&rand=" + (new Date().getTime()), true);
				http.onreadystatechange=function() {
					if(http.readyState == 4) {
						document.getElementById("overlay").innerHTML = http.responseText;
						Drag.init(document.getElementById("handle"), document.getElementById("overlay"));
					}
				}
				http.send(null);
				document.getElementById("background_one").style.height = document.body.offsetHeight + 'px';
				document.getElementById("background_one").style.display = 'block';
				document.getElementById("overlay").style.display = 'block';
			}
			
			function close_info(id){
				document.getElementById("background").style.display = 'none';
				document.getElementById("infoscreen").style.display = 'none';
			}
			
			function close_screen(){
				document.getElementById("background_one").style.display = 'none';
				document.getElementById("overlay").style.display = 'none';
				document.getElementById("background").style.display = 'none';
				document.getElementById("infoscreen").style.display = 'none';
			}
			
			function movebackground(){
			}

			function change_playlist(day, hour){
				document.getElementById("playlist_field").innerHTML = '<img src="http://caro.omroepvoorne.nl/images/loading.gif" width="15" vspace="5" hspace="5">';
				http.open("GET", "/caro/api/playlist_content.php?station=smartfm&day=" + day + "&hour=" + hour + "&rand=" + (new Date().getTime()), true);
				http.onreadystatechange=function() {
					if(http.readyState == 4) {
						document.getElementById("playlist_field").innerHTML = http.responseText;
					}
				}
				http.send(null);
			}
			
			function changetime(delta){
				var index = document.playlist.hour.selectedIndex;
				var dayindex = document.playlist.day.selectedIndex;
				index = index + delta;
				if((index + delta) < 0){
					index = 23;
					dayindex = dayindex + 1;
					if(dayindex > 9){
						dayindex = 9;
					}
				}else if((index + delta) > 23){
					index = 1;
					dayindex = dayindex - 1;
					if(dayindex < 0){
						dayindex = 0;
					}
				}
				document.playlist.hour.selectedIndex = index;
				document.playlist.day.selectedIndex = dayindex;
				change_playlist(document.playlist.day.options[document.playlist.day.selectedIndex].value, document.playlist.hour.options[document.playlist.hour.selectedIndex].value);
			}

