//set up arrays for our the pieces in each of our sections
var studio = new Array( "studio01", "studio02", "studio03", "studio04", "studio05");
var show = new Array ( "show01", "show02", "show03", "show04", "show05", "show06", "show07", "show08", "show09");
var prod = new Array ( "prod01", "prod02", "prod03", "prod04", "prod05");
var adven = new Array( "adven01", "adven02", "adven03", "adven04", "adven05", "adven06", "adven07", "adven08", "adven09");


//initialize a null variable for the popup
var openWin = null;

function pop(image_number, section, popped) {
//	if(openWin.closed) {
	if(!openWin || openWin.closed) {
		openWin = this.open("blank.html", "zoom", "resizable,height=540,width=380");
		} else {
//		openWin.close();
//		openWin = this.open("blank.htm", "zoom", "resizable,height=550,width=710");
		openWin.focus();
	}
	//Set up an array for our series of pictures
	if (section == "studio") {
		var activeArray = studio;
	}
	if (section == "show") {
		var activeArray = show;
	}
	if (section == "prod") {
		var activeArray = prod;
	}
	if (section == "adven") {
		var activeArray = adven;
	}
	//figure out what the previous and next pieces will be
	if (image_number < activeArray.length - 1) {
		var nextLink = "\"javascript:pop(" + (image_number + 1) + ", '" + section + "', true);\"";
	} else {
		var nextLink = "#";
	}
	if (image_number > 0) {
		var prevLink = "\"javascript:pop(" + (image_number - 1) + ", '" + section + "', true);\"";
	} else {
		var prevLink = "#";
	}
	
	//create the content for our new page
	var newContent = "<html><head><title>afigmentof.com - Photo Gallery</title><link href='cir.css' rel='stylesheet' type='text/css'>\n";
	var newContent = newContent + "</head><script language='JavaScript' type='text/javascript' src='big.js'></script>\n";
	var newContent = newContent + "<body bgcolor='#cccccc' text='#000000' align='center'>\n";
	var newContent = newContent + "<table height='540' border='0' cellpadding='0' cellspacing='0'><tr ><td height='50' valign='top' align='center'>\n";
	var newContent = newContent + "<img src='images/figments.gif' border='0'></td></tr><tr><td height='420' align='center' valign='top'>\n";
	var newContent = newContent + "<img src='images/" + section + "/" + activeArray[image_number] + ".jpg' class='border_pop'></td></tr><tr>\n";
	var newContent = newContent + "<td height='22' align='center' valign='top'><a href=" + prevLink + " class='txt_pop'>Previous</a> | <a href=" + nextLink + " class='txt_pop'>Next</a></td></tr>\n";
	var newContent = newContent + "<tr ><td align='right'valign='top' height='80'class='footer_pop'><br>COPYRIGHT 2005 AFIGMENTOF.COM | ALL RIGHTS RESERVED</td>\n";
	var newContent = newContent + "</tr></table></body></html>\n";
	//write the content we just made into our page
	//if popped is true, meaning we're already functioning in the popup, then write the content
	//otherwise popup a window first and write the content
	if (popped) {
		document.write(newContent);
		document.close() ;//close the stream
	} else {
	openWin.document.write(newContent);
	openWin.document.close(); //close the stream
	}
}

