var cumulus = new function() {
		
	this.showNowPlaying = function (site, iWidth, iHeight, textColor) {
		var d = new Date;
		var xmlPath = '/shared/cumulus/ajax.php?site='+site+'&d='+d.getFullYear()+""+d.getMonth()+""+d.getDate()+""+d.getHours()+""+d.getMinutes();
		var swfPath = '/shared/cumulus/nowplaying.swf?xml_file=' + escape(xmlPath) +'&text_color=' + textColor;
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ iWidth +'" height="'+ iHeight +'" title="Now Playing">');
		document.write('<param name="movie" value="'+ swfPath +'">');
		document.write('<param name="wmode" value="transparent">');
		document.write('<embed src="'+ swfPath +'" width="'+ iWidth +'" height="'+ iHeight +'" flashvars="var1=HelloWorld" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgcolor="#ffffff"></embed>');
		document.write('</object>');
	};
	
	this.useHttpResponse = function(responseXML) {
		if (responseXML) {
			for(var i = 0; i < 9; i++) {
				document.getElementById("title"+i).innerHTML = responseXML.getElementsByTagName("LastTitle")[i].childNodes[0].nodeValue
				document.getElementById("artist"+i).innerHTML = responseXML.getElementsByTagName("LastArtis")[i].childNodes[0].nodeValue
			}
	    }
	}

	this.getPlayed = function(site) {
		var d = new Date;
		var myurl = '/shared/cumulus/ajax.php?site='+site+'&d='+d.getFullYear()+""+d.getMonth()+""+d.getDate()+""+d.getHours()+""+d.getMinutes();
		  $.ajax({
		    url: myurl,
		    type: 'GET',
		    dataType: 'xml',
		    success: cumulus.useHttpResponse 
		});
	}
	  
	this.reFresh = function() {
		  location.reload(location.href);
	};
}
	
/* 1 minute = 60000 milliseconds. */
/// window.setInterval("cumulus.reFresh()",60000);
