
//Preload the image into an array (include the size!)
var image_array = new Array(2)
image_array[0] = new Image(479,660)
image_array[0].src = "flyer2012a.jpg"
image_array[1] = new Image(359,495)
image_array[1].src = "flyer2012b.jpg"
var new_window

function display_image(image_index) {

if (window_available())  {

	// If the window is open, close it (can't resize it in Netscape!)
	new_window.close()

}

// Use the image dimensions to determine the window dimensions
var window_width = image_array[image_index].width
var window_height = image_array[image_index].height

// create the window to the image's dimensions
var window_dimensions = "width=" + window_width + ",height=" + window_height + ",top=25,left=2"
new_window = window.open("","",window_dimensions)

// Write the HTML tags

new_window.document.writeln('<html>')
new_window.document.writeln('<head>')
new_window.document.writeln('<title>')
new_window.document.writeln('<\/title>')
new_window.document.writeln('<\/head>')

// Make sure there are no unsightly margins
new_window.document.writeln('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">')

// Create an <img> tag for the image
new_window.document.writeln('<img src="' + image_array[image_index].src + '">')

// Finish up
new_window.document.writeln('<\/body>')
new_window.document.writeln('<\/html>')
new_window.document.close()

// Extract just the filename and use it as the title
var image_url = image_array[image_index].src
var image_filename = image_url.substring(image_url.lastIndexOf("/") + 1)
new_window.document.title = image_filename

	}

function window_available()  {
	if (!new_window)  {
	return false
	}
	else if (new_window.closed)  {
	return false
	}
	else  {
		return true
	}
  }


