function validation(form)
{
	if(document.getElementById("textnombrenovio"))
	{
	var textnombrenovio=document.getElementById("textnombrenovio").value;
	var textapellidonovio=document.getElementById("textapellidonovio").value;
	}
	var textnombrenovia=document.getElementById("textnombrenovia").value;
	var textapellidonovia=document.getElementById("textapellidonovia").value;
	var textusuario=document.getElementById("textusuario").value;
	var texcontra=document.getElementById("texcontra").value;
	var texmail=document.getElementById("texmail").value.toLowerCase();	
	var textelefono=document.getElementById("textelefono").value;
	var textdire=document.getElementById("textdire").value;
	var selectdpto=document.getElementById("selectdpto").value;
	var selectdia=document.getElementById("selectdia").value;
	var selectmes=document.getElementById("selectmes").value;
	var selectanio=document.getElementById("selectanio").value;
	var textlugarc=document.getElementById("textlugarc").value;
	var textdirec=document.getElementById("textdirec").value;
	var checkboxterminos=document.getElementById("checkboxterminos");
	
	if(document.getElementById("textnombrepadre") && document.getElementById("textapellidopadre"))
	{
		var uno="Por Favor complete el campo  Nombre del Padre";
		var dos="Por Favor complete el campo  Apellido del Padre";
		var tres="Por Favor complete el campo  Nombre de la Madre";
		var cuatro="Por Favor complete el campo  Apellido de la Madre";
		if(textnombrenovia.length<1)
		{
			alert(tres);
			return false;
		}
		if(textapellidonovia.length<1)
		{
			alert(cuatro);
			return false;
		}
	}
	else
	{
		var uno="Por Favor complete el campo  Nombre del Novio";
		var dos="Por Favor complete el campo  Apellido del Novio";
		var tres="Por Favor complete el campo  Nombre de la Novia";
		var cuatro="Por Favor complete el campo  Apellido de la Novia";
		if(textnombrenovio.length<1)
		{
			alert(uno);
			return false;
		}
		if(textapellidonovio.length<1)
		{
			alert(dos);
			return false;
		}
		if(textnombrenovia.length<1)
		{
			alert(tres);
			return false;
		}
		if(textapellidonovia.length<1)
		{
			alert(cuatro);
			return false;
		}		
	}
	
	if(textusuario.length<1)
	{
		alert("Por Favor complete el campo  Usuario");
		return false;
	}
	if(texcontra.length<1)
	{
		alert("Por Favor complete el campo  Contraseña");
		return false;
	}
	if(valEmail(texmail)==1)
			{
				//alert (valEmail(texmail));
				alert("La dirección de email es incorrecta.");
				return false;
			}
	if(document.getElementById("hiddencorreo").value=='deshabilitado')
	{
		enviarcorreo(texmail.toLowerCase());
	}
	if(document.getElementById("hiddencorreo").value=='deshabilitado')
	{
		//alert("la Cuenta de Correo ya esta Registrado");
		return false;
	}
	if(textelefono.length<1)
	{
		alert("Por Favor complete el campo  Telefono");
		return false;
	}
	if(textdire.length<1)
	{
		alert("Por Favor complete el campo  Direccion");
		return false;
	}
	if(selectdpto=='none')
	{
		alert("Seleccione el Departamento");
		return false;
	}
	if(document.getElementById("selectprov"))
	{
		var selectprov=document.getElementById("selectprov").value;
		if(selectprov=='none')
		{
			alert("Seleccione la Provincia");
			return false;
		}
	}
	else
		return false;
	if(document.getElementById("selectdist"))
	{  
		var selectdist=document.getElementById("selectdist").value;
		if(selectdist=='none')
		{
			alert("Seleccione el Distrito");
			return false;
		}
	}
	else
		return false;
	if(selectdist=='none')
	{
		alert("Seleccione el Distrito");
		return false;
	}
	if(textlugarc.length<1)
	{
		alert("Por Favor complete el campo  Lugar de la Ceremonia");
		return false;
	}
	
	if(selectdia=='none')
	{
		alert("Seleccione el Dia");
		return false;
	}
	if(selectmes=='none')
	{
		alert("Seleccione el Mes");
		return false;
	}
	if(selectanio=='none')
	{
		alert("Seleccione el Año");
		return false;
	}
	if(checkboxterminos.checked=='')
	{
		alert("Aceptar los Términos y Condiciones de SMCLIST");
		return false;
	}
	return true;
}
function eventfecha()
	{
	  document.getElementById("hiddendate").value=document.getElementById("selectanio").value+'/'+document.getElementById("selectmes").value+'/'+document.getElementById("selectdia").value;
	  //alert(document.getElementById("hiddendate").value);
	}
	function dateuser(form)
	{
		var textfielda=document.getElementById("textfielda").value;
		var textfieldb=document.getElementById("textfieldb").value;
			if(textfielda.length<1)
			{
				return false;
			}
			if(textfieldb.length<1)
			{
				return false;
			}
			return true;
	}
