var ibkGalery = Class.create();

ibkGalery.prototype = {
	
	initialize: function(element, options){
		
		// interne Klassen-Variablen
		this.element   		  = element;
		this.ibk_slider 	  = 0;
		this.autoibk_slider = 0;
		this.ibk_sliders 	= new Array();
		this.texts   			= new Array();
		this.imagess 			= new Array();
		this.slideContainer = new Array();
		
		// standard options
		this.opts = {
			ibk_slideWidth:  500,
			ibk_slideHeight: 333,
			ibk_slideBorder:  20,
			textBoxHeight:    40,
			effektTime:        3,
			waitTime: 				 2,
			effekt:    'ibk_zoom',
			textColor:  '#FFFF00',
			frameColor: '#ABCDEF',
			magnify: 				 true,
			autoStart: 			 true,
			slidePosition:      0,
			modus:					'work'
		};
		
		Object.extend(this.opts, options);

		this._ibk_slideWidth  = this.opts.ibk_slideWidth;
		this._ibk_slideHeight = this.opts.ibk_slideHeight;
		this._ibk_slideBorder = this.opts.ibk_slideBorder;
		this._textBoxHeight = this.opts.textBoxHeight + 1;
		this._effektTime = this.opts.effektTime;
		this._effekt = this.opts.effekt;
		this._textColor = this.opts.textColor;
		this._frameColor = this.opts.frameColor;
		this._magnify = this.opts.magnify;
		this._waitTime = this.opts.waitTime;
		this._autoStart = this.opts.autoStart;
		this._ibk_slide_position = this.opts.slidePosition;
		this._containerHeight = this._ibk_slideHeight + this._textBoxHeight + this._ibk_slideBorder; 
		this._modus = this.opts.modus;
		
		// einlesen der Galerie-Elemente
		this.steuerung = this.element.select('.steuerung')[0]
		this.b_button = this.element.select('.s_b')[0];
 		this.s_button = this.element.select('.s_s')[0];
 		this.f_button = this.element.select('.s_f')[0];
 		this.ff_button = this.element.select('.s_ff')[0];
		this.slide_container = this.element.select('.ibk_slide_container')[0];
		this.counter = this.element.select('.ibk_counter')[0];
		
		// Formatieren des Galerie-Containers
		
		this.element.setStyle({
	 				backgroundColor: this._frameColor,
	 				borderWidth: this._ibk_slideBorder + 'px', 
	 				borderStyle: 'solid',
	 				borderColor:  this._frameColor,
	 				color: this._textColor,
	 				width: this._ibk_slideWidth + 'px'
			});
			
			this.slide_container.setStyle({
	 				width: this._ibk_slideWidth + 'px', 
	 				height: this._containerHeight + 'px',
	 				display: 'block'
	 		});
	 		if (this._modus == 'bearbeiten') {
	 			this.slide_container.setStyle({
	 				overflow: 'auto'
	 			});
	 		}
	 		
	 		this.steuerung.setStyle({
	 				backgroundColor: this._frameColor,
	 				width: this._ibk_slideWidth + 'px'
	 		});
		

	 		// anbinden der Events an die Buttons
	 		
			Event.observe(this.b_button, 'click', function(e){this._ibk_slideCheck('back')}.bindAsEventListener(this));
			Event.observe(this.s_button, 'click', function(e){this._stopibk_slide()}.bindAsEventListener(this));
			Event.observe(this.f_button, 'click', function(e){this._ibk_slideCheck('go')}.bindAsEventListener(this));
			Event.observe(this.ff_button, 'click', function(e){this._ibk_slideAuto()}.bindAsEventListener(this));
			
			
			// evtl. content entfernen
			this.element.select('.ibk_mbb_content').each(function(elm,i) {
				elm.remove();
			});
			
	 		// einlesen der Bilder
	
	 		this._ibk_slide_contents = this.element.select('.ibk_mbb_imagebox').each(function(elm,i) {
	
	 			var my_ibk_slider  = elm.getElementsByClassName('ibk_imgholder')[0] || false;
	 			var my_image   		 = elm.getElementsByClassName('ibk_mbb_image')[0] || false;
	 			var my_text    		 = elm.getElementsByClassName('ibk_mbb_caption')[0] || false;	

	 			
	 			// Bild-Text-Box formatieren
	 			if (this._modus == 'bearbeiten') {
					elm.setStyle({position: 'relative'});
					elm.setStyle({height: '50px'});
					elm.setStyle({width: '50px'});
					elm.setStyle({zIndex: 1});
					elm.setStyle({margin: '0px'});
		 			elm.setStyle({borderWidth: '0px'});
		 			elm.setStyle({padding: '0px'});
		 		}
		 		else {
		 			elm.setStyle({position: 'absolute'});
					elm.setStyle({height: this._containerHeight+'px'});
					elm.setStyle({top: '0px'});
					elm.setStyle({left: '0px'});
					elm.setStyle({zIndex: 1});
					elm.setStyle({margin: '0px'});
		 			elm.setStyle({borderWidth: '0px'});
		 			elm.setStyle({padding: '0px'});
		 		}
		 			
		 		this.slideContainer[i] = elm;
	 			
	 			// Bildhalter formatieren
	 			
				if (my_ibk_slider) {
					if (this._modus == 'bearbeiten') {
						var bw = this._ibk_slideWidth - 70;
						my_ibk_slider.setStyle({position: 'absolute'});
						my_ibk_slider.setStyle({backgroundColor: this._frameColor});
						my_ibk_slider.setStyle({width: 'auto'});
						my_ibk_slider.setStyle({height: '50px'});
					}
					else {
						my_ibk_slider.setStyle({position: 'absolute'});
						my_ibk_slider.setStyle({backgroundColor: this._frameColor});
						my_ibk_slider.setStyle({width: this._ibk_slideWidth + 'px'});
						my_ibk_slider.setStyle({height: this._ibk_slideHeight + 'px'});
						my_ibk_slider.setStyle({overflow: 'hidden'});
						my_ibk_slider.setStyle({display: 'none'});
					}
					this.ibk_sliders[i] = my_ibk_slider;
				}
				else this.ibk_sliders[i] = false;
	 			
				// Textbox
				if (my_text) {
					if (this._modus == 'bearbeiten') {
						var bw = this._ibk_slideWidth - 70;
						my_text.setStyle({position: 'absolute'});
						my_text.setStyle({left: '50px'});
						my_text.setStyle({width: bw + 'px'});
		 				my_text.setStyle({backgroundColor: this._frameColor});
		 				my_text.setStyle({color: this._textColor});
		 			}
		 			else {
		 				my_text.setStyle({position: 'absolute'});
		 				my_text.setStyle({backgroundColor: this._frameColor});
		 				my_text.setStyle({color: this._textColor});
		 				my_text.setStyle({width: this._ibk_slideWidth + 'px'});
		 				my_text.setStyle({height: this._textBoxHeight+'px'});
		 				my_text.setStyle({bottom: '12px'});
		 				my_text.setStyle({left: '0px'});
		 				my_text.setStyle({padding: '0px'});
		 				my_text.setStyle({overflow: 'auto'});
		 				if (my_text.getStyle('display') == 'none') my_text.setStyle({visibility: 'hidden'});

		 			}
		 			this.texts[i] = my_text;
		 				
	 			}	
	 			else this.texts[i] = false;
	 				
	 			if (my_image) {
	 				// Bild anpassen in Breite und Hoehe
	 				var oW = parseInt(my_image.style.width);
	 				var oH = parseInt(my_image.style.height);
	 				
	 				if (this._modus == 'bearbeiten') {
	 					var nD = this._resizeValues(50,50,oW,oH,this._magnify);
		 				var nW = nD[0];
		 				var nH = nD[1];
						var dH = Math.floor((50 - nW) / 2);
		 		    var dV = Math.floor((50 - nH) / 2);
		
		 				// style anpassen
		 				my_image.setStyle({'float': 'none',
											 					width: nW + 'px',
											 					height: nH + 'px'
		 				});
		 			}
		 			else {
		 				var nD = this._resizeValues(this._ibk_slideWidth,this._ibk_slideHeight,oW,oH,this._magnify);
		 				var nW = nD[0];
		 				var nH = nD[1];
						var dH = Math.floor((this._ibk_slideWidth  - nW) / 2);
		 		    var dV = Math.floor((this._ibk_slideHeight - nH) / 2);
		
		 				// style anpassen
		 				my_image.setStyle({'float': 'none',
											 					width: nW + 'px',
											 					height: nH + 'px',
											 					position: 'absolute',
											 					top: dV + 'px',
											 					left: dH + 'px'
		 				});
		 			}
	
	 				this.imagess[i] = my_image;
				} 
				else this.imagess[i] = false;
					

	 		}.bind(this));
	 		
	 		// Start-Parameter
		  this._anzahl2ibk_slide         = this._ibk_slide_contents.length;
		  
		  // counter einsetzen
	    var ibk_slide_counter = this._ibk_slide_position + 1;
	    
	    this.counter.update(ibk_slide_counter + '/' + this._anzahl2ibk_slide);
		    
		  // nicht im Bearbeiten-Modus ausfuehren
	 		if (this._modus == 'bearbeiten') {
					this.element.select('.ibk_mbb_master').each(function(elm,i) {
						//elm.setStyle({display: 'inline'});
					});
		   
		  }
		  else {
			  // zeigen des ersten elements, falls vorhanden
		    if (this._anzahl2ibk_slide > 0) {
		      this._ibk_slide_contents[0].setStyle({display: 'block'});
		      this._ibk_slide_contents[0].setStyle({zIndex: 10});
		      this.ibk_sliders[0].setStyle({display: 'block'});
		    }
		    
		    // Stop-Button deaktivieren
		    new Effect.Opacity('s_s', { from: 1.0, to: 0.5, duration: 0.5 });
		    
		    // autostart anwerfen
		    if (this._autoStart == true) {
					// buttons umswitchen
					
					// timeout setzen
		    	setTimeout(function(){
						this._ibk_slideAuto();
					}.bind(this), this._waitTime * 1000);
		    }
		  }

	},
	
	
	// proportionale resize Funktion
	
	_resizeValues: function(maxW,maxH,elmW,elmH,grow) {
		 var ratio = elmW / elmH;
	
		 if (maxW/maxH > ratio) {
		 		var w = Math.round(maxH * ratio);
		 		var h = maxH;
		 }
		 else {
				var h = Math.round(maxW / ratio);
				var w = maxW
		 }
	
			if (grow == false) {
				if (maxH > elmH && maxW > elmW) {
					h = elmH;
					w = elmW;
				}
			}
		 var ret = new Array();
		 ret[0] = w;
		 ret[1] = h;
		 
		 return ret;
	 },
	 
	 _ibk_slideAuto: function() {
	 	if(this.autoibk_slider == 0 && this.ibk_slider == 0) {
	 		this._ibk_slideGo('go');
	 		this.autoibk_slider = setInterval(function(){
																this._ibk_slideGo('go')
															}.bind(this), (this._waitTime + this._effektTime) * 1000 );

	 		// Button ausblenden
	 		new Effect.Opacity(this.ff_button, { from: 1.0, to: 0.5, duration: 0.5 });
	 		new Effect.Opacity(this.f_button, { from: 1.0, to: 0.5, duration: 0.5 });
	 		new Effect.Opacity(this.b_button, { from: 1.0, to: 0.5, duration: 0.5 });
	 		new Effect.Opacity(this.s_button, { from: 0.5, to: 1.0, duration: 0.5 });
	 	}
	 },
	 
	 _stopibk_slide: function () {
	 	if (this.autoibk_slider) {
	 		clearInterval(this.autoibk_slider);
	 		this.autoibk_slider = 0;
	 		new Effect.Opacity(this.ff_button, { from: 0.5, to: 1.0, duration: 0.5 });
	 		new Effect.Opacity(this.f_button, { from: 0.5, to: 1.0, duration: 0.5 });
	 		new Effect.Opacity(this.b_button, { from: 0.5, to: 1.0, duration: 0.5 });
	 		new Effect.Opacity(this.s_button, { from: 1.0, to: 0.5, duration: 0.5 });
	 	}
	 },
	 
	 _ibk_slideCheck: function (how) {
	 	if (!this.ibk_slider && !this.autoibk_slider) {
			this._ibk_slideGo(how);
	 	}
	 },
	 
	 // slideshow
	 _ibk_slideGo: function (how) {
	 		if (this._anzahl2ibk_slide > 1) {
	 			
		 		// elemente auslesen
		 		var old_elm = this._ibk_slide_contents[this._ibk_slide_position];
		 		if (how == 'back') {
		 			this._ibk_slide_position --;
			 		if (this._ibk_slide_position < 0) this._ibk_slide_position = this._anzahl2ibk_slide - 1;
			 	}
			 	else {
			 		this._ibk_slide_position ++;
			 		if (this._ibk_slide_position >= this._anzahl2ibk_slide) this._ibk_slide_position = 0;
			 	}
		 		var new_elm = this._ibk_slide_contents[this._ibk_slide_position];

		 		// Unterelemente auslesen
		 		var my_ibk_slider = this.ibk_sliders[this._ibk_slide_position];
		 		var my_text       = this.texts[this._ibk_slide_position];
		 		
		 		// Element-Position tauschen

			 	new_elm.setStyle({zIndex: 10,
			 		visibility: 'hidden',
			 		display: 'block'
			 	});
			 	
			 	old_elm.setStyle({zIndex: 5});
	
		 		// neues Element anzeigen, aber verstecken
		 		my_ibk_slider.setStyle({display: 'none'});
		 		my_text.setStyle({display: 'none'});
		 		new_elm.setStyle({visibility: 'visible'});
			 	
		 		// Bild-Effekt aufrufen
		 		g = this._changeImage(my_ibk_slider,old_elm);
		 		
		 		// Text-Effekt
		 		new Effect.Appear(my_text, {
		 					duration: 1
		 		});
		 		
		 		// counter hochzählen
      	var ibk_slide_counter = this._ibk_slide_position + 1;
      	this.counter.update(ibk_slide_counter + '/' + this._anzahl2ibk_slide);
		 	}
		 
	 },
	 
	 _changeImage: function(new_elm,old_elm) {
			
			var effect = this._effekt;
			var time   = this._effektTime;
			
			var w   = new_elm.getWidth();
			var h   = new_elm.getHeight();
			var t   = Math.floor(h / 2);
			var l   = Math.floor(w / 2);

			var im   = new_elm.getElementsByClassName('ibk_mbb_image')[0];
			// Bild-Dimensionen
			var imw  = parseInt(im.style.width);
			var imh  = parseInt(im.style.height);
			// halbe Bild-Dimensionen
			var imw2 = Math.ceil(imw / 2);
			var imh2 = Math.ceil(imh / 2);
			// halbe Bild<->Rahmen-Abstand
			var imt  = Math.floor((h - imh) / 2);
			var iml  = Math.floor((w - imw) / 2);
			
			if (effect == 'random') {
				var effects = Array('ibk_zoom_random','ibk_zoom','ibk_grow_topleft','ibk_fade','ibk_unfold_vertical_stay','ibk_unfold_vertical','ibk_unfold_horizontal_stay','ibk_unfold_horizontal','ibk_fall_down','ibk_slide_down','ibk_slide_left','ibk_slide_up','ibk_slide_right');
				var maxEffects = effects.length;
				var rnd_no = Math.floor(maxEffects*Math.random());
				effect = effects[rnd_no]
			}
			
	  	switch(effect) {
	  		case 'ibk_zoom':
	  			// container in Mitte setzen
	  			new_elm.setStyle({display: 'block', 
	  												top: t+'px', 
	  												height: '0px',
	  												left: l + 'px',
	  												width: '0px'
	  												});
	  			// bild ausrichten
	  			var yy = t - imt;
	  			var xx = l - iml;
	  			
	  			im.setStyle({top: '-' + yy + 'px',
	  									left: '-' + xx + 'px'
	  			});
	  			
		      f = new Effect.Parallel([
					   new Effect.Morph(new_elm, {
						   	sync: true,
			 					style:'height: ' + h + 'px; width: ' + w + 'px; left: 0px; top: 0px;',
			         	duration: time,
			         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
			         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      	}),
					   new Effect.Morph(im, {
						   	sync: true,
			 					style:'top: ' + imt + 'px; left: ' + iml + 'px;',
			         	duration: time
		      	})
							], {  duration: time }
						);

	  		break;
	  		
	  			case 'ibk_zoom_random':
	  			t = Math.floor(Math.random() * h);
	  			l = Math.floor(Math.random() * w);
	  			
	  			// container in Mitte setzen
	  			new_elm.setStyle({display: 'block', 
	  												top: t+'px', 
	  												height: '0px',
	  												left: l + 'px',
	  												width: '0px'
	  												});
	  			// bild ausrichten
	  			var yy = t - imt;
	  			var xx = l - iml;
	  			
	  			im.setStyle({top: '-' + yy + 'px',
	  									left: '-' + xx + 'px'
	  			});
	  			
		      f = new Effect.Parallel([
					   new Effect.Morph(new_elm, {
						   	sync: true,
			 					style:'height: ' + h + 'px; width: ' + w + 'px; left: 0px; top: 0px;',
			         	duration: time,
			         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
			         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      	}),
					   new Effect.Morph(im, {
						   	sync: true,
			 					style:'top: ' + imt + 'px; left: ' + iml + 'px;',
			         	duration: time
		      	})
							], {  duration: time }
						);

	  		break;
	 
	  		case 'ibk_grow_topleft':
		  		f = new Effect.Grow(new_elm, {
	 					duration: time, 
	 					direction: 'top-left',
	 					beforeStart: function() { this.ibk_slider = 1 }.bind(this),
	 					afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
	 				});
	  		break;
	  		
	  		case 'ibk_fade':
		  		f = new Effect.Appear(new_elm, {
		 					duration: time,
		 					beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		 					afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		 		});
	  		break;
	  		
	  		case 'ibk_unfold_vertical_stay':
	  			// aus der Mitte - nach oben und unten
					new_elm.setStyle({display: 'block', top: t+'px', height: '0px'});
					// Rahmen wandert
					
					im.setStyle({top: '-' + t + 'px'});
					
					f = new Effect.Parallel([
					   new Effect.Morph(new_elm, {
					   	sync: true,
		 					style:'height: ' + h + 'px; top: 0px;',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      	}), 
					   new Effect.Morph(im, {
					   	sync: true,
		 					style:'top: 0px;',
		         	duration: time
		      	})
						], {  duration: time }
						);
      	break;
      	
      	case 'ibk_unfold_vertical':
	  			// aus der Mitte - nach oben und unten
					new_elm.setStyle({display: 'block', top: t+'px', height: '0px'});
					// Rahmen wandert
		 			f = new Effect.Morph(new_elm, {
		 					style:'height: ' + h + 'px; top: 0px;',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      });
      	break;
      	
      	case 'ibk_unfold_horizontal_stay':
				// aus der Mitte - nach rechts und links
					new_elm.setStyle({display: 'block', left: l+'px', width: '0px'});
		 			f = new Effect.Morph(new_elm, {
		 					style:'width: ' + w + 'px; left: 0px;',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
	      	});
	      	
	      	im.setStyle({left: '-' + imw2 + 'px'});
		      new Effect.Morph(im, {
		 					style:'left: ' + iml + 'px',
		         	duration: time
		      });
		      
      	break;
      	
      	case 'ibk_unfold_horizontal':
				// aus der Mitte - nach rechts und links
					new_elm.setStyle({display: 'block', left: l+'px', width: '0px'});
		 			f = new Effect.Morph(new_elm, {
		 					style:'width: ' + w + 'px; left: 0px;',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
	      	});
      	break;
      	
      	case 'ibk_fall_down':
					new_elm.setStyle({display: 'block', height: '0px'});
		 			
		 			f = new Effect.Morph(new_elm, {
		 					style:'height: ' + h + 'px',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      });

		      im.setStyle({top: '-' + h + 'px'});
		      new Effect.Morph(im, {
		 					style:'top: ' + imt + 'px;',
		         	duration: time
		      });
		      
      	break;
      	
      	case 'ibk_slide_down':
					// aus der Mitte - nach rechts und links
					new_elm.setStyle({display: 'block', height: '0px'});
		 			f = new Effect.Morph(new_elm, {
		 					style:'height: ' + h + 'px',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      });
      	break;
      	
      	case 'ibk_slide_left':
					// aus der Mitte - nach rechts und links
					new_elm.setStyle({display: 'block', width: '0px'});
		 			f = new Effect.Morph(new_elm, {
		 					style:'width: ' + w + 'px',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      });
      	break;
      	
      	case 'ibk_slide_up':
					// aus der Mitte - nach rechts und links
					new_elm.setStyle({display: 'block', height: '0px', top: h + 'px'});
		 			f = new Effect.Morph(new_elm, {
		 					style:'height: ' + h + 'px; top: 0px',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0; }.bind(this)
		      });
      	break;
      	
      	case 'ibk_slide_right':
					// aus der Mitte - nach rechts und links
					new_elm.setStyle({display: 'block', width: '0px', left: w + 'px'});
		 			f = new Effect.Morph(new_elm, {
		 					style:'width: ' + w + 'px; left: 0px',
		         	duration: time,
		         	beforeStart: function() { this.ibk_slider = 1 }.bind(this),
		         	afterFinish: function() { old_elm.setStyle({display: 'none'}); this.ibk_slider = 0;}.bind(this)
		      });
      	break;
      	
	  		default:
	  			new_elm.setStyle({display: 'block'});
	  			old_elm.setStyle({display: 'none'})
	  		break;

	  	} 
	  	return f;
	 },
	 
	 changeEffekt: function(newEffekt) {
	 		this._effekt = newEffekt;
	 },
	 
	 changeEffektTime: function(newEffektTime) {
	 		var wasrunning = 0;
	 		// anhalten der slideshow
	 		if (this.autoibk_slider) {
	 			this._stopibk_slide();
	 			var wasrunning = 1;
	 		}
	 		// aendern der Zeit
	 		this._effektTime = newEffektTime;
	 		// restarten der slidshow
	 		if (wasrunning == 1) {
		 		setTimeout(function(){
					this._ibk_slideAuto();
				}.bind(this), this._effektTime * 1000);
			}
	 },
	 
	 changeWaitTime: function(newWaitTime) {
	 		var wasrunning = 0;
	 		// anhalten der slideshow
	 		if (this.autoibk_slider) {
	 			this._stopibk_slide();
	 			var wasrunning = 1;
	 		}
	 		// aendern der Zeit
	 		this._waitTime = newWaitTime;
	 		// restarten der slidshow
	 		if (wasrunning == 1) {
		 		setTimeout(function(){
					this._ibk_slideAuto();
				}.bind(this), this._effektTime * 1000);
			}
	 },
	 
	 changeContainerSize: function(w,h) {
	 	
	 		this._ibk_slideHeight = h;
	 		this._ibk_slideWidth  = w;
 			this._containerHeight = h + this._textBoxHeight + this._ibk_slideBorder;
	 		
	 		// container
			this.slide_container.setStyle({
	 				width: this._ibk_slideWidth + 'px', 
	 				height: this._containerHeight + 'px'
	 		});
	 		
	 		this.steuerung.setStyle({
	 				width: this._ibk_slideWidth + 'px'
	 		});
	 		
	 		
	 		this.slideContainer.each(function(elm,i) {
	 			elm.setStyle({
	 				height: this._containerHeight+'px'
	 			});
	 		}.bind(this));
	 		
	 		// bild
	 		this.imagess.each(function(elm,i) {
	 			var oW = parseInt(elm.style.width);
 				var oH = parseInt(elm.style.height);
 				var nD = this._resizeValues(this._ibk_slideWidth,this._ibk_slideHeight,oW,oH,this._magnify);
 				var nW = nD[0];
 				var nH = nD[1];
				var dH = Math.floor((this._ibk_slideWidth  - nW) / 2);
 		    var dV = Math.floor((this._ibk_slideHeight - nH) / 2);
	 			
	 			elm.setStyle({width: nW + 'px',
						 					height: nH + 'px',
						 					top: dV + 'px',
						 					left: dH + 'px'
 				});
	 		}.bind(this));
	 		
	 		// container
	 		this.ibk_sliders.each(function(elm,i) {
	 			elm.setStyle({
	 				width: this._ibk_slideWidth + 'px',
	 				height: this._ibk_slideHeight + 'px'
	 			});
	 		}.bind(this));
	 		
	 		// textbox
	 		this.texts.each(function(elm,i) {
	 			elm.setStyle({
	 				width: this._ibk_slideWidth + 'px',
	 				bottom: '16px',
	 				left: '0px'
	 			});
	 		}.bind(this));
	 		
	 },
	 
	 changeTextBoxHeight: function(h) {
	 	
	 		this._textBoxHeight   = h;
	 		this._containerHeight = this._ibk_slideHeight + h + this._ibk_slideBorder;
	 	
			this.slide_container.setStyle({
	 				height: this._containerHeight + 'px'
	 		});
	 		
			this.texts.each(function(elm,i) {
	 			elm.setStyle({
	 				height: this._textBoxHeight+'px'
	 			});
	 		}.bind(this));
	 		
	 		this.slideContainer.each(function(elm,i) {
	 			elm.setStyle({
	 				height: this._containerHeight+'px'
	 			});
	 		}.bind(this));

	 },
	 
	 changeContainerBorderWidth: function(w) {
	 	
	 		this._ibk_slideBorder = w;
	 		
	 		this.element.setStyle({
 				borderWidth: this._ibk_slideBorder + 'px' 
			});
	 },
	 
	 changeContainerColor: function(c) {
	 	 	this._frameColor = c;
	 		
	 		this.element.setStyle({
 				backgroundColor: this._frameColor,
 				borderColor:  this._frameColor
			});
 		
	 		this.steuerung.setStyle({
	 				backgroundColor: this._frameColor
	 		});
	 		
	 		this.ibk_sliders.each(function(elm,i) {
	 			elm.setStyle({
	 				backgroundColor: this._frameColor
	 			});
	 		}.bind(this));
	 		
	 		this.texts.each(function(elm,i) {
	 			elm.setStyle({
	 				backgroundColor: this._frameColor
	 			});
	 		}.bind(this));
	 },
	 
	 changeTextColor: function(c) {
	 		this._textColor = c;
	 		
	 		 this.element.setStyle({
 				color: this._textColor
			});
			
			this.texts.each(function(elm,i) {
	 			elm.setStyle({
	 				color: this._textColor
	 			});
	 		}.bind(this));
			
	 } 		

};

