if(typeof(PXS) == "undefined") { PXS={}; }
PXS.slider = {

	cp: 0,	// current page
	tp: 6,	// total pages (-1)
	w: 960,	// width of page
	tm: 0,	// timer,
	dl: 8000, // advance delay
	io: false, // track over state of mouse

	animate:function(){

		if(!this.io || (this.cp == this.io ) ) {
			$("#homemenu li").removeClass("current");
			$("#hm"+(this.cp + 1)).addClass("current");
			$("#hm-contents").stop().animate( {left: (this.cp * this.w) *-1 +"px"}, 750, 'swing' );
			this.advance();
		}
	},

	setCurrent: function(i) {
		this.cp = i - 1;
		this.io = i -1;
		PXS.slider.animate();
	},

	rollOut: function(i) {
		this.cp = this.io;
		this.io = false;
		this.advance();
	},

	advance: function(i) {
		clearTimeout ( this.tm );
		this.cp ++;
		if(this.cp > this.tp) this.cp = 0;
		this.tm = setTimeout('PXS.slider.animate()',this.dl);
	}

}

$(function(){

	PXS.slider.advance();

	$("#homemenu li").hover(
		function(){ PXS.slider.setCurrent( $(this).attr("id").replace("hm", "") ); },
		function(){ PXS.slider.rollOut()  }
	)

})