/*------------------------------------

   captions[0] is id for photos group

  ------------------------------------*/

var captions;
var current;
var title;
var photoWin;
var photoLib = 'javascripts/photoFunctions.js';

function popPhoto(myTitle, myPhoto, myCaptions) {

	current = myPhoto;
	captions = myCaptions;
	title = myTitle;

	popIt();

}
//-----------------------------------------------------------------

function popIt() {
	

	var photoHTML = makeHTML();

	photoWin=window.open('','photos','height=500,width=580,menubar,status');   // make height dependant on image's height (width too?)
	
	photoWin.document.write(photoHTML);
	photoWin.current = current;
	photoWin.captions = captions;
	photoWin.document.close();
	
	photoWin.focus();

}

// this should load from a file.. also figure out why title doesn't work in firefox
function makeHTML() {
	return 	'	<?xml version="1.0" encoding="UTF-8"?>\n' + 
			'	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' + 
			'	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' +
			'	<head>\n' +
			'		<title>Schocharie Ridge Farm - Photos</title>\n' +
			'		<style type="text/css" media="all">\n' +
			'			@import "stylesheets/default.css";\n' +
			'			@import "stylesheets/photos.css";\n' +
			'		</style>\n' +
			'		<script type="text/javascript" src="' + photoLib + '"></script>\n' +
			'	</head>\n' +
			'	<body onload="loadPhoto()">\n' +
			'		<div id="main">\n' +
			'			<img alt="Photo" name="photo" src="" />\n' +
			'			<p id="caption"></p>\n' +
			'			<hr />\n' +
			'			<a onclick="previous()" onmouseover="window.status=\'Previous image\'; return true" onmouseup="window.status=\'Previous image\'; return true"\n' +
			'				onmouseout="window.status=\'\'; return true" class="previous">&laquo; Previous</a>\n' +
			'			<a onclick="next()" onmouseover="window.status=\'Next image\'; return true" onmouseup="window.status=\'Next image\'; return true"\n' +
			'				onmouseout="window.status=\'\'; return true" class="next">Next &raquo;</a>\n' +
			'		</div>\n' +
			'		<table id="titlebar">\n' +
			'			<tr>\n' +
			'				<td id="title" height="30">' + title + '</td>\n' +
			'			</tr>\n' +
			'		</table>\n' +
			'		<div id="x">\n' +
			'			<a href="" onclick="self.close()" onmouseover="window.status=\'Close window\';return true">X</a>\n' +
			'		</div>\n' +
			'	</body>\n' +
			'	</html>';
}

