var imagesLoaded;

if (!imagesLoaded)
{
	var rayImages = new Array();

	rayImages[0] = new Image(200, 100);
	rayImages[0].src = "imagescontent/previouspagemouseout.gif";
	rayImages[1] = new Image(200, 100);
	rayImages[1].src = "imagescontent/previouspagemouseover.gif";

	rayImages[2] = new Image(200, 100);
	rayImages[2].src = "imagescontent/nextpagemouseout.gif";
	rayImages[3] = new Image(200, 100);
	rayImages[3].src = "imagescontent/nextpagemouseover.gif";

	imagesLoaded = true;
}


function swapImage(obj, swapID)
{
	switch (swapID)
	{
		// swap out previous page button
		case 1 : 	obj.src = rayImages[1].src;
							break;
		case 2 :	obj.src = rayImages[0].src;
							break;

		// swap out next page button
		case 3 : 	obj.src = rayImages[3].src;
							break;
		case 4 :	obj.src = rayImages[2].src;
							break;
	}
}


function popUpWindow(picSource, picWidth, picHeight, picCredit)
{
	var newPicHeight = picHeight + 18; // to allow space for photo credit
	var featureString = "width=" + picWidth + ",height=" + newPicHeight + ",left=50,screenX=50,resizable=no,scrollbars=no";
	var popWin  = window.open("", "picturewindow", featureString);

	popWin.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
	popWin.document.writeln('');
	popWin.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">');
	popWin.document.writeln('');
	popWin.document.writeln('<head>');
	popWin.document.writeln('<title>Ray of Sunshine photo by ' + picCredit + '</title>');
	popWin.document.writeln('<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />');
	popWin.document.writeln('<meta http-equiv="Content-Language" content="en-us" />');
	popWin.document.writeln('<script type="text/javascript">');
	popWin.document.writeln('var message="Function Disabled";');
	popWin.document.writeln('function clickIE4() {if (event.button==2) {alert(message);return false;}}');
	popWin.document.writeln('function clickNS4(e) {if (document.layers||document.getElementById&&!document.all) {if (e.which==2||e.which==3) {alert(message);return false;}}}');
	popWin.document.writeln('if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4;} else if (document.all&&!document.getElementById) {document.onmousedown=clickIE4;}');
	popWin.document.writeln('document.oncontextmenu=new Function("alert(message);return false");');
	popWin.document.writeln('</script>');
	popWin.document.writeln('<style type="text/css">');
	popWin.document.writeln('body {font-family:verdana,arial,sans-serif; font-size:100%; background-color:#000; color:#DDD;}');
	popWin.document.writeln('* {margin:0; padding:0;}');
	popWin.document.writeln('img {border:0;}');
	popWin.document.writeln('p {font-size:0.65em; letter-spacing:0.1em; margin-left:2px;}');
	popWin.document.writeln('</style>');
	popWin.document.writeln('</head>');
	popWin.document.writeln('');
	popWin.document.writeln('<body onBlur="self.close();">');
	popWin.document.writeln('<div><img src="../../../telecommunications/filminstitute/rayofsunshine/js/' + picSource + '" width="' + picWidth + '" height="' + picHeight + '" alt="Ray of Sunshine photo by ' + picCredit + '" /></div>');
	popWin.document.writeln('<p>photo by ' + picCredit + '</p>');
	popWin.document.writeln('</body>');
	popWin.document.writeln('</html>');
	popWin.document.close();
}


function sceneSelect(elementName)
{
	var obj = document.getElementById(elementName);
	window.location.href = "#" + obj.options[obj.selectedIndex].value;
}


function selectRandomActionShots()
{
	// pick first random number from 1 to 23
	var x = -1;
	while ((x < 1) || (x > 23))
	{
		x = Math.round(Math.random() * 22) + 1;
	}

	// pick second random number from 1 to 23 but not equal to previous random number
	var y = -1;
	while ((y < 1) || (y > 23))
	{
		y = Math.round(Math.random() * 22) + 1;
		if (y == x) y = -1
	}

	// prepend a zero if one-digit numbers
	if (x < 10)
		x = "0" + x;
	else
		x = "" + x;

	if (y < 10)
		y = "0" + y;
	else
		y = "" + y;

	return x + y;
}


// Disable right mouse click script
// By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
// For full source code, visit http://www.dynamicdrive.com
var message = "Function Disabled";

function clickIE4()
{
	if (event.button == 2)
	{
		alert(message);
		return false;
	}
}

function clickNS4(e)
{
	if (document.layers || document.getElementById && !document.all)
		{
			if (e.which == 2 || e.which == 3)
				{
					alert(message);
					return false;
				}
		}
}

if (document.layers)
	{
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown = clickNS4;
	}
else
	if (document.all && !document.getElementById)
		{
			document.onmousedown = clickIE4;
		}

document.oncontextmenu = new Function("alert(message);return false");
// End of Disable right mouse click script
