// JavaScript Document
function close_box(){
	$('#white_box').animate({marginTop:'-500px',opacity:'0'},700)
	setTimeout(function(){
		$('#dark_box').fadeOut(600);
		$('#white_box').hide();
	},500);
	
};
$(document).ready(function(){
	var height = $('#geral').css('height');
	if (height == 'auto') {
		height = '100%';
		$('html, body').animate({scrollTop:0}, 'slow');
	}
	var url;
	$('body').append('<div id="dark_box"></div>');
	$('body').append('<div id="white_box"></div>');
	$('div').click(function(){
		if($(this).attr('id') == 'mais_info'){
			url = $('a',this).attr('href');
			$('#dark_box').css({
				display: 'none',
				position: 'absolute',
				width: '100%',
				height: height,
				top:'0px',
				left:'0px',
				paddingBottom: '20px',
				background: '#000000',
				opacity: '0.8',
				zIndex: '15'
			});
			$('#white_box').css({
				width: '800px',
				position: 'absolute',
				top: '50%',
				left: '50%',
				marginLeft: '-400px',
				marginTop: '-500px',
				background: '#FFFFFF',
				opacity: '1.0',
				zIndex: '16',
				opacity: '0'
			});
			$('#dark_box').fadeIn(600);
			$('#white_box').show();
			$('#white_box').animate({marginTop:'-200px',opacity:'1'},700)
			setTimeout(function(){
				$('#white_box').animate({marginTop:'-250px'},600)
			},600);
			$('#white_box').empty().html('<p>Carregando...</p>')
			$.ajax({
				url: url,
				cache: false,
				success: function(html){
					$("#white_box").html(html);
				}
			});
			
			return false;
		}
	});
	$('div#dark_box').click(function(){
		close_box();
	});
});
