$(document).ready(function(){
	$('.fechar-veiculo').click(function ( e ) {
		e.preventDefault();
		$('.div-veiculo').hide(1000);
		
		$("#overlay-j").remove();
	});
	$("#lista-veiculos a").click(function( e ){
		e.preventDefault();
		overlay_j( '0.7', $('body').height(), '#3F2500', '120' );	
		
		var id = $(this).attr('id');
		$("#div-"+id).show(1000);
	});
	$('#cadastre-se fieldset input').click(function(){
		if ( $(this).val() == 'Digite seu e-mail' )
			$(this).val('');
	});
});
function overlay_j( opac, body_height, color, zindex )
{
	var lay = document.createElement('div');
	$( lay ).attr( {id : 'overlay-j'} );
	$( lay ).css( {background: color} );
	$( lay ).css( {'z-index': zindex} );
	$('body').after( lay );
	
	$( lay ).css({height: body_height+'px', opacity: opac});
}
function createFloater( text, width, height )
{
	var floater = document.createElement('div');
	$( floater ).attr({id : 'floater-j'});
	$( floater ).css({
		'position': 'fixed',
		'height': height+'px',
		'top': '50%',
		'marginTop': '-'+(height/2)+'px',
		'width': width+'px',
		'left': '50%',
		'marginLeft': '-'+(width/2)+'px',
		'z-index': '90',
		'padding': '5px',
		'background': '#fff',
	});
	$( floater ).html( text );
	$('body').append( floater );
	$('body').css({overflow:'hidden'});
}
function overlay_j( opac, body_height, color, zindex )
{
	var lay = document.createElement('div');
	$( lay ).attr( {id : 'overlay-j'} );
	$( lay ).css({
		'background': color, 
		'width': '100%', 
		'height': body_height+'px',
		'position': 'absolute', 
		'top': '0', 
		'left': '0', 
		'z-index': zindex, 
		'opacity': opac
	});
	$('body').append( lay );
}
$(document).ready(function(){	
	$('body').click(function( e ){
		if( e.target.id=='overlay-j' )
		{
			$('#overlay-j').remove();
			$('#floater-j').remove();
			$('body').css({overflow:'auto'});
		}
	});
});

