// JavaScript Document

function noticia(cual)
{
ancho='500';
alto='433';
if ((cual==6)||(cual==5)||(cual==4)||(cual==3)||(cual==2)){
alto='361';
}
if (cual==8){alto=458;}
fuente='not/noticia_'+cual+'.htm';
window.open(fuente,'','top=0,left=0,directories=no,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,width='+ancho+',height='+alto);
}

function popup(pag,cual)
{
if (pag=='aenor'){
window.open('aenor.htm','','top=0,left=0,directories=no,location=no,menubar=no,resizable=yes,status=no,titlebar=no,toolbar=no,width=348,height=520');
}
if (pag=='fundador'){
window.open('fundador.htm','','top=0,left=0,directories=no,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,width=382,height=520');
}
if (pag=='factura'){
window.open('factura.htm','','top=0,left=0,directories=no,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,width=403,height=520');
}
if (pag=='sociedad'){
cual_foto=cual+'.jpg';
window.open('sociedad.htm','','top=0,left=0,directories=no,location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,width=690,height=520');
}
}

function valida_contacto()
{
vacios='';
 if (document.all)
 {
 //////////////////
 telefono=document.all['telephone'].value;
 email_account=document.all['email_account'].value;
     for (i=0;i<document.forms[0].elements.length;i++)
      {
        valor=document.forms[0].elements[i].value;
        campo=document.forms[0].elements[i].name;
		if ((valor=='')&&(campo!='company')&&(campo!='start')&&(campo!='end')&&(campo!='requirements')&&(campo!='budget')&&(campo!='info')&&(campo!='email')){
		if (campo=='email_account'){campo='email';}
		vacios+=(' - '+campo+'\n');
		}
		}
   if (vacios!='')
   { 
    alert('Se necesitan los siguientes datos:  \n\n'+vacios+'\n\n');
   }
   else
   {  

	 for (i=0;i<telefono.length;i++)
	 {
	  telefono=telefono.replace(' ','');
	  telefono=telefono.replace('-','');
	  telefono=telefono.replace('/','');
	 }
     if (isNaN(telefono))
	  {alert('The phone is not valid ...');
	  document.all['telephone'].focus();}
	  else{
	  alert('Your request has been sent ...');
	  document.all['email'].value=email_account;
	    document.forms[0].submit();
	}

   }
 //////////////////
 }

 if ((!document.all)&&(document.getElementById))
 {
  //////////////////
  telefono=document.getElementById('telephone').value;
  email_account=document.getElementById('email_account').value;
  
      for (i=0;i<document.forms[0].elements.length;i++)
      {
        valor=document.forms[0].elements[i].value;
        campo=document.forms[0].elements[i].name;
		if ((valor=='')&&(campo!='company')&&(campo!='start')&&(campo!='end')&&(campo!='requirements')&&(campo!='budget')&&(campo!='info')&&(campo!='email')){
		if (campo=='email_account'){campo='email';}
		vacios+=(' - '+campo+'\n');
		}
		}
   if (vacios!='')
   {
alert('Following data are required:  \n\n'+vacios+'\n\n');
   }
   else
   {  
	 for (i=0;i<telefono.length;i++)
	 {
	  telefono=telefono.replace(' ','');
	  telefono=telefono.replace('-','');
	  telefono=telefono.replace('/','');
	 }
     if (isNaN(telefono))
	  {alert('The phone is not valid ...');
	  document.getElementById('telephone').focus();}
	  else{
	  alert('Your request has been sent ...');
	  document.getElementById('email').value=email_account;
	  document.forms[0].submit();
	  } 

   }
  //////////////////
  }
}
