/**
 * functions.js
 * Zentrale Javascript-Datei
 *
 * @version 2009-01-20
 *
 */
 
	/*----------------------------------------------------------------
		Regelt Seitenhintergrund
	  ----------------------------------------------------------------*/
	var Page = Class.create();
	
	Page.prototype = {
		initialize: function(params) {
			if (typeof params == 'undefined') params = new Object();
			
			if (params.bgContainerId) {
				this.bgContainerId = params.bgContainerId;
			} else {
				this.bgContainerId = 'backgroundBeasties';
			}
			
			$(this.bgContainerId).setOpacity(0.1);
			this.resizeBackground();
			
			Event.observe(window, 'resize', this.resizeBackground.bindAsEventListener(this));
			Event.observe(document, 'scroll', this.resizeBackground.bindAsEventListener(this));
			
		},
		
		/**
		* function resizeBackground
		* Passt die Gr��e der Hintergrundebene beim Scrollen oder �ndern der Fenstergr��e an.
		*
		*/
		resizeBackground: function() {

			dimensions = document.viewport.getDimensions();
			scrollOffsets = document.viewport.getScrollOffsets();
			
			bodyPaddingTop = parseInt($('bodyContainer').getStyle('padding-top'));
			
			width = dimensions.width + scrollOffsets.left;
			height = dimensions.height + scrollOffsets.top + bodyPaddingTop;

			$(this.bgContainerId).setStyle({width: width+'px', height: height+'px'});

			//console.info(dimensions)
			//console.info(scrollOffsets)
			//console.info(parseInt(width))	

		}

	}