// Sets and updates the data in the Now Playing box including album art, artist, title and album

	var doc = new ActiveXObject("htmlfile");
    doc.open();
    doc.write("<html><head><meta http-equiv='refresh' content='5'><title>Title Page</title><base target=_self></head><body bgcolor=#000000 text=#FFFFFF topmargin=0 leftmargin=0><div id='divSongInfoHidden'><iframe id='SongInfoHidden' src='../NowPlaying/tta.html' name='SongInfoHidden' width=300 height=60 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no background-color: #000033 text=#FFFFFF></iframe></div></body></html>");
   	doc.close();
	
	function AttachEvent(obj,evt,fnc,useCapture)
	{
		if (obj.addEventListener) {
			obj.addEventListener(evt, fnc, useCapture ? true : false);
			return true;
		}
		else if (obj.attachEvent) {
			return obj.attachEvent("on"+evt, fnc);
		}
		else
			return false;	
	}
	var oInterval="";
	
	function startInterval()
	{
		oInterval=window.setInterval("reloadImage()",10000);
		window.doc.location.reload( false );
		var ttaIframe = "";
		var ttaIframe = doc.getElementById('SongInfoHidden');
		var ttaContent = ttaIframe.contentWindow.document.body.innerHTML;
		var songinfoDiv = document.getElementById('song-info');
		songinfoDiv.innerHTML = ttaContent;
		if(document.images)
		{
			document.images['album-art'].src = '../NowPlaying/album.jpg?' +
			Date.parse(new Date().toString());
		}
	}
	
	function reloadImage()
	{
		window.doc.location.reload( false );
		setTimeout("refreshSongInfo()", 3000);
	}
	
	function refreshSongInfo()
	{
		var ttaIframe = "";
		var ttaIframe = doc.getElementById('SongInfoHidden');
		var ttaContent = ttaIframe.contentWindow.document.body.innerHTML;
	/*	alert(ttaContent);*/
		var songinfoDiv = document.getElementById('song-info');
		if (songinfoDiv.innerHTML != ttaContent)
	   {
			songinfoDiv.innerHTML = ttaContent;
			setTimeout("refreshAlbumArt()", 1000);
	   }
	}
	
	function refreshAlbumArt()
	{
		if(document.images)
		{
			document.images['album-art'].src = '../NowPlaying/album.jpg?' +
			Date.parse(new Date().toString());
		}
	}
	
	AttachEvent(window,'load',startInterval);

