//class Album
//{

	function StartAlbum( albumPath,  albumName, fileext) // description
	{
		albumCurrentIdx = -1;
		albumCycleTimer = null;
		albumUseFilters = false;
		
		albumUseDynamic = (typeof(document.getElementById) != "undefined");
		
		if (albumUseDynamic) 
		{
			if (typeof(document.getElementById("photoalbumThumb").filters)!= "undefined") 
				albumUseFilters = true;
		}
		if (albumUseDynamic) 
		{
			//document.getElementById("photoalbumText").innerHTML = "Loading album.. Please wait..";
		}
		
		albumPhotoCache = new Array();
		albumPhotoCache[0] = new Array(albumPath+albumName + "/" + albumName +"thumb1."+fileext, albumName+"'s album","Click to open "+albumName+"'s photo album");
		albumPhotoCache[1] = new Array(albumPath+albumName + "/" + albumName +"thumb2."+fileext, albumName+"'s album","Click to open "+albumName+"'s photo album");
		albumPhotoCache[2] = new Array(albumPath+albumName + "/" + albumName +"thumb3."+fileext, albumName+"'s album","Click to open "+albumName+"'s photo album");
		albumPhotoCache[3] = new Array(albumPath+albumName + "/" + albumName +"thumb4."+fileext, albumName+"'s album","Click to open "+albumName+"'s photo album");
		albumPhotoCache[4] = new Array(albumPath+albumName + "/" + albumName +"thumb5."+fileext, albumName+"'s album","Click to open "+albumName+"'s photo album");
		
		if (albumUseDynamic) 
		{
			//document.getElementById("photoalbumText").innerHTML = description;
		}

		albumCycleImage();			
	}

	//Cycle through photos
	function albumCycleImage()
	{
		if (albumCycleTimer!=null) 
			clearTimeout(albumCycleTimer);
			
		var NextIdx = ++albumCurrentIdx; 
		if (NextIdx==albumPhotoCache.length) 
			NextIdx=0;
			
		if (!albumUseDynamic) 
		{
			document.images["photoalbumThumb"].src = albumPhotoCache[NextIdx][0];
		} 
		else 
		{
			var albumContainer = document.getElementById("photoalbumThumb");
			var albumImg = document.getElementById("photoalbumThumb");
			//var albumTitle = document.getElementById("photoalbumTitle");
			//var albumText = document.getElementById("photoalbumText");
			
			if (albumUseFilters)	
				albumContainer.filters[0].apply();
				
			albumImg.src = albumPhotoCache[NextIdx][0];
			//albumTitle.innerHTML = albumPhotoCache[NextIdx][1];
			//albumText.innerHTML = albumPhotoCache[NextIdx][2];
			if (albumUseFilters)
				albumContainer.filters[0].play();
		}
		albumCurrentIdx = NextIdx;
		albumCycleTimer = setTimeout("albumCycleImage();",  5000);
	}
//}

function albumClicked( albumPage, albumName )
{
	
	//"width=512,height=438", resizable=yes
	window.open( albumPage+"?cntx="+escape(albumName)+ "&photo="+ escape(albumPhotoCache[albumCurrentIdx][0]), "_blank", "width=550,height=510");
}

