
function enviar()
{
	
    
	if (document.FrmContacto.radiobutton[0].checked)
	{
		if (Trim(document.FrmContacto.TbxRazon.value) == "" || document.FrmContacto.TbxRazon.value.length <= 0)
		{
		    alert("Debe ingresar Razón Social de Empresa");
		    document.FrmContacto.TbxRazon.focus();
		    return;
		}    
	}

    if (document.FrmContacto.radiobutton[1].checked)
	{
        if (Trim(document.FrmContacto.TbxContacto.value) == "" || document.FrmContacto.TbxContacto.value.length <= 0)
        {
            alert("Debe ingresar el Nombre de Contacto");
            document.FrmContacto.TbxContacto.focus();
            return;
        }
     }

	var email1 = document.FrmContacto.TbxEmail1.value;
	var email2 = document.FrmContacto.TbxEmail2.value;
	var email = email1 + '@' + email2;	
	var emailtest = email1 + email2;		

    if (Trim(emailtest)=='')
	{
    	alert("Ingrese e-mail");
	    document.FrmContacto.TbxEmail1.value="";
	    document.FrmContacto.TbxEmail2.value="";
	    document.FrmContacto.TbxEmail1.focus();		
	    return;
	}
    	
	if (validar_email(email) == false)
	{
	    alert("Dirección de e-mail inválida");
	    document.FrmContacto.TbxEmail1.value="";
	    document.FrmContacto.TbxEmail2.value="";
	    document.FrmContacto.TbxEmail1.focus();
	    
	    return;
	}    
	
	
	if ((document.FrmContacto.ChkCourier.checked==false)&&(document.FrmContacto.ChkLogistica.checked==false))
	{
		alert('Seleccione un Servicio/Producto a Consultar');
		return;
	}
	
	
	if (document.FrmContacto.ChkCourier.checked) 
	{
		if (Trim(document.FrmContacto.TACourier.value) == "" || document.FrmContacto.TACourier.value.length <= 0)
		{
			alert("No se ingresado ninguna consulta");
			document.FrmContacto.TACourier.focus();
			window.event.keyCode = 0;
			return false;
		}
			
		if (document.FrmContacto.TACourier.value.length>500)
		{
			alert("Se ha superado la cantidad maxima de 500 carácteres permitida para su consulta");
			document.FrmContacto.TACourier.focus();
			window.event.keyCode = 0;
			return false;
		}
	}

	if (document.FrmContacto.ChkLogistica.checked) 
	{
		if (Trim(document.FrmContacto.TALogistica.value) == "" || document.FrmContacto.TALogistica.value.length <= 0)
		{
			alert("No se ingresado ninguna consulta");
			document.FrmContacto.TALogistica.focus();
			window.event.keyCode = 0;
			return false;
		}
			
		if (document.FrmContacto.TALogistica.value.length>500)
		{
			alert("Se ha superado la cantidad maxima de 500 carácteres permitida para su consulta");
			document.FrmContacto.TALogistica.focus();
			window.event.keyCode = 0;
			return false;
		}
	}

	document.FrmContacto.submit();		    
}

function limpiarContacto()
{
    document.FrmContacto.reset();
}


function CheqCourrier()
{
    objCheckSobre=document.FrmContacto.ChkSobre
    objCheckEncom=document.FrmContacto.ChkEncomienda
    objCheckValija=document.FrmContacto.ChkValija 
    
        if (objCheckSobre.checked==true || objCheckEncom.checked==true || objCheckValija.checked==true || Trim(document.FrmContacto.TACourier.value)!='')
            document.FrmContacto.ChkCourier.checked=true;
    
}


function CheqLogistica()
{
    objCheckTransporte=document.FrmContacto.ChkTransporte
    objCheckDistribucion=document.FrmContacto.ChkDistribucion
    objCheckInter=document.FrmContacto.ChkInternacional 
    
        if (objCheckTransporte.checked==true || objCheckDistribucion.checked==true || objCheckInter.checked==true || Trim(document.FrmContacto.TALogistica.value)!='')
            document.FrmContacto.ChkLogistica.checked=true;
    
}

function habilitatblcontacto(valor)
{
    if (valor == 1)
    {
		document.getElementById('1').checked=true;
		document.getElementById('2').checked=false;
		document.getElementById('tblrsocial').style.display='block';
		document.getElementById('tblcontacto').style.display='none';
	 }
     else
	{
		document.getElementById('2').checked=true;
		document.getElementById('1').checked=false;
        document.getElementById('tblrsocial').style.display='none';
		document.getElementById('tblcontacto').style.display='block';
	} 
}