function openModal(){
	$(".modal").css("display","block");
	//$(".modal").css("height",$(window).height+"px");
	$(".modal").height($(window).height);
	$(".modal-bg").height($(window).height);
	$(".modal-bg").animate({ opacity : .8 },500);
	//$(".modal-container").delay(300).animate({ opacity : 1 },200);
	//$(".modal-container").css('width','0').css('height','10').css('opacity','1').css('margin-left','0').css('top','50%');
	//$(".modal-container").show(800);
	$(".modal-content").delay('300').animate({ 
			'width' : '760px', 
			'margin-left' : '-380px'
		},800, function(){
			$(".modal-content").animate({ 
				'height' : '598px',
				'top':'0' 
			},800);
		});
	$(".closeButton").delay('2050').fadeIn(250);
}

function closeModal(){
	$(".modal-bg").animate({ opacity : 0 },500, function(){ $(".modal").css("display","none"); });
	//$(".modal-container").animate({ opacity : 0 },250);
	$(".closeButton").fadeOut(200);
	$(".modal-content").fadeOut(250).css('width','0').css('height','60').css('margin','0').css('top','50%').fadeIn(0);
	$('.modal-content').html('');
}

$(document).ready(function(){
	$(".modal-bg").click(function(){ closeModal(); });
	$(".bt-close").click(function(){ closeModal(); });
	$(".closeButton").click(function(){ closeModal(); });
});

function modal(url){
	$.ajax({
	    type: "POST",
	       url: url,
		   success: function(msg){
	    	  	 $('.modal-content').html(msg);
            },
			error: function(msg){
            	$('.modal-content').html(msg);
    		}
	 });
    openModal();
}


