// JavaScript Document

function viewCalendar()
{
  
  if (this.document.getElementById('calendar').className=='calendar')
  {
    this.document.getElementById('calendar').className = 'calVisible';
    this.document.getElementById('calendarLink').style.color = 'Black';
  }
  else
  {
    this.document.getElementById('calendar').className = 'calendar';
    this.document.getElementById('calendarLink').style.color = '#959595';
  }
  
}


var activeImgScr = "";
function switchImage(thumbId){
	iPath = imagesData[thumbId-1][1];
	iTitle = imagesData[thumbId-1][2]; 
	if (document.getElementById("t"+previousThumbID))
	{	
		var prevThumb = document.getElementById("t"+previousThumbID);
		prevItems = prevThumb.getElementsByTagName("div");
		for (var a=0;a<prevItems.length;a++){
			var tDiv = prevItems[a];
			if (tDiv.className.indexOf("thumbRaster") != -1)
			{			
				tDiv.className = "thumbRaster hidden";
			}
		}
		
	}
	previousThumbID = thumbId;
	if (document.getElementById("t"+thumbId))
	{	
		var thisThumb = document.getElementById("t"+thumbId);
		thisItems = thisThumb.getElementsByTagName("div");
		for (var a=0;a<thisItems.length;a++){
			var tDiv = thisItems[a];
			if (tDiv.className.indexOf("thumbRaster") != -1)
			{
				tDiv.className = "thumbRaster";
			}
		}
	}
	if (document.getElementById("detailImage"))
	{
		activeImgScr = iPath;
		var strTitle = "";
		var iAlt = "&copy; idhea";
		if (iTitle != undefined)
		{
			iAlt = iTitle;
			//strTitle = "<br />"+iTitle;
		}
		iSrc = "<a href=\"javascript:nextImage();\"><img src=\""+iPath+"\" alt=\""+iAlt+"\" border=\"0\" /></a>";
		document.getElementById("detailImage").innerHTML = iSrc;
	}
	if (document.getElementById("photoTitle")){
		document.getElementById("photoTitle").innerHTML = iTitle;
	}
}

function nextImage(){
	if (activeImgScr == "") activeImgScr = imagesData[0][1];
	for (var i=0;i<imagesData.length;i++)
	{
		if (imagesData[i][1]==activeImgScr)
		{
			if (i<imagesData.length-1)
			{
				switchImage(imagesData[i+1][0],imagesData[i+1][1],imagesData[i+1][2]);
			} else if (i == imagesData.length-1)
			{
				switchImage(imagesData[0][0],imagesData[0][1],imagesData[0][2]);
			} else {
				//alert('fucking error');
			}
			break;
		}
	}
}