function valEmail(valor)
{
    re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
    if(!re.exec(valor))    {
       
		document.getElementById("texmail").focus();
		return 1;
    }
}
function valEmailb(valor)
{
    re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
    if(!re.exec(valor))    {
        alert("La dirección de email es incorrecta.");
		//document.getElementById("txt_mail").focus();
		return 1;
    }
}

function validatecompra(form,id,s)
	{
		var txt_name=document.getElementById("txt_name").value;
		var text_apellido=document.getElementById("text_apellido").value;
		var txt_mail=document.getElementById("txt_mail").value.toLowerCase();
		var txt_telefono=document.getElementById("txt_telefono").value;
		var dedicatoria=document.getElementById("dedicatoria").value;
		var tpago=document.getElementById("tpago").value;	
		//alert(text_apellido);
			if(txt_name.length<1)
			{
				alert("Por Favor complete el campo Nombres");
				document.getElementById("txt_name").focus();
				return false;
			}
			if(text_apellido.length<1)
			{
				alert("Por Favor complete el campo Apellidos");
				document.getElementById("text_apellido").focus();
				return false;
			}
			
			if(valEmailb(txt_mail.toLowerCase())==1)
			{
				return false;
			}
			//valEmailb(txt_mail);
			if(txt_telefono.length<1)
			{
				alert("Por Favor complete el campo Teléfono");
				document.getElementById("txt_telefono").focus();
				return false;
			}
			if(dedicatoria.length<1)
			{
				alert("Por Favor complete el campo Dedicatoria");
				document.getElementById("dedicatoria").focus();
				return false;
			}
			if(tpago==0)
			{
				alert("Seleccionar una forma de pago");
				document.getElementById("tpago").focus();
				return false;
			}
			return true;
	}
function valcorre(form)
	{
		var txt_mail=document.getElementById("txt_mail").value;
			if(valEmailb(txt_mail.toLowerCase())==1)
			{
				return false;
			}
			return true;
	}
function validatecompras(form)
	{
		var billingState=document.getElementById("billingState").value;
		
		var billingCity=document.getElementById("billingCity").value;
		var billingZIP=document.getElementById("billingZIP").value;
		var billingAddress=document.getElementById("billingAddress").value;
		var checkboxterminos=document.getElementById("checkboxterminos")
		//alert(text_apellido);
			if(billingState=='none')
			{
				alert("Seleccione el campo pais");
				document.getElementById("billingState").focus();
				return false;
			}
			if(billingCity.length<1)
			{
				alert("Por Favor complete el campo Ciudad");
				document.getElementById("billingCity").focus();
				return false;
			}
			if(billingAddress.length<1)
			{
				alert("Por Favor complete el campo Direccion");
				document.getElementById("billingCity").focus();
				return false;
			}
			//valEmailb(txt_mail);
			if(billingZIP.length<1)
			{
				alert("Por Favor complete el campo Codigo Postal");
				document.getElementById("billingZIP").focus();
				return false;
			}			
			if(checkboxterminos.checked=='')
			{
				alert("Aceptar los Términos y Condiciones de SMCLIST");
				return false;
			}			
			return true;
	}
function validamailto(form)
	{
		var txt_mail=document.getElementById("txt_maila").value;
			//alert("ok")
			if(valEmailb(txt_mail.toLowerCase())==1)
			{
				return false;
			}
			return true;
	}
function validacuenta(form)
	{
		var txt_mail=document.getElementById("txt_mail").value;
		var txt_pwd=document.getElementById("txt_pwd").value;
			//alert("ok")
			if(valEmailb(txt_mail.toLowerCase())==1)
			{
				return false;
			}
			if(txt_pwd.length<1)
			{
				alert("Por Favor complete el Password:");
				return false;
			}
			return true;
	}
