// JavaScript Document
var newWindow;
function openImage(path, title){
	image = null;
	if(newWindow)
  		newWindow.close();
	image = new Image();
   	image.src = path;
    newWindow=window.open(image.src,'newWin','toolbar=no, width='+image.width+',height='+image.height+',scrollbars=no');
    newWindow.document.write('<html><head><title>'+title+'<\/title><\/head><body leftmargin="0" topmargin="0"><image src="'+path+'"><\/body><\/html>');
    newWindow.resizeBy(image.width-newWindow.document.body.clientWidth, image.height-newWindow.document.body.clientHeight);
    newWindow.focus();
}

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
}

function getGallery(gal, name) {
  http = createRequestObject(); 
  var myurl = 'http://www.agitpoprecords.com/scripts/gallery.php'; 
  http.open("GET", myurl+"?id="+1+"&gal="+gal+"&name="+name);
  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('gallery').innerHTML=textout;
  }
}

function getList(){
	http_1 = createRequestObject();
	var myurl_1 = 'http://www.agitpoprecords.com/scripts/gallery.php';
	http_1.open("GET", myurl_1+"?id="+2);
	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("#$#");
	document.getElementById('list').innerHTML=arr[0];
	getGallery(arr[1], arr[2]);
  }
}

function setSize(){
	if(navigator.appName == "Microsoft Internet Explorer"){
		document.getElementById('list').style.height='350';
		document.getElementById('gallery').style.height='350';
	}
	else{
		document.getElementById('list').style.height='';
		document.getElementById('gallery').style.height='';
	}
}