$(document).ready(function() {
	
	// Menú principal
	$('.boton').mousemove(function(){
		src = $(this).attr('src');
		src = src.replace('_n.jpg', '_r.jpg');
		$(this).attr('src', src);
	});
	
	$('.boton').mouseout(function(){
		$.each($('.boton'), function() { 
			src = $(this).attr('src');
			src = src.replace('_r.jpg', '_n.jpg');
			$(this).attr('src', src);
		});
	});
	
	
	$('.sgmcombo').sgmcombo({
		width: '350px',
		img: '../../img/web/combo.jpg'
	});
	
	$('.sgmcombo2').sgmcombo({
		width: '70px',
		img: '../../img/web/combo.jpg',
		align: 'center'
	});
	
	/*** Para los pagos **************************************************************************/
	$('#forma_pago_0').click(function(){
		$('#formulario_pago_3').slideUp();
	});
	
	$('#forma_pago_3').click(function(){
		$('#formulario_pago_3').slideDown();
	});
	
	/*** Página de especificaciones técnicas *****************************************************/
	$('.mini-foto').mouseover(function(){
		src = $(this).attr('src');
		src = src.replace('_p_', '_g_');
		$('#gran-foto').attr('src', src);
	});
	
});

/**
 * Imágenes de cabecera
 * @param	integer imagenes (número total de imágenes en el slideshow)
 * @param	integer velocidad (tiempo en segundos entre imágenes, en segundos)
 * @param	integer	fundido (tiempo que dura el fundido, en segundos)
 */	
var imagenes = 10;
var velocidad = 5;
var fundido = 2;

/**
 * Inicia el slideshow de imágenes de cabecera
 */	
var i = setInterval('play()', velocidad * 1000);
var actual = 1;

/**
 * Play
 *
 * Inicia el slideshow de imágenes de cabecera
 *
 * @param	void
 * @return	void
 */	
function play()
{
	$('#foto-' + actual).fadeOut(fundido * 1000);
	actual++;
	
	if (actual > imagenes)
		actual = 1;
	
	$('#foto-' + actual).fadeIn(fundido * 1000);
	
	//console.log('Imagen: %d', actual);
}
