/* um content weich breiter und schmaler zu machen */
var SmoothScroll = new function() {

	var Content = false;
	var To = 0;
	var Pos = 550;
	var Int = false;
	var Step = 2;
	var ThisStep = 2;

	this.init = function() {
		var self = SmoothScroll;
	  if (!document.getElementById) return;
		self.Content = document.getElementById('Container');
		self.Pos = parseInt(self.Content.style.width.replace('px', ''));
	},
	
	this.resizeContentTo = function(pixels) {
		var self = SmoothScroll;
	  if (!document.getElementById) return;
		if (self.Int) { clearInterval(self.Int); self.Int = false; }
		if (!self.Pos) self.Pos = 550;
		if (!self.Step) self.Step = 40;
		self.To = pixels;
		self.ThisStep = 0;
		if (self.To > self.Pos) self.ThisStep = self.Step;
		if (self.To < self.Pos) self.ThisStep = -self.Step;
		if (self.ThisStep) self.Int = setInterval(self.doResizeTo, 1);
	},

	this.doResizeTo = function() {
		var self = SmoothScroll;
		self.Pos += self.ThisStep;
		self.Content.style.width = self.Pos+'px';
		// dout(self.Pos + ' ' + self.To + ' ' + Math.abs(self.Pos - self.To));
		if (
			(self.ThisStep > 0) && (self.Pos >= self.To) ||
			(self.ThisStep < 0) && (self.Pos <= self.To)
		  ) { clearInterval(self.Int); self.Int = false; }
	},
	
	this.cleanup = function() {
		var self = SmoothScroll;
		self.Content = null;
	}
}
addEvent(window, 'unload', SmoothScroll.cleanup);
addEvent(window, 'load', SmoothScroll.init);

