function Parallax(scroll_selector) {
	this.layers = [];
	this.scroll_element = undefined;
	this.scroll_element =  typeof(scroll_selector) != 'undefined' ? $(scroll_selector) : $(window);
		
		
	this.scroll_element.scroll($.proxy(function(){ 
		var height = this.scroll_element.height();
		var scroll = this.scroll_element.scrollTop();

		this.moveLayers(scroll); 
	}, this));
 
	
	this.addLayer = function(layer) 
	{
		this.layers.push(layer);
		return this;
	};
	
	this.moveLayers = function(relative_scroll_top)
	{
		var count = this.layers.length;
		while ( count-- )
		{
			this.layers[count].element
				.css('top', this.layers[count].starting_top + (relative_scroll_top * (this.layers[count].percent_shift / 100)) );
				
		}
	};
};

function ParallaxLayer(selector, percent_shift) 
{
	this.element = $(selector);
	this.percent_shift = parseInt(percent_shift);
	this.starting_top = this.element.offset().top;
};
