$(function()
{
	//$("p.error").hide();
	$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $(".formulario").validate({
		rules: {
			nombre: "required",
			apellidos: "required",
			telefono: {
				required: true,
				minlength: 9
			},	
			movil:{minlength: 9},		
			fax:{minlength: 9},		
			email: {
				required: true,
				minlength: 9
			//	remote: "emails.php"
			}			
		}
	});
	
	

});
	
	

	
	jQuery.validator.messages.required = "";
	
	
	$("form.formulario").validate();
	
	$("div.tipoM p.tipoS input").bind("click", function(){
		$("div.tipoM p.tipoDeRopa").find("input").each(function(i) {
		
			if($("div.tipoM p.tipoS input").attr("checked"))
			{
				$(this).attr("checked","checked");
			}else
			{
				$(this).attr("checked","");
			}
			
		});
	});
	$("div.tipoDeporte p.tipoDeporte input").bind("click", function(){
		$("div.tipoDeporte p.tipoDeRopa").find("input").each(function(i) {
		
			if($("div.tipoDeporte p.tipoDeporte input").attr("checked"))
			{
				$(this).attr("checked","checked");
			}else
			{
				$(this).attr("checked","");
			}
			
		});
	});
	
	$("div.tipolaboral p.tipoLaboral input").bind("click", function(){
		$("div.tipolaboral p.tipoDeRopa").find("input").each(function(i) {
	
			if($("div.tipolaboral p.tipoLaboral input").attr("checked"))
			{
				$(this).attr("checked","checked");
			}else
			{
				$(this).attr("checked","");
			}
			
		});
	});
		$("div.complementos p.tipoC input").bind("click", function(){
		$("div.complementos p.tipoDeRopa").find("input").each(function(i) {
			
			if($("div.complementos p.tipoC input").attr("checked"))
			{
				$(this).attr("checked","checked");
			}else
			{
				$(this).attr("checked","");
			}
			
		});
	});
	
	/*
$("form.formulario").submit(function () {
	 var completado="co";

//	 return false;
	$("input[type=text]").each(function(i) {
		

		if($(this).attr("value")==null)
		{
			alert("Debe rellenar todos los campos");
			completado=false;
		}
		else
		{
			
			if(completado!=false)
			{
				completado==true;
			}
			
		}
	});
	alert(completado);
	
	
	 if(completado)
	 {
	 	return true;
	 }else
	 {
	 	return false;
	 }
	 
	 
 });*/

	
}); 