function validatedireccion(form)
	{
		var text_pais=document.getElementById("text_pais").value;
		var txt_ciudad=document.getElementById("txt_ciudad").value;
		var txt_drone=document.getElementById("txt_drone").value;
		var txt_drtwo=document.getElementById("txt_drtwo").value;
		var txt_namedirec=document.getElementById("txt_namedirec").value;
		var txt_telfijo=document.getElementById("txt_telfijo").value;
		var txt_postal=document.getElementById("txt_postal").value;
			//alert("ok")
			if(text_pais=='none')
			{
				alert("Por Favor complete el Campo Pais:");
				return false;
			}
			if(txt_ciudad.length<1)
			{
				alert("Por Favor complete el Campo Ciudad:");
				return false;
			}
			if(txt_drone.length<1)
			{
				alert("Por Favor complete el su Dirección:");
				return false;
			}
			if(txt_telfijo.length<1)
			{
				alert("Por Favor complete el campo Telefono:");
				return false;
			}
			if(txt_postal.length<1)
			{
				alert("Por Favor complete el campo Dirección Postal:");
				return false;
			}
			if(txt_namedirec.length<1)
			{
				alert("Por Favor complete el Nombre de la Dirección:");
				return false;
			}
						
			return true;
	}
function validatecompradirecta(form)
	{
		var tpago=document.getElementById("tpago").value;
		//var txt_pwd=document.getElementById("txt_pwd").value;
			//alert("ok")
			if(tpago==0)
			{
				alert("Seleccionar una forma de pago");
				document.getElementById("tpago").focus();
				return false;
			}
			return true;
	}
function validatecutomertwo(form)
	{
		var text_nombre=document.getElementById("text_nombre").value;
		var txt_apellido=document.getElementById("txt_apellido").value;
		var txt_mail=document.getElementById("txt_mail").value;
		var selectsexo=document.getElementById("selectsexo").value;
		var txt_pwd=document.getElementById("txt_pwd").value;
		
		
		var txt_drone=document.getElementById("txt_drone").value;
		var txt_codpostal=document.getElementById("txt_codpostal").value;
		
		var txt_ciudad=document.getElementById("txt_ciudad").value;
		var text_pais=document.getElementById("text_pais").value;
		var txt_telffijo=document.getElementById("txt_telffijo").value;		
		
		if(document.getElementById("selectdia"))
		{
			var selectdia=document.getElementById("selectdia").value;
			var selectmes=document.getElementById("selectmes").value;
			var selectanio=document.getElementById("selectanio").value;
		}
		
		var txt_namedirec=document.getElementById("txt_namedirec").value;
			
			if(text_nombre.length<1)
			{
				alert("Por Favor complete el Campo Nombres:");
				return false;
			}
			if(txt_apellido.length<1)
			{
				alert("Por Favor complete el Campo Apellidos:");
				return false;
			}
			if(txt_mail.length<1)
			{
				alert("Por Favor complete el Campo E_mail:");
				return false;
			}
			if(selectsexo=='0')
			{
				alert("Seleccionar el Campo Sexo:");
				return false;
			}
			if(txt_pwd.length<1)
			{
				alert("Por Favor complete el Campo Password:");
				return false;
			}
			if(document.getElementById("selectdia"))
				{
					if(selectdia=='none')
					{
						alert("Seleccione el Dia");
						return false;
					}
					if(selectmes=='none')
					{
						alert("Seleccione el Mes");
						return false;
					}
					if(selectanio=='none')
					{
						alert("Seleccione el Año");
						return false;
					}
				}
			if(txt_drone.length<1)
			{
				alert("Por Favor complete el su Dirección:");
				return false;
			}
			if(txt_codpostal.length<1)
			{
				alert("Por Favor complete el Campo Codigo Postal:");
				return false;
			}
			if(txt_ciudad.length<1)
			{
				alert("Por Favor complete el Campo Ciudad:");
				return false;
			}
			if(text_pais=='none')
			{
				alert("Por Favor complete el Campo Pais:");
				return false;
			}
			if(txt_telffijo.length<1)
			{
				alert("Por Favor complete el Campo Teléfono:");
				return false;
			}
			if(txt_namedirec.length<1)
			{
				alert("Por Favor complete el Campo Nombre de Dirección:");
				return false;
			}
									
			return true;
	}


	


