function restaura(){
	
		$('#pestempresa').addClass('pest_on');
		$('#pestproductos').addClass('pest_on');
		$('#pestpedidos').addClass('pest_on');
		$('#pestcontacto').addClass('pest_on');	
		$('#pestdistri').addClass('pest_on');	
	
		$("a.[href*='1productos']").removeClass().addClass('menu');
		$("a.[href*='1empresa']").removeClass().addClass('menu');
		$("a.[href*='1inicio']").removeClass().addClass('menu');
		$("a.[href*='1contacto']").removeClass().addClass('menu');	
		$("a.[href*='1distri']").removeClass().addClass('menu');	

		$('.pestselect1').css('opacity','0.0');
		$('.pestselect2').css('opacity','0.0');
		$('.pestselect3').css('opacity','0.0');
		$('.pestselect4').css('opacity','0.0');
		$('.pestselect5').css('opacity','0.0');
}

$(document).ready(function() {
	
	window.scrollTo(0,0);

	$.preloadCssImages();
	
	$('#oferta').hide()
	
	
//	setTimeout(function() {
//	$('#oferta').dialog(	
//			{ buttons: { "Ok!": function() {  $(this).dialog("close"); } } },	
//			{ show: 'clip' },
//			{ width: 920 },
//			{ hide: 'clip' })	
//	  }, 5000); 
	
		$('.pestselect1').css('opacity','0.0');
		$('.pestselect2').css('opacity','0.0');
		$('.pestselect3').css('opacity','0.0');
		$('.pestselect4').css('opacity','0.0');
		$('.pestselect5').css('opacity','0.0');

			$('#margen').css({'width':'720', 'margin-top' : '0px', 'margin-left' : '0px'});
			$.ajax({url: '1inicio/inicio.php',type: "POST", success: function(data) { $('#margen').html(data);} });
		
	$('.gifani').hide();
	$('.gifani').ajaxStart(function() {
		  $(this).show();
		});
	$('.gifani').ajaxStop(function() {
		  $(this).hide();
		});
	
	$(".eventocesta").click(function(evento){ evento.preventDefault();
	restaura();
	$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});

	$.ajax({url: '1venta/cesta.php',type: "POST", success: function(data) { $('#margen').html(data);} });
	});
	
	   $("a.[href*='1inicio/inicio.php']").click(function(evento){ evento.preventDefault();
	    restaura();
		$(this).addClass('menuselect');
		$('#margen').fadeOut('fast');
		$('.pestselect1').css('opacity','1');
		$('#pestpedidos').removeClass('pest_on');
		$('#pestpedidos').addClass('pest_off');

		setTimeout(function() {
			$.ajax({url: '1inicio/inicio.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			   $('#margen').css({'width':'720', 'margin-top' : '0px', 'margin-left' : '0px'});
			   $('#margen').ajaxStop(function() {
	  				$(this).fadeIn('fast');
	  		   		});
		    }, 200); 
		});
	   
	   $("a.[href*='1productos/productos.php']").click(function(evento){ evento.preventDefault();
		restaura();
			$(this).addClass('menuselect');
  			$('.pestselect2').css('opacity','1');
  			$('#pestproductos').removeClass('pest_on');
  			$('#pestproductos').addClass('pest_off');

		$('#margen').fadeOut('fast');
			setTimeout(function() {
				$.ajax({url: '1productos/productos.php',cache: false, type: "POST", success: function(data) { $('#margen').html(data);} });
	
	  			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
	  			$('#margen').ajaxStop(function() {
	  				$(this).fadeIn('fast');
	  		   		});
		    }, 200); 
  		});
	   
	   $("a.[href*='1empresa']").click(function(evento){ evento.preventDefault();
		restaura();
   		$(this).addClass('menuselect');
   		$('.pestselect3').css('opacity','1');
  		$('#pestempresa').removeClass('pest_on');
  		$('#pestempresa').addClass('pest_off');

		$('#margen').fadeOut('fast');
		setTimeout(function() {
			$.ajax({url: '1empresa/empresa.php',type: "POST", success: function(data) { $('#margen').html(data);} });

 			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
  			$('#margen').ajaxStop(function() {
  				$(this).fadeIn('fast');
  		   		});
	    }, 200); 
	   	});
	   
	   $("a.[href*='1distri']").click(function(evento){ evento.preventDefault();
		restaura();
  		$(this).addClass('menuselect');
  		$('.pestselect4').css('opacity','1');
 		$('#pestdistri').removeClass('pest_on');
 		$('#pestdistri').addClass('pest_off');

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1distri/distri.php',type: "POST", success: function(data) { $('#margen').html(data);} });

 			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
 			$('#margen').ajaxStop(function() {
 				$(this).fadeIn('fast');
 		   		});
	    }, 200); 
	   		});
	   
	   
	   $("a.[href*='1contacto']").click(function(evento){ evento.preventDefault();
		restaura();
   		$(this).addClass('menuselect');
   		$('.pestselect5').css('opacity','1');
  		$('#pestcontacto').removeClass('pest_on');
  		$('#pestcontacto').addClass('pest_off');

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1contacto/contacto.php',type: "POST", success: function(data) { $('#margen').html(data);} });

  			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
  			$('#margen').ajaxStop(function() {
  				$(this).fadeIn('fast');
  		   		});
	    }, 200); 
	   		});
	   
	   
	   
	   $("a.[href*='1pruebascampo/pruebascampo.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
			
		$.ajax({url: '1pruebascampo/pruebascampo.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   
	   $("a.[href*='1textos/condiciones.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/condiciones.php',type: "POST", success: function(data) { $('#margen').html(data);} });

 			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
 			$('#margen').ajaxStop(function() {
 				$(this).fadeIn('fast');
 		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   
	   
	   
	   $("a.[href*='1textos/navyres.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/navyres.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   
	   
	   
	   $("a.[href*='1textos/confi.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/confi.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   
	   $("a.[href*='1textos/ssl.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/ssl.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
	    }, 200); 
		window.scrollTo(0,0);
	   		});
	   
	   
	   
	   $("a.[href*='1textos/comocomprar.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/comocomprar.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   $("a.[href*='1textos/informacion.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/informacion.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   $("a.[href*='1textos/incidencias.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$('#margen').fadeOut('fast');
		setTimeout(function() {
		$.ajax({url: '1textos/incidencias.php',type: "POST", success: function(data) { $('#margen').html(data);} });

			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});
			$('#margen').ajaxStop(function() {
				$(this).fadeIn('fast');
		   		});
			window.scrollTo(0,0);
	    }, 200); 
	   		});
	   
	   $("a.[href*='1autent/autent.php']").click(function(evento){ evento.preventDefault();
		restaura();

		$.ajax({url: '1autent/autent.php',type: "POST", success: function(data) { $('#margen').html(data);} });
			$('#margen').css({'width':'640', 'margin-top' : '37px', 'margin-left' : '40px'});

	   		});
	   

		$('#escena').corner("15px");
		$('#subescena').corner("15px");
		$('#pie').corner("15px");
 });




