//rotate image. sorry forgot source.... was minimized..
//adapted that 1 is the first

jQuery.fn.rotateimage=function(a){
	return this.each(
		function(){
			if(a&&a.constructor==String){
				switch(a){
					case"stop":
						if(this.cont){
							this.cont.attr("src",this.orig)
						}
						if(this.cycleInterval){
							clearInterval(this.cycleInterval)
						}
						this.cycleInterval=0;
						return;
					default:
				}
			}
			var c=jQuery(this);
			this.cont=jQuery(this);
			this.orig=this.cont.attr("src");
			b(c);
			this.cycleInterval=setInterval(function(){b(c)},500)
		}
	);

	function b(e,d){
		var h=e.attr("src");
		var c=e.attr("maxthumbs");
		if(!h.match(/thumb\.jpg$/)){
			var g=parseInt(h.match(/(\d+)\.jpg$/)[1]);
			if(g>c-1){
				g=0
			}
			var f=h.replace(/(\d+)\.jpg$/g,g+1)+".jpg";
			e.attr("src",f)}
		}
	};

	function setRotateImages(){
		jQuery(".rotateimg").hover(function(){
			jQuery(this).rotateimage()
		},function(){
			jQuery(this).rotateimage("stop")
		}
		)
	}

	function unsetRotateImages(){
		jQuery(".rotateimg").unbind()
	}

	jQuery(document).ready(function(){setRotateImages()});
