/**
* jQuery.zLayer.full v0.2 plugin
* Copyright (c) 2010 Devin R. Olsen
* Date: 12/10/2010
*
* Project Home: 
* http://www.devinrolsen.com/jquery-zlayers-plugin/
*/
$.fn.extend({   
	zlayer: function(options) {  
	var defaults = {  
	 canvas: document,
	 confine:'',
	 force:'push',
	 mass:10
	}    
		var options =  $.extend(defaults, options);
		var o = options;   
		var obj = $(this);//OBJECT
		var m = o.mass; //MASS VALUE
		var c = o.confine; //CONFINED VALUE	
		
		var factorX = 0;
		var factorY = 0;
		
		var winWidth = $(window).width();
		var winHeight = $(window).height();
		
		var diffx = obj.width() - obj.parent().width();
		var diffy = obj.height() - obj.parent().height();
		
		var x = 0;
		var y = 0;
		
		return this.each(function() {  
			$(o.canvas).mousemove(function(e){
				factorX = e.clientX / winWidth;
				factorY = e.clientY / winHeight;
				
				//alert(factorX);
				x = -(diffx*factorX);// + diffx;
				y = -(diffy*factorY);// + diffx;
				
				obj.stop().css({
					top:y,
					left:x
				});
				
			});
		});  
	}  
});
