
function HeaderPhotos(){
	this.m_items = null;
	this.interval = null;
	this.idx = parseInt(Math.random() * 18);
}

HeaderPhotos.prototype.onDocReady = function(){
	var self = this;
	
	this.m_items = $("#header .photosContainer .photo");
	
	// show first
	this.m_items.eq(self.idx).fadeIn();
	
	window.setTimeout("g_headerPhotos.showNext()",4000);
}

HeaderPhotos.prototype.showNext = function(){
	var oldIdx = this.idx;
	
	// get new idx
	this.idx++;
	if(this.idx == 19)
		this.idx = 0;
	
	this.m_items.eq(this.idx).fadeIn();
	this.m_items.eq(oldIdx).fadeOut();
	
	window.setTimeout("g_headerPhotos.showNext()",4000);
}

////////////////////////////////////////////////////////////////////////////
// one and only
// 
var g_headerPhotos = new HeaderPhotos();

$(document).ready(function(e){

	g_headerPhotos.onDocReady();

});
