if(!rarebrick) var rarebrick = new Object();

rarebrick.currentPhoto = -1;
rarebrick.photos = [];

rarebrick.photoPortfolio = function() {
	//swfobject.createCSS("#slideshow", "height:100%;");
	//swfobject.createCSS("#slideshow", "width:100%;");
	swfobject.createCSS("#slideshow", "text-align:center;");
	
	var holder = document.getElementById('slideshow');
	for(var i=0; i<holder.childNodes.length; i++) {
		var child = holder.childNodes[i];
		if(child.nodeName.toLowerCase() == 'img') {
			child.style.display = 'none';
			child.style.width = 'auto';
			child.style.height = 'auto';
			child.onclick = rarebrick.getNextPhoto;
			rarebrick.photos.push(child);
		}
	}
	rarebrick.loadPhoto(0);
	rarebrick.getNextPhoto();
}

rarebrick.getNextPhoto = function() {
	//alert('next');
	var photo;
	
	//turn off current
	if(rarebrick.currentPhoto != -1) {
		photo = rarebrick.photos[rarebrick.currentPhoto];
		photo.style.display = 'none';
	}
	
	//turn on next
	rarebrick.currentPhoto++;
	if(rarebrick.currentPhoto >= rarebrick.photos.length) rarebrick.currentPhoto = 0;
	photo = rarebrick.photos[rarebrick.currentPhoto];
	photo.style.display = 'block';
	rarebrick.loadPhoto(rarebrick.currentPhoto+1);
}

rarebrick.loadPhoto = function(which) {
	try {
		photo = rarebrick.photos[which];
		photo.src = photo.src.replace('/small', '');
	} catch(e) {}
}

if(!rarebrick.useFlash()) swfobject.addDomLoadEvent(rarebrick.photoPortfolio);
