function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function ReiheObj(rf_id,cover_dir,images_dir) {

			var rfid = rf_id;
			var books = eval(rfid + "books");
			var links = eval(rfid + "links");
			var alttexts = eval(rfid + "alt");
			this.cover_dir = cover_dir;
			this.images_dir = images_dir;
			this.books = books;
			this.book_pos = 0;
			
			var rf_width = 700;
			var animation_steps = 10;
			var animation_total_time = 500;
			
			var button_width = 18;
			var button_height = 18;
			
			// Cover-Werte
			this.covers_count = 5; // Anzahl sichtbarer Cover			
			var covers_width = 120;
			var covers_height = 188;
			
			var rf_height = covers_height;
			
			// Verschiebung gegen den Rand
			var covers_shift = 0;
			
			var covers_spacing = Math.round((rf_width-covers_shift)/this.covers_count-covers_width);
			
			
			// Animation-Werte
			var animation_act_step;
			var animation_direction; //-1 or 1
			var animation_running = 0;  // 0 = No,  1= Normal
			var animation_stopped = false;
			var rf_ani;
			
			// Cover-Arrays
			var covers = new Array(this.covers_count + 1);
			var cover_links = new Array(this.covers_count + 1); 
			
			// Diese Variable zeigt an, welcher Array-Index das erste von links sichtbare Cover ist
			var covers_first_visible;
			
			this.load_next_covers= function(change_book_pos) {
			
			
				if(change_book_pos == 1) {
					if(animation_direction == 1 && this.book_pos == 0)
						this.book_pos = books.length - 1;
					else
					if(animation_direction == -1 && this.book_pos == books.length - 1)
						this.book_pos = 0;
					else
						this.book_pos = this.book_pos - animation_direction;
				}
				
				
				// Links
				for(var i = -1; i < this.covers_count + 1; i++) {
					id = (covers_first_visible + i) % (this.covers_count + 2);
					if(id == -1)
						id = this.covers_count + 1;
					if(books.length > this.book_pos + i) {
						covers[id].src = this.cover_dir + books[this.book_pos + i]+".png";
						covers[id].alt = alttexts[this.book_pos + i];
						covers[id].style.display = "block";
						cover_links[id].href = links[this.book_pos + i];
						cover_links[id].title = alttexts[this.book_pos + i];
					}else
						covers[id].style.display = "none";
				}
				
				if(this.book_pos > 0) 
					document.getElementById(rfid+"_button_left").style.display = "block";
				else
					document.getElementById(rfid+"_button_left").style.display = "none";
					
				if(this.book_pos < this.books.length-this.covers_count) 
					document.getElementById(rfid+"_button_right").style.display = "block";
				else
					document.getElementById(rfid+"_button_right").style.display = "none";
				
				
			}
			
			
				
			
			this.rf_animation_step =  function() {
				// Links
				for(var i = 0; i < this.covers_count + 2; i++) {
					// Linkes Hidden-Cover
					if(((covers_first_visible == 0)&&(i == this.covers_count + 1))||(i==covers_first_visible-1)) {
						// Erscheint
						if(animation_direction==1)
							covers[i].style.left = -covers_width + Math.round((covers_width+covers_shift) * animation_act_step / animation_steps) + "px";
					} else
					// Linkes Außencover verschwindet
					if((animation_direction == -1)&&(i == covers_first_visible)) 
						covers[i].style.left = covers_shift - Math.round((covers_width+covers_shift) * animation_act_step / animation_steps) + "px";
					// Alle anderen
					else {
						if(i < covers_first_visible)
							covers[i].style.left = (this.covers_count + 2 - covers_first_visible + i)*covers_width+covers_shift + Math.round(covers_width * animation_act_step / animation_steps)*animation_direction + "px";
						else
							covers[i].style.left = (i - covers_first_visible)*covers_width+covers_shift + Math.round(covers_width * animation_act_step / animation_steps)*animation_direction + "px";
						
					}
				}

				
				animation_act_step++;
				
				if(animation_act_step > animation_steps) {				
					covers_first_visible = covers_first_visible - animation_direction;
					if(covers_first_visible == -1)
						covers_first_visible = this.covers_count + 1;
					
					if(covers_first_visible == this.covers_count + 2)
						covers_first_visible = 0;				
			
					this.load_next_covers(1);
					
					if((animation_direction == 1 && this.book_pos <= 0)||(animation_direction == -1 && this.book_pos >= books.length-this.covers_count))	
						animation_stopped = true;
					
					if(animation_stopped == true) {						
						clearInterval(rf_ani);			
					
						animation_running = 0;
						animation_stopped = false;
					}else				
						animation_act_step = 1;
				}	
			
			}
			
			this.rf_animation_start = function(direction) {
				this.load_next_covers(0);
				var self = this;
				if(animation_running==false) {
					animation_running = 1;
					animation_act_step = 1;
					animation_direction = direction;
					rf_ani = setInterval(function() {self.rf_animation_step()},Math.round(animation_total_time/animation_steps));
				}
			}		
			
			this.rf_animation_stop = function(direction) {
				if(animation_running==true) {
					animation_stopped = true;
				}
			}	
			
			
			// Stellt die Ausgangsposition der Covers her
			this.rf_position_covers = function() {
				covers_first_visible = 1;				
				// Links
				for(var i = 0; i < this.covers_count + 2; i++) {
					// Linkes Hidden-Cover
					if((i == covers_first_visible - 1)||((covers_first_visible == 0)&&(i == this.covers_count + 1))) 
						covers[i].style.left = -covers_width + "px";
					// Alle anderen
					else
						covers[i].style.left = (i - covers_first_visible)*(covers_width)+covers_shift + "px";
				
				}
					
			}
			
			// Erzeugt die Cover-Imgs
			this.rf_init_img = function() {
				for(var i = 0; i < this.covers_count + 2; i++) {
					cover_links[i] = document.createElement('a');
					cover_links[i].href = "#"+i;
									
					covers[i] = document.createElement('img');
					covers[i].alt = "";
					covers[i].width = covers_width;
					covers[i].height = covers_height;
					covers[i].style.position = "absolute";
					covers[i].style.border = "0px";
					cover_links[i].appendChild(covers[i]);		

					document.getElementById(rfid).appendChild(cover_links[i]);	
				}		
				
				covers_width = covers_width + covers_spacing;
				
				this.rf_position_covers();
			
			}
			
			// Init
			this.rf_init = function() {
				// Rackframe
				var rf = document.getElementById(rfid).style;
				rf.width = rf_width + "px";
				rf.height = rf_height + "px";	
				
				var el = document.getElementById(rfid+"_button_left").style;
				el.width = button_width + "px";
				el.height = rf_height + "px";
//				el.left = "0px";
//				el.top = Math.round((rf_height-button_height)/2) + "px";
				
				var el = document.getElementById(rfid+"_button_right").style;
				el.width = button_width + "px";
				el.height = rf_height + "px";
//				el.left = rf_width - button_width + "px";
//				el.top = Math.round((rf_height-button_height)/2) + "px";
								
				this.rf_init_img();
				
				this.load_next_covers(0);
			}	
}	