// JavaScript Document

$(function(){
	$.fn.showContent=function(settings){
			st=$.extend({
				closeStyle:"#close"			
			},settings);	
			st.oTarget=null;
			$($(this).attr("data")).css({display:"none"});
			$(this).click(function(){
				showBg();
				st.oTarget=$(this).attr("data");
				sTop=document.documentElement.clientHeight-$(st.oTarget).height();				
				sTop=sTop/2+document.documentElement.scrollTop;				
				sLeft=($("body").width()-$(st.oTarget).width())/2;				
				$(st.oTarget).css({
					position:"absolute",
					left:sLeft+"px",
					top:sTop+"px",
					zIndex:200
				}).fadeIn();
				return false;
			});
			function showBg(){
				$("body").append("<div id='showBg'></div>");
				$("#showBg").css({
					display:"none",
					position:"absolute",
					top:"0px",
					left:"0px",
					zIndex:1,
					width:$(document).width()+"px",
					height:$(document).height()+"px",
					background:"#000",
					opacity:0.5
				}).fadeIn();
				$("#showBg").click(function(){
					$(this).fadeOut();
					$(st.oTarget).fadeOut();
				});				
			}
			$(st.closeStyle).css({cursor:"pointer"}).click(function(){
					$("#showBg").fadeOut();
					$(st.oTarget).fadeOut();
				});			
		}
	
});
