jQuery(document).ready(function () {
	headerSlideShow.init(jQuery("div#headerimage img"));
	jQuery("img.ajax-loader").attr("src","/wp-content/themes/eiba/i/ajax-loader.gif");
});


headerSlideShow = {
	headerimages:	null,
	current:		0,
	anz:			0,
	delay:			5,
	speed:			800,
	effect:			"easeInOutQuint",
	
	init: 			function  (obj) {
						this.headerimages = jQuery(obj);
						this.anz = obj.length;
						if (this.anz > 1) {
							for (var i=0; i < this.anz; i++) {
								jQuery(this.headerimages[i]).css("position","absolute");
								jQuery(this.headerimages[i]).css("z-index","1");
								if (i > 0) jQuery(this.headerimages[i]).css("top","210px");
							}
							this.next();
						}
					},
	
	next:			function  () {
						setTimeout("headerSlideShow.slide()", (this.delay*1000));
					},
	
	slide:			function () {
						var img_out = this.headerimages[this.current];
						this.current = (this.current < (this.anz-1)) ? this.current += 1 : 0;
						var img_in = this.headerimages[this.current];
						
						jQuery(img_in).css("top","210px");
						jQuery(img_out).animate({"top": "-210px"}, {duration: this.speed, easing: this.effect});
						jQuery(img_in).animate({"top": "0px"},{duration:this.speed, easing: this.effect}, this.next());
					}
};