﻿$(document).ready(function() {
	cache: false,
     $('<img />')
    .attr('src', 'imagens/home.jpg')
    .load(function(){
        $('#body-background').append( $(this).hide().fadeIn(2000) );   
	$('#palco').hide();
	});
	$('#palco-home').load('html/home.html');





$("#jquery_jplayer_1").jPlayer({
  ready: function () {
   $(this).jPlayer("setMedia", {
    mp3: "musicas/1.mp3"
   }).jPlayer("play"); 
  },
  swfPath: "../musicas",
  supplied: "mp3"
 });


$('#logo1').click(function() {
	cache: false,
		document.title = 'Um pedacinho da França em Indaiatuba | Le Triskell';
		
		var valtura =$('#body-background img').css("height");
		var vlargura =$('#body-background img').css("width");

		
		$('#body-background').fadeOut('2000', function() {
			$('#body-background').html('');
			$('#palco').hide();
			$('#palco-home').show();
		
		$('<img />')
				.attr({src:'imagens/home.jpg'})
				.load(function(){
					$('#body-background').append( $(this) );
					$('#body-background img').css('width', vlargura);
					$('#body-background img').css('height', valtura);
					$('#body-background').fadeIn(2000);
					$('#palco-home').load('html/home.html');
				});		
		
		});
		
		
});


$('#menu-home').click(function() {
	cache: false,
		document.title = 'Um pedacinho da França em Indaiatuba | Le Triskell';
		
		var valtura =$('#body-background img').css("height");
		var vlargura =$('#body-background img').css("width");

		
		$('#body-background').fadeOut('2000', function() {
			$('#body-background').html('');
			$('#palco').hide();
			$('#palco-home').show();
		
		$('<img />')
				.attr({src:'imagens/home.jpg'})
				.load(function(){
					$('#body-background').append( $(this) );
					$('#body-background img').css('width', vlargura);
					$('#body-background img').css('height', valtura);
					$('#body-background').fadeIn(2000);
					$('#palco-home').load('html/home.html');
				});		
		
		});
		
		
});

$('#menu-triskell').click(function() {
	cache: false,
		document.title = 'O restaurante | Le Triskell';
		
		var valtura =$('#body-background img').css("height");
		var vlargura =$('#body-background img').css("width");
		
		$('#body-background').fadeOut('2000', function() {
			$('#body-background').html('');
			$('#palco-home').hide();
			$('#palco').show();
		
		$('<img />')
				.attr('src', 'imagens/o-le-triskell.jpg')
				.load(function(){
					$('#body-background').append( $(this) );
					$('#body-background img').css('width', vlargura);
					$('#body-background img').css('height', valtura);
					$('#body-background').fadeIn(2000);
					$('#palco').load('html/o-le-triskell.html', function(){$('#fotos a').lightBox();});
				});		
		
		});
		
		
});

$('#menu-cardapio').click(function() {
	cache: false,
		document.title = 'Menu | Le Triskell';
		
		var valtura =$('#body-background img').css("height");
		var vlargura =$('#body-background img').css("width");
		
		$('#body-background').fadeOut('2000', function() {
			$('#body-background').html('');
			$('#palco-home').hide();
			$('#palco').show();
		
		$('<img />')
				.attr('src', 'imagens/cardapio.jpg')
				.load(function(){
					$('#body-background').append( $(this) );
					$('#body-background img').css('width', vlargura);
					$('#body-background img').css('height', valtura);
					$('#body-background').fadeIn(2000);
					$('#palco').load('html/cardapio.html', function(){
						$('#fotos a').lightBox();
							 $('#saladas').click(function() {
							 $('#cardapio').load('cardapio/saladas.html');
							}); 
							$('#entradas').click(function() {
							  $('#cardapio').load('cardapio/entradas.html');
							});
							$('#sopas').click(function() {
							  $('#cardapio').load('cardapio/sopas.html');
							});    
							$('#massas').click(function() {
							  $('#cardapio').load('cardapio/massas.html');
							});
							$('#risotos').click(function() {
							  $('#cardapio').load('cardapio/risotos.html');
							}); 
							$('#peixes').click(function() {
							  $('#cardapio').load('cardapio/peixes.html');
							});  
							$('#carnes').click(function() {
							  $('#cardapio').load('cardapio/carnes.html');
							});  
							$('#sobremesas').click(function() {
							  $('#cardapio').load('cardapio/sobremesas.html');
							});   	
					});
				});		
		
		});
		
		
});

$('#menu-localizacao').click(function() {
	cache: false,
		document.title = 'Localização | Le Triskell';
		var valtura =$('#body-background img').css("height");
		var vlargura =$('#body-background img').css("width");
		$('#body-background').fadeOut('2000', function() {
			$('#body-background').html('');
			$('#palco-home').hide();
			$('#palco').show();
		
		$('<img />')
				.attr('src', 'imagens/localizacao.jpg')
				.load(function(){
					$('#body-background').append( $(this) );
					$('#body-background img').css('width', vlargura);
					$('#body-background img').css('height', valtura);
					$('#body-background').fadeIn(2000);
					$('#palco').load('html/localizacao.html');
				});		
		
		});
		
		
});

$('#menu-contato').click(function() {
	cache: false,
		document.title = 'Contato | Le Triskell';
		var valtura =$('#body-background img').css("height");
		var vlargura =$('#body-background img').css("width");
		$('#body-background').fadeOut('2000', function() {
			$('#body-background').html('');
			$('#palco-home').hide();
			$('#palco').show();
		
		$('<img />')
				.attr('src', 'imagens/contato.jpg')
				.load(function(){
					$('#body-background').append( $(this) );
					$('#body-background img').css('width', vlargura);
					$('#body-background img').css('height', valtura);
					$('#body-background').fadeIn(2000);
					$('#palco').load('html/contato.html', function(){
							$("#envia").click(function(){
																
								var nome = $("#nome").val();
								var email = $("#email").val();
								var tel = $("#tel").val();
								var cel = $("#cel").val();
								var retorno = $("#retorno").val();
								var texto = $("#texto").val();
								
								$.post('contato_envia.php', {nome: nome, email: email, tel: tel, cel: cel, retorno: retorno, texto: texto }, function(resposta) {
										// Se a resposta é um erro
										if (resposta != false) {
											// Exibe o erro na div
											$("#status").addClass("status_erro");
											$("#status").removeClass("status_ok");
											$("#status").html(resposta);
										} 
										// Se resposta for false, ou seja, não ocorreu nenhum erro
										else {
											// Exibe mensagem de sucesso
											$("#status").removeClass("status_erro");
											$("#status").addClass("status_ok");
											$("#status").html("Mensagem enviada com sucesso!");
											$("#nome").val("");
											$("#email").val("");
											$("#tel").val("");
											$("#cel").val("");
											$("#retorno").val("");
											$("#texto").val("");
										}
									
									});
									
							});
						});
					
				});		
		
		});
		
		
});

});           

