// JavaScript Document


function trim(texto01) 
{
	while(texto01.substring(0,1) == ' ')
		texto01 = texto01.substring(1,texto01.length);

	while(texto01.substring(texto01.length-1,texto01.length) == ' ')
		texto01 =texto01.substring(0, texto01.length-1);   
	
	return texto01;
}

  ////
  function IsValidEmail (texto)
{
	var mail = 'abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ0123456789@._-';	
	text=trim(texto);		
	conta =0;
	conta2=0;

	for(i=0;i<text.length;i++)
	{		
		if(mail.indexOf(text.charAt(i)) == -1)
		{			
				return false;
		}		
		else
		{
				if(text.charAt(i) == '@')				{
					conta++;					
					if(conta > 1)
						return false;
				}
				if(text.charAt(i) == '.')
				{					
					conta2++;				
				}	
					
		}
	}
	if(conta==0 || conta2==0)
		return false;		
	
    return true;
} 

function limpiarInputs(Formulario)
  {
     for (i=0;i<Formulario.elements.length;  i++)
     {
      Formulario.elements[i].value= "";               
      Formulario.elements[i].checked = false;
     }
     Formulario.tema.value= "Dudas";
      
  }
  
function validar()
 {

   if (document.form1.nombre.value == '')
   { 
     alert('Ingrese su nombre.');
     document.form1.nombre.focus();
     return;
   }  

   
 if (document.form1.email.value == '')
   { 
     alert('Ingrese su email.');
     document.form1.email.focus();
     return;
   }  
   else
     if (!IsValidEmail(document.form1.email.value))
     {
		alert('Debe ingresar un email válido.');
		document.form1.email.focus();
		return;
	 }	 
 	  
//   document.form1.action = "../../asp/enviar.asp"
   document.form1.action = "../php/mail1.php"
   document.form1.submit();
    
}  


function contactar()
{
	var tld_ = new Array()
	tld_[0] = "info";
	tld_[1] = "edesi";
	tld_[2] = "net";
	tld_[3] = "ws";
	tld_[4] = "info";
	tld_[10] = "co.uk";
	tld_[11] = "org.uk";
	tld_[12] = "gov.uk";
	tld_[13] = "ac.uk";
	var emailE='sage.com.ar';
//	emailE=(tld_[0] + '&#64;' + emailE);
	emailE=(tld_[0] + '\10' + emailE);
	parent.location = "mailto:" + emailE+"?subject=Desde la pagina de Sage";
 }


