$.noConflict();
jQuery(document).ready(function($) {
	/* contact validation */
	$('#contact-form').validate({
        errorElement: 'label',
        errorClass: 'error',
        errorPlacement: function(error, element) {
			error.appendTo(element.parent());
        },
        rules: {
            nombre: {
				required: true
            },                    
            telefono: {
                required: true              
            },
			provincia: {
                required: true              
            },			
			email: {
                required: true,
                email: true
            },
			descripcion: {
				required: true
			},
			politica: {
				required: true
			}
        },
        messages: {
            nombre: 'Por favor ingrese su nombre',                    
            telefono: 'Por favor ingrese su numero telef&oacute;nico',                    
			provincia: 'Por favor ingrese su Provincia',                    
			email: 'Por favor ingrese un email valido',
			descripcion: 'Por favor ingrese su consulta',
			politica: 'Debe aceptar la pol&iacute;tica de protecci&oacute;n de datos'
        }
    });

	/* solicitar presupuesto stuff */
	$('.solicitarButton h3 a').click(function(){
		//alert('Hiciste click');
		$('.product-shop, .product-name').hide();
		$('.solicitar-presupuesto-title, .solicitar-presupuesto-form').show();		
	});	
	
	/* enviar logo si o no */	
	$('.checkboxs input[type="radio"]').click(function(){		 
		if ($(this).val() == "si")
		{
			$('.send-logo').show();		
		} 
		else 
		{
			$('.send-logo').hide();		
		}
	});	
	

	/* Soliciter presupuesto validation */
	$('#presupuesto-form').validate({
        errorElement: 'label',
        errorClass: 'error',
        errorPlacement: function(error, element) {
			error.appendTo(element.parent());
        },
        rules: {
            cantidad: {
				required: true
            },                                
			provincia: {
                required: true              
            },			
			email: {
                required: true,
                email: true
            },			
			politica: {
				required: true
			}
        },
        messages: {
            cantidad: 'Por favor indique una cantidad',                                
			provincia: 'Por favor ingrese su Provincia',                    
			email: 'Por favor ingrese un email valido',			
			politica: 'Debe aceptar la pol&iacute;tica de protecci&oacute;n de datos'
        }
    });
	
	/* lightbox para mas imagenes*/
	$('.more-views a#mas-imagenes').click(function(){
		$('.lightbox').css({width:'100%',height:'100%'}).fadeIn(500,function(){
			$('.mas-imagenes').fadeIn(300);						
		});				
	});
	
	$('.lightbox').click(function(){
		$('.mas-imagenes').fadeOut(200);
		$('.lightbox').css({width:'0',height:'0'}).fadeOut(300);				
	});	
	
	/* cycle inside lightbox */
	
	$('#slideshow-container').cycle({ 
		fx:     'fade', 
		speed:  200, 
		timeout: 5000, 
		pager:  '#nav', 
		 
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<li><a href="javascript://"><img src="' + slide.src + '" width="50" height="50" /></a></li>'; 
		} 
	});
	
	/*$('#slideshow-container #nav a:gt(5)').detach();//This remove the numbers generated for the cycle.js
		$('#slideshow-container #nav a').click(function(){
		   $('#home-slideshow-container #home-slideshow').cycle($(this).index());
		});*/
	
	
});
