(function($) {
	$(document).ready(function(){
		
	});
	$.ajaxLoad = function(divId,url,param){
		if (!$("#"+divId).length)
		{
			$("body").append('<div id="'+divId+'"></div>');
		}
		$.ajax({
			type: "POST",
			url: url,
			data: param,
			contentType: "application/x-www-form-urlencoded;charset=ISO-UTF-8",
			success: function(msg){
				$('#'+divId).html(msg);
				$("#"+divId).css("top",($(window).height()-$("#"+divId).height())/4+$(window).scrollTop());
				$("#"+divId).css("left",($("body").width()-$("#"+divId).width())/2);
			}
		});
	}
	$.closePopup = function(shadowId,contentId){
		if ($("#"+shadowId).length)
		{
			$("#"+shadowId).animate({
				opacity: 0
			},200,function(){
				$("#"+shadowId).remove();
			});
			$("#"+contentId).fadeOut(200,function(){
				$("#"+contentId).remove();
			});
		}
	}
	$.shadow = function(shadowId,contentId,url,param){
		$("body").append("<div id='"+contentId+"'></div>");
		if (document.getElementById('colaborare_flash'))
		document.getElementById('colaborare_flash').style.visibility= 'hidden';
		$("#"+contentId).hide();
		$.ajaxLoad(contentId,url,param);
		$("#"+contentId).css("background-color","#ededed");
		$("#"+contentId).css("border","4px solid #f15a25");
		$("#"+contentId).css("position","absolute");
		$("#"+contentId).css("z-index",3);
		$("#"+contentId).css("top",0);
		$("#"+contentId).css("left",0);
		$("body").append("<div id='"+shadowId+"'></div>");
		$("#"+shadowId).css("background-color","#000000");
		$("#"+shadowId).css("opacity",0);
		$("#"+shadowId).css("position","absolute");
		$("#"+shadowId).css("top",0);
		$("#"+shadowId).css("left",0);
		$("#"+shadowId).css("z-index",2);
		$("#"+shadowId).css("height",$("html").attr("scrollHeight"));
		$("#"+shadowId).css("width",$("body").width());
		$("#"+shadowId).click(function(){
			$.closePopup(shadowId,contentId);
			if (document.getElementById('colaborare_flash'))
			document.getElementById('colaborare_flash').style.visibility= 'visible';
		});
		$("#"+shadowId).fadeTo(200,0.5,function(){
			$("#"+contentId).show();
		});
	}
})(jQuery)
