//Copyright MatthewRobertsPhoto.com
//Coded by Adam Levitt

// JScript source code
var IE4 = (document.all && !document.getElementById) ? true : false; 
var NS4 = (document.layers) ? true : false; 
var IE5 = (document.all && document.getElementById) ? true : false; 
var NS6 = (document.getElementById && !document.all) ? true : false;

var SAF = (document.getElementById) ? true : false;
var IE = (IE4 || IE5) ? true : false;
var NS = (NS4 || NS6) ? true : false;

//disables right mouse click
//function disable()
//{
//	if (event.button == 1)
//	{
//	alert("This function has been disabled.")
//	}
//	if (event.button == 2)
//	{
//	alert("This function has been disabled.")
//	}
//}

//changes the main screen image when a user clicks on the thumbnail
function changeImage(image)
{
	pic = new Image();
	pic.src = image
	width = pic.width;
	height = pic.height;
	htmlImageSource = "<div class='mainImage'><img id='main' src='lgNEWS_parade_fire.jpg' border='0' height='460'></a></div>";
	document.getElementById('screen').innerHTML = htmlImageSource;
	document.getElementById('main').src = image;
}

//sets the corresponding caption for an image
function setCaption(photoCaption)
{
	if (photoCaption == "")
	{
		photoCaption = "&nbsp;"
	}	
	else
	{
		photoCaption = "<div id='caption'>" + photoCaption + "</div>";
	}
		
	//sets the caption's visibility to "on"	
	if (SAF)
	{
		document.getElementById('caption').innerHTML = photoCaption;
	}
	else if (IE)
	{
		document.all.caption.innerHTML = photoCaption;
	}
	else if (NS6) 
	{
		obj = window.document.getElementById("caption");
		obj.innerHTML = photoCaption;
	} 
	else
	{
		document.layers["caption"].innerHTML = photoCaption;	
	}
}

//toggles the caption to be displayed or hidden on the page
function toggleCaption()
{
	setCaption
	var captionClass;
	if (SAF)
	{
		captionClass= document.getElementById('caption').className;
		if (captionClass == "captionVisible")
			document.getElementById('caption').className = "captionHidden";
		else
			document.getElementById('caption').className = "captionVisible";
	}
	else if (IE)
	{
		captionClass = document.all.caption.className;
		if (captionClass == "captionVisible")
			document.all.caption.className = "captionHidden";
		else
			document.all.caption.className = "captionVisible";
	}
	else if (NS6) 
	{
		obj = window.document.getElementById("caption");
		captionClass = obj.className;
		if (captionClass == "captionVisible")
			obj.className = "captionHidden";
		else
			obj.className = "captionVisible";
	} 
	else
	{
		captionClass = document.layers["caption"].className; 
		if (captionClass == "captionVisible")
			document.layers["caption"].className = "captionHidden";
		else
			document.layers["caption"].className = "captionVisible";
	}
}
