//slideshow code

//slide object
function slide(src) {
	this.src = src;
	this.loaded = false;

	//create new image (if document.images is supported)
	if (document.images) {
		this.img = new Image();
	}

	//function to load src into img (if not already)
	this.load = function() {
		if (!this.loaded) {
			this.img.src = this.src;
			this.loaded = true;
		}
	}
}

//slideshow object (comprised of slide objects)
function slideshow() {
	//create array & index datamembers for slides
	this.slides = new Array();
	this.image;
	this.current = 0;

	//function to add slide objects to slides array
	this.add_slide = function(slide) {
		slide.load();
		this.slides[this.slides.length] = slide;
	}

	//function to update slideshow image
	this.update = function() {
		var slide = this.slides[this.current];
		slide.load;
		this.image.src = slide.img.src;
	}

	//function to go to next slide
	this.next = function() {
		if (this.current < this.slides.length - 1) { this.current++; }
		else { this.current = 0; }
		this.update();
	}

	//function to go to prev slide
	this.prev = function() {
		if (this.current > 0) { this.current--; }
		else { this.current = this.slides.length - 1; }
		this.update();
	}
}

//popup javascript window

function popImage(imageURL, orientation, caption) {
	img = new Image();
	img.src = imageURL;
	var imgName = imageURL.replace(/.*\//,'');

	imgWin = window.open('', '', 'resizable = yes, scrollbars = no, top = 20, left = 20, height = 700, width = 700');

	with (imgWin.document) {
		writeln(
			'<html>' +
			'<head>' +
				'<link rel="stylesheet" type="text/css" href="hugeback_style.css">' +
				'<script src="hugeback_script.js" language="javascript" type="text/javascript"></script>' +

				'<SCRIPT TYPE="text/javascript">' +
				'<!--' +

				'ss = new slideshow();' +

				's = new slide();' +
				's.src =  "http://www.hugeback.com/images/wedding/268999-R1-01-1.JPG";' +
				'ss.add_slide(s);' +

				'//-->' +

				'</SCRIPT>' +

			'</head>' +


			'<body onload="ss.update()">' +
				'<table width=100% height=100%>' +
				'<tr>' +
				'<td align=center>' +
				'<img id="ss_img" name="ss_img" src = ' + imageURL + '><br>' +

//				'<A ID="ss_prev" HREF="javascript:ss.prev()">&lt;prev</A> <A ID="ss_next" HREF="javascript:ss.next()">next&gt;</A><br>' +

				'<script type="text/javascript">' +
				'<!--' +
				'if (document.images) {' +
				  'ss.image = document.images.ss_img;' +
				  'ss.update();' +
				'}' +
				'//-->' +
			'</script>' +

			'</body>' +
			'</html>');
		close();
	}
}