$(document).ready(function() {

	$('#nivo-slider').css({width: "480px", height: "266px"});
    $('#nivo-slider').nivoSlider({
        effect:'random', //Specify sets like: 'fold,fade,sliceDown'
        slices:10,
        animSpeed:700, //Slide transition speed
        pauseTime:4000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:false, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:false, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.8, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });
	
	$(".link_menu").hover(
	
		function () {
			
			$(this).stop(true,false).animate(
			
				{backgroundPosition:"(right -40px)",color:"#fff"}, 
				170
			
			);

			$(this).next(".link_menu_1").stop(true,false).animate(
			
				{backgroundPosition:"(left -40px)",color:"#fff"}, 
				170
			
			);

		},
		function () {
			
			$(this).animate(
			
				{backgroundPosition:"(right 0px)",color:"#9c9c9c"}, 
				550
			
			);	
			
			$(this).next(".link_menu_1").animate(
			
				{backgroundPosition:"(left 0px)",color:"#9c9c9c"}, 
				550
			
			);	
			
		}	
	
	);
	
	$(".link_menu_1").hover(
	
		function () {
			
			$(this).prev(".link_menu").stop(true,false).animate(
			
				{backgroundPosition:"(right -40px)",color:"#fff"}, 
				170
			
			);

			$(this).stop(true,false).animate(
			
				{backgroundPosition:"(left -40px)",color:"#fff"}, 
				170
			
			);

		},
		function () {
			
			$(this).prev(".link_menu").animate(
			
				{backgroundPosition:"(right 0px)",color:"#9c9c9c"}, 
				550
			
			);	
			
			$(this).animate(
			
				{backgroundPosition:"(left 0px)",color:"#9c9c9c"}, 
				550
			
			);	
			
		}	
	
	);
	
	$(".frases").hover(
	
		function () {
			
			$(this).stop(true,false).animate(
			
				{backgroundPosition:"(0px -30px)",color:"#000",marginLeft:"20px"}, 
				200
			
			);

			
		},
		function () {
			
			$(this).animate(
			
				{backgroundPosition:"(0px 0px)",color:"#fff",marginLeft:"0px"}, 
				400
			
			);		
			
		}	
	
	);
	
	$(".item").hover(
	
		function () {
		
			$(this).stop(true,false).animate(
			
				{backgroundPosition:"(0px 0px)", color: "#000", paddingLeft: "50px"},
				300
			
			);	
			
		},
		function () {
			
			$(this).animate(
			
				{backgroundPosition:"(-330px 0px)", color: "#fff", paddingLeft: "30px"},
				500
			
			);
			
		}

	);
	
	$('#mensagem_caixa').dialog({

		show: "drop",
		
		hide: "drop",

		autoOpen: false,

		width: 400,

		modal: true,

		resizable: false,

		buttons: {

			"Fechar": function() { 

				$(this).dialog("close"); 

			} 

		}

	});	
	
	$('#mensagem_caixa1').dialog({
								 
		beforeClose: function () {
		
			$("#formulario_pagseguro").submit();
			
		},

		show: "drop",
		
		hide: "drop",

		autoOpen: false,

		width: 400,

		modal: true,

		resizable: false,

		buttons: {

			"Efetuar pagamento no PagSeguro": function() { 

				$("#formulario_pagseguro").submit();

			} 

		}

	});	
	
	$('.contato').click(function(){

		$('#entrar_contato_caixa').dialog('open');

		return false;

	});
	
	$('.agendar_evento').click(function(){

		$('#agendar_evento_caixa').dialog('open');

		return false;

	});
	
	$('#entrar_contato_caixa').dialog({
		
		show: "drop",
		
		hide: "drop",

		autoOpen: false,

		width: 500,

		modal: true,

		resizable: true,

		buttons: {

			"Enviar": function() { 

				$("#formulario_entrar_contato").submit(); 

			}, 

			"Cancelar": function() { 

				$(this).dialog("close"); 

			} 

		}

	});	
	
	$('#agendar_evento_caixa').dialog({
		
		show: "drop",
		
		hide: "drop",

		autoOpen: false,

		width: 580,

		modal: true,

		resizable: true,

		buttons: {

			"Agendar": function() { 

				$("#formulario_agendar_evento").submit(); 

			}, 

			"Cancelar": function() { 

				$(this).dialog("close"); 

			} 

		}

	});	
	
	$('#finalizar_pedido_caixa').dialog({
		
		show: "drop",
		
		hide: "drop",

		autoOpen: false,

		width: 600,

		modal: true,

		resizable: true,

		buttons: {

			"Enviar": function() { 

				iframe_kazzuo_cardapio.finalizar_pedido();
				//$("#formulario_finalizar_pedido").submit(); 

			}, 

			"Cancelar": function() { 

				$(this).dialog("close"); 

			} 

		}

	});	

	$('#frete_caixa').dialog({
		
		beforeClose: function () {
		
			if (valor_frete==0) {
				
				window.location = 'index.php';
				
			}
			
		},
		
		show: "drop",
		
		hide: "drop",

		autoOpen: false,

		width: 500,

		modal: true,

		resizable: true,

		buttons: {

			"Começar a fazer o pedido": function() { 
 
 				if ($("#frete_bairro option:selected").length==0) {
				
					alert("Você deve selecionar pelo menos um bairro para continuar!");
				
				}
				else{
				
					valor_frete = $("#frete_bairro option:selected").val().split(";");
					$(this).dialog("close"); 
					window.iframe_kazzuo_cardapio.calcular_total();
					
				}

			}, 

			"Cancelar": function() { 

				$(this).dialog("close"); 

			} 

		}

	});	

});

var valor_frete = 0;

