/*--------------
	
	Developed By: Guozhi
	Version: 0.1.0
	Copyright: Ggv
	
	
----------------*/

(function($){  
$.fn.fixedBox = function(o) {
	o = $.extend({speed:"normal", box:""}, o || {});
	return this.each(function(){
		var me = $(this),
			box = $("." + o.box + ":first");
			bg = box.find("div.fixedBg");
			content = box.find("div.content");
			closeBox = box.find("span.closeBox");
			marTop = Number(content.css("height").slice(0, -2));
			contentH = ($(window).height() - marTop) / 2;
		
		box.height($(window).height());
		bg.height($(window).height());
		content.css({"margin-top":contentH + "px" });
		bg.css({opacity: '0'});
		
		me.click(function(){
			//$("body").css({"height":"100%"});
			box.find("div.fixedBg").animate({opacity: '0.6'}, o.speed);
			box.css({"display":"block"});
			box.find(".scrollBox").jscroll({W:"2px",Btn:{btn:false}});
		});
		closeBox.click(function(){
			//$("body").css({"height":"auto"});
			box.find("div.fixedBg").animate({opacity: '0'}, o.speed, function(){
				box.css({"display":"none"});
			});
		});
		
	});
	
};
})(jQuery); 
