(function($){

	$.overlay = function(options){
		
		$.overlay.prefs = $.extend({
			id: "overlay_background",
			color: "#000",
			opacity: 0.5,
			zindex: 1550,
			show_callback : function(){},
			hide_callback : function(){}
		},options);			
		$.overlay.overlay = $("<div/>").attr("id",$.overlay.prefs.id);
		$.overlay.overlay.appendTo("body").css({
			"z-index": $.overlay.prefs.zindex,
			opacity: 0,
			"background-color": $.overlay.prefs.color,
			height: "100%",
			width: "100%",
			position: "fixed",
			top: "0px",
			left: "0px",
			display: "none"
		});
		
		$.overlay.show_overlay = function(callback){
			$.overlay.overlay.css("display","block").animate({
				opacity: $.overlay.prefs.opacity
			},400,function(){
				if(typeof callback == "function") callback.call();
			});
			
		};
		
		$.overlay.hide_overlay = function(callback){
			$.overlay.overlay.animate({
				opacity: 0
			},400,function(){
				$.overlay.overlay.css("display","none")
				if(typeof callback == "function") callback.call();
			});
		}
		
	}
	
})(jQuery);


(function($){

	$.fn.grasverp = function(extra){
		
		return $(this).each(function(){
			
			if(!extra) extra = 15;
			var $obj = $(this);
			var _extra = extra;
			var _height = parseInt($obj.css("height"));
			var _hover_height = _extra + _height;
			//var _header = $obj.find("h2").text();
			//var _body = $obj.find("p").text();
			var _image = $obj.attr("img");
			$obj.hover(function(){
				$obj.stop().animate({
					height: _hover_height
				},200);
			},function(){
				$obj.stop().animate({
					height: _height
				},200);
			}).click(function(){
				show_popup(_image);
			});
						
		});

	}

	$.fn.products = function(){
		return $(this).each(function(){
			var $obj = $(this);
			var _image = $obj.attr("img");
			var _size = $obj.attr("size");
			//alert(_size);
			$obj.click(function(){
				show_popup(_image,_size);
			});
			var $image = $obj.find("img");
			$image.css({
				position: "relative"
			});
			
			$obj.hover(function(){
				
				$image.stop().animate({
					top: -10
				},200);
				
			},function(){
				$image.stop().animate({
					top: 0
				},200);
			});
			
		});

	}
	
})(jQuery);






