// JavaScript Document
function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}
var curr_list='';
function getTracklists() {
  http = createRequestObject(); 
  var myurl = 'http://www.agitpoprecords.com/scripts/getTracklists.php'; 
  http.open("GET", myurl);
  http.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
  http.onreadystatechange = useHttpResponse;
  http.send(null);
} 

function useHttpResponse() {
  if (http.readyState == 4) {
    var textout = http.responseText;
	var arr = new Array();
	arr = textout.split('#$#');
	document.getElementById('tracklists').innerHTML=arr[1];
	loadPlaylist(arr[0]);
  }
}

function loadPlaylist(id){
	if(curr_list != '')
		document.getElementById(curr_list).style.fontWeight = 'normal';
	curr_list = id;
	document.getElementById('player').innerHTML="<object  classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' id='xspf_player' align='middle' height='153' width='300'>"+
													"<param name='allowScriptAccess' value='sameDomain'>"+
													"<param name='movie' value='http://agitpoprecords.com/radio/xspf_player.swf?playlist_url=http://agitpoprecords.com/radio/tracklists/"+id+"&autoplay=true'>"+
													"<param name='quality' value='high'> <param name='bgcolor' value='#e6e6e6'>"+
													"<embed src='http://agitpoprecords.com/radio/xspf_player.swf?playlist_url=http://agitpoprecords.com/radio/tracklists/"+id+"&autoplay=true' quality='high' bgcolor='#e6e6e6' name='xspf_player' allowscriptaccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' align='center' height='153' width='400'>"+
												"</object>";
	document.getElementById(id).style.fontWeight = 'bold';
}
