// 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 arr_num = new Array();
var curr_art;
var flag = false;

function getArtist(param) {
  curr_art = param;
  http = createRequestObject(); 
  var myurl = 'http://www.agitpoprecords.com/scripts/get_artist.php'; 
  http.open("GET", myurl + "?id=" + param);
  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 x=document.getElementById('artist_info').innerHTML=textout;
	
	if(flag){
		for(i=0; i<(arr_num.length-1); i++){
			document.getElementById(arr_num[i]).style.fontWeight='normal';
		}
		document.getElementById(curr_art).style.fontWeight='bold';
	}
  }
}

function getArtistsList(){
  http_1 = createRequestObject(); 
  var myurl_1 = 'http://www.agitpoprecords.com/scripts/getArtistsList.php'; 
  http_1.open("GET", myurl_1);
  http_1.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
  http_1.onreadystatechange = useHttpResponse_1;
  http_1.send(null);
}

function useHttpResponse_1() {
  if (http_1.readyState == 4) {
    var textout = http_1.responseText;
	var arr = new Array();
	arr = textout.split('$#$');
	var x=document.getElementById('artists_list').innerHTML=arr[1];
	flag = true;
	if(location.href.indexOf("?id=")==-1){
		arr_num = arr[0].split('$$');
		var seed = Math.random();
		var index = Math.floor(seed*(arr_num.length-1));
		getArtist(arr_num[index]);
	}
  }
}

function setSize(){
	if(navigator.appName == "Microsoft Internet Explorer"){
		document.getElementById('artists_list').style.height='350';
		document.getElementById('artist_info').style.height='350';
	}
	else{
		document.getElementById('artists_list').style.height='';
		document.getElementById('artist_info').style.height='';
	}
}