//<![CDATA[

//selects random image for home page photo
function selectPhoto() {
        
	var currentPath = location.pathname;
	//window.alert(currentPath);
	if (currentPath == "/index.shtml" || currentPath == "/") {    	
		photosContainer = document.getElementById('galleries');
		arrPhotos = photosContainer.getElementsByTagName('img');
		randomIndex = [(Math.floor(Math.random()*arrPhotos.length))];
		randomImgSrc = arrPhotos[randomIndex].src;

		lastFwdSlashPos = randomImgSrc.lastIndexOf('/');
		thumbImgPath = randomImgSrc.substring('0',lastFwdSlashPos);
		fullImgPath = thumbImgPath.replace('thumb','jpeg');

		thumbImgFileName = randomImgSrc.substring(lastFwdSlashPos);
		fullImgFileName = thumbImgFileName.replace('thumb','');

		imgSrc = fullImgPath + fullImgFileName;

	}
	/*else if (currentPath == "/contact.shtml") {
		photosPath = "photos/contact/";
		numberOfPhotos = 7;
		imgSrc = photosPath + [(Math.floor(Math.random()*numberOfPhotos + 1))] + ".jpg";
	}*/

	randomImage = new Image();
	randomImage.src = imgSrc; 
	
	document.getElementById("selected-photo").src = imgSrc;
	
	fadeObject("selected-photo",1500,0,100);
        
}

if (W3CDOM) {
	addOnloadEvent(selectPhoto);
}
//]]>
