	//Photos page
	var oPhotoViewer;
	var oSelectedPhoto;
	
	//function showPhoto(oPhoto)
	//{
	//	var strPhotoName;
	//	strPhotoName = oPhoto.src;
	//	strPhotoName = strPhotoName.substring(strPhotoName.lastIndexOf("/"), strPhotoName.length);
	//	window.open('photos' + strPhotoName,null,'height=550,width=550,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
	//}
	
	function showPhoto(oPhoto)
	{
		oSelectedPhoto = oPhoto;
		if (!oPhotoViewer || oPhotoViewer.closed)
		{
			oPhotoViewer = window.open('photos/photoViewer.htm',"photoViewer",'height=500,width=575,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');	
		}
		else
		{
			oPhotoViewer.loadPhoto(oPhoto);
		}
		oPhotoViewer.focus();
	}
	//photoViewer page
	var iLastHeight;
	var iLastWidth;
	
	function initPhotoPage()
	{
		loadPhoto(window.opener.oSelectedPhoto);
		setInterval('resizeWindow()', 500);
	}
	function loadPhoto(oPhoto)
	{
		var oGallery;
		var strPhotoName;
		var strTitle;
		var strDescription;
		strTitle = oPhoto.name;
		if (strTitle.length > 0){strTitle = "<H4>" + strTitle + "</H4>";}
		strDescription = oPhoto.alt;
		strPhotoName = oPhoto.src;
		strPhotoName = strPhotoName.substring(strPhotoName.lastIndexOf("/")+1, strPhotoName.length);
		oGallery = getElementById("gallery");
		oGallery.innerHTML = strTitle + "<img src='" + strPhotoName + "'><br>" + strDescription;
		resizeWindow();
	}
	function resizeWindow()
	{
		var oGalleryOuter;
		var iHeight;
		var iWidth;
		
		oGalleryOuter = getElementById("galleryOuter");
		iHeight = oGalleryOuter.scrollHeight + 40;
		iWidth = oGalleryOuter.scrollWidth + 30;
		iHeight = (iHeight < screen.availHeight ? iHeight :  screen.availHeight);
		iWidth = (iWidth < screen.availWidth ? iWidth :  screen.availWidth);
		if (iHeight > 300 && (iHeight != iLastHeight || iWidth != iLastWidth))
		{
			window.resizeTo(iWidth, iHeight);
			iLastHeight = iHeight;
			iLastWidth = iWidth;
		}
	}
	
	//Random Photo
	var oRandomPhoto1;
	var oRandomPhoto2;
	var iLastPhoto1;
	var iLastPhoto2;

	function initRandomPhoto1()
	{
		oRandomPhoto1 = getElementById("randomPhoto1");
		iLastPhoto1 = oRandomPhoto1.src;
		iLastPhoto1 = iLastPhoto1.substring(iLastPhoto1.lastIndexOf("/")+1, iLastPhoto1.lastIndexOf("."));
		iLastPhoto1 = parseInt(iLastPhoto1);
		showRandomPhoto(oRandomPhoto1, iLastPhoto1);
		setInterval('showRandomPhoto(oRandomPhoto1, iLastPhoto1)', 5000);
	}

	function initRandomPhoto2()
	{
		oRandomPhoto2 = getElementById("randomPhoto2");
		iLastPhoto2 = oRandomPhoto2.src;
		iLastPhoto2 = iLastPhoto2.substring(iLastPhoto2.lastIndexOf("/")+1, iLastPhoto2.lastIndexOf("."));
		iLastPhoto2 = parseInt(iLastPhoto2);
		showRandomPhoto(oRandomPhoto2, iLastPhoto2);
		setInterval('showRandomPhoto(oRandomPhoto2, iLastPhoto2)', 5000);
	}
	
	function showRandomPhoto(oRandomPhoto, iLastPhoto)
	{
		var iPhotoID;
		var strPhotoSource;
		iPhotoID = (Math.random()* iLastPhoto) + 1
		iPhotoID = Math.floor(iPhotoID)
		if(oRandomPhoto.filters && oRandomPhoto.filters.item(0)){oRandomPhoto.filters.item(0).Apply();};
		strPhotoSource = oRandomPhoto.src;
		strPhotoSource = strPhotoSource.substring(0, strPhotoSource.lastIndexOf("/")+1);
		oRandomPhoto.src = strPhotoSource + iPhotoID + ".jpg";
		if(oRandomPhoto.filters && oRandomPhoto.filters.item(0)){oRandomPhoto.filters.item(0).Play();};
	}

	function getElementById(sElementName)
	{
		var objElement = null;
		if (document.getElementById){objElement = document.getElementById(sElementName)}
		else{if (document.all){objElement = document.all.item(sElementName)}}
		return objElement;
	}