/*
Filename: header.js
Desc:     Routines to handling rotating images and cart linking for header photos
Author:   Relevant Arts Enterprise, Inc. <http://www.relevantarts.com/>
          John A. Lock <jlock@relevantarts.com>
Created:  2004-Feb-09
Modified: 
*/

// Function prototpe to load photo array
function Photo(Name, Title, CardURL, PrintURL) {
	this.Name = Name;
	this.Title = Title;
	if (CardURL) {
		this.CardURL = CardURL;
	}
	if (PrintURL) {
		this.PrintURL = PrintURL;
	}
}

// Setup some variables
PhotoPath = "img/header/";
PhotoSmallSuffix = "_s.jpg";
PhotoLargeSuffix = "_l.jpg";
MaxSlot = 4;
CurrPos = -1;
PopupInfo = new Array(MaxSlot+1);

// Function to rotate the images on each click
function NextImage() {
	for(Slot=0;Slot<=MaxSlot;Slot++) {
		if (CurrPos >= PhotoList.length-1) {
			CurrPos = 0;
		} else {
			CurrPos++;
		}
		PopupInfo[Slot] = PhotoList[CurrPos];
		ImageSlot = "Slot" + Slot;
		document[ImageSlot].src = PhotoPath + PhotoList[CurrPos].Name + PhotoSmallSuffix;
	}
	CurrPos = CurrPos-(MaxSlot+2);
	if (CurrPos < -1) {
		CurrPos = CurrPos+10;
	}
}

// Function for photo popups
function aspen_popup(Photo) {
	PopupWin = window.open('','PopupWin','width=500,height=500,,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes');
	if (PopupWin.opener == null) {
		PopupWin.opener = window;
	}
	
	PopupWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Aspen Light Imaging - Photo Closeup</title><meta http-equiv="imagetoolbar" content="no"><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta name="author" content="RAE, Inc. - http://www.relevantarts.com/"><meta name="copyright" content="HTML, CSS, and Javascript Copyright 1997-2003, Relevant Arts Enterprise, Inc."><link rel="stylesheet" href="styles/default.css" type="text/css">');

	PopupWin.document.write('<script language="javascript" src="/javascript/norightclick_img.js" type="text/javascript"></script></head>');

	PopupWin.document.write('<body bgcolor="#000000" text="#222222" link="#0000ff" vlink="#660099" alink="#ff0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="InitTrap()">');

	PopupWin.document.write('<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><table cellspacing="0" cellpadding="0" border="0" align="center"><tr><td bgcolor="#336BAD" colspan="3"><img src="img/aspenlight-logo_popup.gif" width="431" height="85" alt="Aspen Light Imaging"><br></td></tr><tr><td bgcolor="#336BAD" align="center" colspan="3"><a href="javascript:window.close()"><img src="img/header/');

	PopupWin.document.write(Photo.Name + '_l.jpg');

	PopupWin.document.write('" border="0" alt="Click to close"></a><br><br></td></tr><tr><td width="10" bgcolor="#ffffff"><img src="img/spacer.gif" width="10" height="1" alt=""><br></td><td bgcolor="#ffffff"><img src="img/spacer.gif" width="1" height="5" alt=""><br><span class="big"><strong><em>');

	PopupWin.document.write(Photo.Title);

	PopupWin.document.write('</em></strong></span><br><img src="img/spacer.gif" width="1" height="10" alt=""><br>Available as: ');

	if (Photo.CardURL) {
		PopupWin.document.write('<a href="javascript:window.opener.location=\'' + Photo.CardURL + '\';window.close()">Notecard</a>');
	}
	if ((Photo.CardURL) && (Photo.PrintURL)) {
		PopupWin.document.write(' or ');
	}
	if (Photo.PrintURL) {
		PopupWin.document.write('<a href="javascript:window.opener.location=\'' + Photo.PrintURL + '\';window.close()">Matted Print</a>');
	}

	PopupWin.document.write('<p align="right"><span class="smaller"><a href="javascript:window.close()"><span class="button">&nbsp;&nbsp;Close&nbsp;&nbsp;</span></a></span><br><br></td><td width="10" bgcolor="#ffffff"><img src="img/spacer.gif" width="10" height="1" alt=""><br></td></tr></table></td></tr></table></body></html>');

	Timer = setTimeout('PopupWin.document.close()', 500);
}
