
function procesarhosting(){

   var regex = /^\s*$/i;
   var pserver=0.0;

   document.hosting.p3.value="1";


   if(document.hosting.service.value=="Personal") {
      document.hosting.servicio.value="WEB HOSTING PERSONAL";
      document.hosting.item_number.value="WEBHOSTINGPERSONAL";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Basico") {
      document.hosting.servicio.value="WEB HOSTING BASICO";
      document.hosting.item_number.value="WEBHOSTINGBASICO";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }



   if(document.hosting.service.value=="Profesional") {
      document.hosting.servicio.value="WEB HOSTING PROFESIONAL";
      document.hosting.item_number.value="WEBHOSTINGPROFESIONAL";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }



   if(document.hosting.service.value=="Empresarial") {
      document.hosting.servicio.value="WEB HOSTING EMPRESARIAL";
      document.hosting.item_number.value="WEBHOSTINGEMPRESARIA";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Desarrollador") {
      document.hosting.servicio.value="WEB HOSTING DESARROLLADOR";
      document.hosting.item_number.value="WEBHOSTINGDESARROLLADOR";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Registro") {
      document.hosting.servicio.value="REGISTRO Y RENOVACION DE DOMINIO";
      document.hosting.item_number.value="REGISTRODEDOMINIO";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Transferencia") {
      document.hosting.servicio.value="TRANSFERENCIA Y RENOVACION DE DOMINIO";
      document.hosting.item_number.value="TRANSFERENCIADEDOMINIO";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Recuperacion") {
      document.hosting.servicio.value="RECUPERACION Y RENOVACION DE DOMINIO";
      document.hosting.item_number.value="RECUPERACIONDEDOMINIO";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Mini Reseller") {
      document.hosting.servicio.value="MINI RESELLER";
      document.hosting.item_number.value="MINIRESELLER";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Reseller Standard") {
      document.hosting.servicio.value="RESELLER STANDARD";
      document.hosting.item_number.value="RESELLERSTANDARD";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }



   if(document.hosting.service.value=="Mega Reseller") {
      document.hosting.servicio.value="MEGA RESELLER";
      document.hosting.item_number.value="MEGARESELLER";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Server Basico") {
      document.hosting.servicio.value="SERVER BASICO";
      document.hosting.item_number.value="SERVERBASICO";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Trimestral'){
          document.hosting.precio.value=document.hosting.pt.value;
          document.hosting.p3.value="3";
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Semestral'){
          document.hosting.precio.value=document.hosting.ps.value;
          document.hosting.p3.value="6";
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.p3.value="1";
          document.hosting.t3.value="Y";
      }
   }


   if(document.hosting.service.value=="Server Standard") {
      document.hosting.servicio.value="SERVER STANDARD";
      document.hosting.item_number.value="SERVERSTANDARD";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Trimestral'){
          document.hosting.precio.value=document.hosting.pt.value;
          document.hosting.p3.value="3";
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Semestral'){
          document.hosting.precio.value=document.hosting.ps.value;
          document.hosting.p3.value="6";
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.p3.value="1";
          document.hosting.t3.value="Y";
      }
   }



   if(document.hosting.service.value=="Server Profesional") {
      document.hosting.servicio.value="SERVER PROFESIONAL";
      document.hosting.item_number.value="SERVERPROFESIONAL";
      if (document.hosting.formadepago.value=='Mensual'){
          document.hosting.precio.value=document.hosting.pm.value;
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Trimestral'){
          document.hosting.precio.value=document.hosting.pt.value;
          document.hosting.p3.value="3";
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Semestral'){
          document.hosting.precio.value=document.hosting.ps.value;
          document.hosting.p3.value="6";
          document.hosting.t3.value="M";
      }
      if (document.hosting.formadepago.value=='Anual'){
          document.hosting.precio.value=document.hosting.pa.value;
          document.hosting.p3.value="1";
          document.hosting.t3.value="Y";
      }
   }



   if((document.hosting.service.value=="Server Basico")||(document.hosting.service.value=="Server Standard")||(document.hosting.service.value=="Server Profesional")){

       if (document.hosting.formadepago.value=='Mensual'){
           if (document.hosting.sistemaop.value=='Redhat Enterprise Server 4'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.credhat4.value*1); }
           if (document.hosting.sistemaop.value=='Windows 2003 Web Edition'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwswe.value*1); }
           if (document.hosting.sistemaop.value=='Windows Standard 2003'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwss.value*1); }
           if (document.hosting.sistemaop.value=='Windows Enterprise'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwse.value*1); }
           if (document.hosting.controlpanel.value=='WHM/CPanel/Fantastico/Rvskin'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.ccpanel.value*1); }
           if (document.hosting.controlpanel.value=='Plesk Dominios ilimitados'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cplesk.value*1); }
        }

       if (document.hosting.formadepago.value=='Trimestral'){
           if (document.hosting.sistemaop.value=='Redhat Enterprise Server 4'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.credhat4.value*3); }
           if (document.hosting.sistemaop.value=='Windows 2003 Web Edition'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwswe.value*3); }
           if (document.hosting.sistemaop.value=='Windows Standard 2003'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwss.value*3); }
           if (document.hosting.sistemaop.value=='Windows Enterprise'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwse.value*3); }
           if (document.hosting.controlpanel.value=='WHM/CPanel/Fantastico/Rvskin'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.ccpanel.value*3); }
           if (document.hosting.controlpanel.value=='Plesk Dominios ilimitados'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cplesk.value*3); }
        }


       if (document.hosting.formadepago.value=='Semestral'){
           if (document.hosting.sistemaop.value=='Redhat Enterprise Server 4'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.credhat4.value*6); }
           if (document.hosting.sistemaop.value=='Windows 2003 Web Edition'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwswe.value*6); }
           if (document.hosting.sistemaop.value=='Windows Standard 2003'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwss.value*6); }
           if (document.hosting.sistemaop.value=='Windows Enterprise'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwse.value*6); }
           if (document.hosting.controlpanel.value=='WHM/CPanel/Fantastico/Rvskin'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.ccpanel.value*6); }
           if (document.hosting.controlpanel.value=='Plesk Dominios ilimitados'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cplesk.value*6); }
        }


       if (document.hosting.formadepago.value=='Anual'){
           if (document.hosting.sistemaop.value=='Redhat Enterprise Server 4'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.credhat4.value*12); }
           if (document.hosting.sistemaop.value=='Windows 2003 Web Edition'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwswe.value*12); }
           if (document.hosting.sistemaop.value=='Windows Standard 2003'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwss.value*12); }
           if (document.hosting.sistemaop.value=='Windows Enterprise'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cwse.value*12); }
           if (document.hosting.controlpanel.value=='WHM/CPanel/Fantastico/Rvskin'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.ccpanel.value*12); }
           if (document.hosting.controlpanel.value=='Plesk Dominios ilimitados'){ document.hosting.precio.value= (document.hosting.precio.value*1)+(document.hosting.cplesk.value*12); }
        }

   }
   
   document.hosting.item_name.value=document.hosting.servicio.value;
   document.hosting.a3.value=document.hosting.precio.value;
   document.hosting.os0.value=document.hosting.domain.value;
   document.hosting.os1.value=document.hosting.data.value;


   if((document.hosting.service.value=="Personal")||(document.hosting.service.value=="Basico")||(document.hosting.service.value=="Profesional")||(document.hosting.service.value=="Empresarial")){
       if (!document.hosting.domain.value.length) {
           alert("Por Favor escriba el Dominio para el que desea el servicio de Web Hosting");
           return false;
       }
   }


   if(document.hosting.service.value=="Registro"){
       if (!document.hosting.domain.value.length) {
           alert("Por Favor escriba el Dominio que desea Registrar");
           return false;
       }
   }


   if(document.hosting.service.value=="Transferencia"){
       if (!document.hosting.domain.value.length) {
           alert("Por Favor escriba el Dominio que desea Transferir");
           return false;
       }
   }


   if(document.hosting.service.value=="Recuperacion"){
       if (!document.hosting.domain.value.length) {
           alert("Por Favor escriba el Dominio que desea Recuperar");
           return false;
       }
   }



   if (!isDomain(document.hosting.domain.value)) {
       alert("Por Favor escriba un Dominio Valido");
       return false
   }


   if (document.hosting.domain.value != document.hosting.domain2.value) {
       alert("El Dominio y la Repetición de Dominio son diferentes");
       return false
   }


   if((document.hosting.service.value=="Mini Reseller")||(document.hosting.service.value=="Reseller Standard")||(document.hosting.service.value=="Mega Reseller")) {
       if (!document.hosting.nameserver1.value.length) {
           alert("Por Favor escriba Name Server 1");
           return false;
       }

       if (regex.test(document.hosting.nameserver1.value)) {
           alert("Por Favor escriba Name Server 1 correctamente");
           return false
       }

       if (!document.hosting.nameserver2.value.length) {
           alert("Por Favor escriba Name Server 2");
           return false;
       }

       if (regex.test(document.hosting.nameserver2.value)) {
           alert("Por Favor escriba Name Server 2 correctamente");
           return false
       }

          document.hosting.os0.value +=" / DNS1: "+document.hosting.nameserver1.value+"."+document.hosting.domain.value;
          document.hosting.os0.value +=" / DNS2: "+document.hosting.nameserver2.value+"."+document.hosting.domain.value;

   }


   if((document.hosting.service.value=="Server Basico")||(document.hosting.service.value=="Server Standard")||(document.hosting.service.value=="Server Profesional")) {
      document.hosting.os0.value +="/ OS: "+document.hosting.sistemaop.value;
      document.hosting.os0.value +="/ CP: "+document.hosting.controlpanel.value;
   }

   
   if (!document.hosting.agree.checked) {
       alert("Seleccione SI Acepta las Políticas y Terminos de servicio de la Empresa");
       return false
   }


   
   // If we've gotten this far, everything's valid!
   return true;
}



///////////////////////////////////////////////////////////////////////////////////////

function stream(){


   if (!document.streaming.agree.checked) {
       alert("Seleccione SI Acepta las Políticas y Terminos de servicio de la Empresa");
       return false
   }

   if (document.streaming.listeners.value=="cotizar") {
       alert('Esta solicitando una cantidad superior a  500\nPor favor contactenos para una cotización'); return false;
   }

   
   // If we've gotten this far, everything's valid!
   return true;
}


///////////////////////////////////////////////////////////////////////////////////////

function eventos(){
   if (!document.streaming.agree.checked) {
       alert("Seleccione SI Acepta las Políticas y Terminos de servicio de la Empresa");
       return false
   }

   if (document.streaming.listeners.value=="cotizar") {
       alert('Esta solicitando una cantidad superior a  500\nPor favor contactenos para una cotización'); return false;
   }
   
   // If we've gotten this far, everything's valid!
   return true;
}

///////////////////////////////////////////////////////////////////////////////////////

function procesar(){

    document.write('<input name="precio" value="" type="hidden">');
    document.write('<input name="business" value="sales@salamancanetwork.com" type="hidden">');
    document.write('<input name="no_note" value="0" type="hidden">');
    document.write('<input name="currency_code" value="USD" type="hidden">');
    document.write('<input name="src" value="1" type="hidden">');
    document.write('<input name="sra" value="1" type="hidden">');
    document.write('<input name="item_number" value="" type="hidden">');
    document.write('<input name="item_name" value="" type="hidden">');
    document.write('<input name="p3" value="1" type="hidden">');
    document.write('<input name="a3" value="" type="hidden">');
    document.write('<input name="t3" value="" type="hidden">');
    document.write('<input name="on0" value="Dominio" type="hidden">');
    document.write('<input name="os0" value="" type="hidden">');
    document.write('<input name="on1" value="SN V_Id" type="hidden">');
    document.write('<input name="os1" value="" type="hidden">');
}

///////////////////////////////////////////////////////////////////////////////////////

function prostreaming(){

document.write('<input name="business" value="sales@salamancanetwork.com" type="hidden">');
document.write('<input name="no_note" value="0" type="hidden">');
document.write('<input name="currency_code" value="USD" type="hidden">');
document.write('<input name="src" value="1" type="hidden">');
document.write('<input name="sra" value="1" type="hidden">');
document.write('<input name="p3" value="1" type="hidden">');
document.write('<input name="t3" value="M" type="hidden">');
document.write('<input name="on0" value="SN V_Id" type="hidden">');
document.write('<input name="os0" value="" type="hidden">');
document.write('<input name="item_number" type="hidden">');
document.write('<input name="item_name" type="hidden">');
document.write('<input name="a3" type="hidden">');
document.write('<input name="pd" type="hidden">');
}

///////////////////////////////////////////////////////////////////////////////////////

function proeventos(){

document.write('<input type="hidden" name="cmd" value="_xclick">');
document.write('<input name="business" value="sales@salamancanetwork.com" type="hidden">');
document.write('<input name="item_name" type="hidden">');
document.write('<input name="item_number" type="hidden">');
document.write('<input name="amount" type="hidden">');
document.write('<input name="currency_code" value="USD" type="hidden">');
document.write('<input name="on0" value="SN V_Id" type="hidden">');
document.write('<input name="os0" value="" type="hidden">');
document.write('<input type="hidden" name="quantity" value="1">');

}



/////////////////////////////////////////////////////////////////////////////////////// ESTE ES UNO********

function procesarsolicitud(){


   var regex = /^\s*$/i;


   if (document.hosting.nombre.value == "") {
       alert("Por favor escriba su Nombre");
       return false
   }

   if(regex.test(document.hosting.nombre.value)){
      alert("Por favor escriba su nombre correctamente");
      return false;
   }
  
   if (document.hosting.telefono.value == "") {
       alert("Por favor escriba su teléfono");
       return false;
   }

   for (var z=0; z < document.hosting.telefono.value.length; z++){
        if ((document.hosting.telefono.value.charCodeAt(z)<48) || (document.hosting.telefono.value.charCodeAt(z)>57)) {
             alert("El número de teléfono tiene caracteres invalidos\nPor favor escriba solamente numeros de 0-9");
             return false;
        }
         
   }

   if (document.hosting.email.value == "") {
       alert("Por favor escriba su email");
       return false
   }

   if (!isEmail(document.hosting.email.value)) {
       alert("Por Favor escriba una dirección de email valida");
       return false
   }

   if (document.hosting.email.value != document.hosting.email2.value ) {
       alert("El Email y la repetición de Email son diferentes");
       return false
   }


   if (document.hosting.direccion.value == "") {
       alert("Por favor escriba su Dirección");
       return false
   }

   if(regex.test(document.hosting.direccion.value)){
      alert("Por favor escriba su dirección correctamente");
      return false;
   }

   if (document.hosting.ciudad.value == "") {
       alert("Por favor escriba su Ciudad");
       return false
   }

   if(regex.test(document.hosting.ciudad.value)){
      alert("Por favor escriba su ciudad correctamente");
      return false;
   }
   
   if(document.hosting.departamento.value == "0"){
      alert("Por favor seleccione su Departamento del cuadro desplegable");
      return false;
   }

   if (!document.hosting.domain.value.length) {
       alert("Por Favor escriba el Dominio para el que desea el servicio de Web Hosting");
       return false;
   }

   if (!isDomain(document.hosting.domain.value)) {
       alert("Por Favor escriba un Dominio Valido");
       return false
   }


   if (document.hosting.domain.value != document.hosting.domain2.value) {
       alert("El Dominio y la Repetición de Dominio son diferentes");
       return false
   }

   if (!document.hosting.agree.checked) {
       alert("Seleccione SI Acepta las Políticas y Terminos de servicio de la Empresa");
       return false
   }

    // If we've gotten this far, everything's valid!
    return true;
}


///////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////// ESTE ES UNO********

function datoscotizacion(){


   var regex = /^\s*$/i;


   if (document.hosting.nombre.value == "") {
       alert("Por favor escriba su Nombre");
       return false
   }

   if(regex.test(document.hosting.nombre.value)){
      alert("Por favor escriba su nombre correctamente");
      return false;
   }
  
   if (document.hosting.telefono.value == "") {
       alert("Por favor escriba su teléfono");
       return false;
   }

   for (var z=0; z < document.hosting.telefono.value.length; z++){
        if ((document.hosting.telefono.value.charCodeAt(z)<48) || (document.hosting.telefono.value.charCodeAt(z)>57)) {
             alert("El número de teléfono tiene caracteres invalidos\nPor favor escriba solamente numeros de 0-9");
             return false;
        }
         
   }

   if (document.hosting.email.value == "") {
       alert("Por favor escriba su email");
       return false
   }

   if (!isEmail(document.hosting.email.value)) {
       alert("Por Favor escriba una dirección de email valida");
       return false
   }

   if (document.hosting.email.value != document.hosting.email2.value ) {
       alert("El Email y la repetición de Email son diferentes");
       return false
   }


   if (document.hosting.direccion.value == "") {
       alert("Por favor escriba su Dirección");
       return false
   }

   if(regex.test(document.hosting.direccion.value)){
      alert("Por favor escriba su dirección correctamente");
      return false;
   }

   if (document.hosting.ciudad.value == "") {
       alert("Por favor escriba su Ciudad");
       return false
   }

   if(regex.test(document.hosting.ciudad.value)){
      alert("Por favor escriba su ciudad correctamente");
      return false;
   }
   
   if(document.hosting.departamento.value == "0"){
      alert("Por favor seleccione su Departamento del cuadro desplegable");
      return false;
   }

   if (!document.hosting.agree.checked) {
       alert("Seleccione SI Acepta los Terminos y Condiciones de Servicio de la Empresa");
       return false
   }

    // If we've gotten this far, everything's valid!
    return true;
}


///////////////////////////////////////////////////////////////////////////////////////


function solicituddestreaming(){


   var regex = /^\s*$/i;


   if (document.streaming.nombre.value == "") {
       alert("Por favor escriba su Nombre");
       return false
   }

   if(regex.test(document.streaming.nombre.value)){
      alert("Por favor escriba su nombre correctamente");
      return false;
   }
  
   if (document.streaming.telefono.value == "") {
       alert("Por favor escriba su teléfono");
       return false;
   }

   for (var z=0; z < document.streaming.telefono.value.length; z++){
        if ((document.streaming.telefono.value.charCodeAt(z)<48) || (document.streaming.telefono.value.charCodeAt(z)>57)) {
             alert("El número de teléfono tiene caracteres invalidos\nPor favor escriba solamente numeros de 0-9");
             return false;
        }
         
   }

   if (document.streaming.email.value == "") {
       alert("Por favor escriba su email");
       return false
   }

   if (!isEmail(document.streaming.email.value)) {
       alert("Por Favor escriba una dirección de email valida");
       return false
   }

   if (document.streaming.email.value != document.streaming.email2.value ) {
       alert("El Email y la repetición de Email son diferentes");
       return false
   }


   if (document.streaming.direccion.value == "") {
       alert("Por favor escriba su Dirección");
       return false
   }

   if(regex.test(document.streaming.direccion.value)){
      alert("Por favor escriba su dirección correctamente");
      return false;
   }

   if (document.streaming.ciudad.value == "") {
       alert("Por favor escriba su Ciudad");
       return false
   }

   if(regex.test(document.streaming.ciudad.value)){
      alert("Por favor escriba su ciudad correctamente");
      return false;
   }



   if (!document.streaming.agree.checked) {
       alert("Seleccione SI Acepta las Políticas y Terminos de servicio de la Empresa");
       return false
   }


   if (document.streaming.listeners.value=="cotizar") {
       alert('Esta solicitando una cantidad superior a  500\nPor favor contactenos para una cotización'); return false;
   }

    // If we've gotten this far, everything's valid!
    return true;
}



///////////////////////////////////////////////////////////////////////////////////////

function isDomain(str) {
	var filter  = /^(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return (filter.test(str));
}


///////////////////////////////////////////////////////////////////////////////////////

function vacio(val){
      var re = /^[\w ]+$/;
      }

///////////////////////////////////////////////////////////////////////////////////////

function isEmail(str) {
     var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
     return (filter.test(str));
}

///////////////////////////////////////////////////////////////////////////////////////

function dns(){
    document.hosting.dns1.value=document.hosting.domain.value;
    document.hosting.dns2.value=document.hosting.domain.value;
}

///////////////////////////////////////////////////////////////////////////////////////

function SinEspacios(str) {
var filter  = /^([a-zA-Z0-9_\.\-])/;
return (filter.test(str));
}

///////////////////////////////////////////////////////////////////////////////////////

function contactenos(emailStr) {

var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);

if (!SinEspacios(document.formcontacto.nombre.value)) {
	alert("Por favor escriba su nombre");
	return false;
}

///// Comienzo de comprobacion de correo electronico
if (matchArray==null) {
alert("La dirección de Email parece no estar correcta (verifique @ y dominio)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("El nombre de usuario contiene caracteres no válidos.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("El nombre de dominio contiene caracteres no válidos.");
return false;
   }
}

if (user.match(userPat)==null) {
alert("El nombre de usuario parece no ser válido.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("La IP de destino no parece ser válida!");
return false;
   }
}
return true;
}

var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("El nombre de dominio no parece ser válido.");
return false;
   }
}

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("La dirección debe terminar en un dominio conocido o dos letras del país.");
return false;
}

if (len<2) {
alert("Esta dirección necesita un nombre de dominio!");
return false;
}
///// Fin de comprobación de correo electrónico.

///// comienza verificación del número de teléfono
if (!SinEspacios(document.formcontacto.telefono.value)) {
	alert("Por favor escriba su número de Teléfono.");
	return false;
}

for (var z=0; z < document.formcontacto.telefono.value.length; z++){
	if ((document.formcontacto.telefono.value.charCodeAt(z)<48) || (document.formcontacto.telefono.value.charCodeAt(z)>57)) {
		alert("El número de teléfono contiene caracteres no válidos\n Por favor escriba solamente numeros del 0-9");
		return false;
	}
}

if (document.formcontacto.telefono.value.length == 8) {
	numerodetelefono = document.formcontacto.telefono.value;
	if (numerodetelefono != ""){
    	for (var z=0; z < document.formcontacto.telefono.value.length; z++){
			if ((document.formcontacto.telefono.value.charCodeAt(z)<48) || (document.formcontacto.telefono.value.charCodeAt(z)>57)) {
				alert("El número de teléfono tiene caracteres no válidos\n Por favor escriba solamente numeros del 0-9")
				return false;
			}
        }
	}
} else {
	var faltan = 8 - document.formcontacto.telefono.value.length;
	var mireelnumero = document.formcontacto.telefono.value;
	for (a=0; a<faltan; a++) {
		mireelnumero = mireelnumero+"x";
	}
	alert("El número de teléfono debe tener 8 digitos\nEscriba los "+faltan +" números restantes por favor\n                  " + mireelnumero +"\n\n Si su número de teléfono es internacional,\n por favor escríbalo en el mensaje.");
	return false;
}
////////// fin de verificacion de telefono

if (document.formcontacto.departamento.value == '0') {
	alert("Por favor seleccione el departamento al que refiere el mensaje");
	return false;
}

if (!SinEspacios(document.formcontacto.asunto.value)) {
	alert("Por favor escriba el Asunto del Mensaje");
	return false;
}

if (!SinEspacios(document.formcontacto.mensaje.value)) {
	alert("Por favor escriba el mensaje que desea enviar");
	return false;
}

// Ya hemos verificado que todos los campos necesarios no estan en blanco
return true;
}

//// VALIDACION DEL FORMULARIO WHOIS
function vdominio() {
missinginfo = "";
if ((document.vquien.ddomain.value == "") || (document.vquien.ddomain.value == "www.")) {
alert("Por favor escriba un nombre de dominio para consultar\nEjemplo: sunegocio.com");
return false;
}
cadena1 = document.vquien.ddomain.value;
cuenta1 = 0;
cadena1 = document.vquien.ddomain.value;
if (cadena1 != ""){
        var calculoext = 0;
        var nombredeextension = "";   
               for (var x=calculoext; x < document.vquien.ddomain.value.length; x++){
                   nombredeextension = document.vquien.ddomain.value.charAt(x);  
                    if (nombredeextension == " "){
                       missinginfo += "\n Su sitio web "+ cadena1 +"\n\n tiene espacios en blanco";
                       alert(missinginfo);
                       return false;            
                   }  
                    if (nombredeextension == "."){
                       cuenta1 = cuenta1 + 1; 
                       nombredesite = x
                   }               
               }
     if (cuenta1>1){
           missinginfo += "\n Su sitio web tiene "+ cuenta1 +" puntos\n\n Por favor escriba solamente 1 puntos \n Ej.: sunegocio.com ";
           alert(missinginfo);
           return false;       
     }
}
cadena2 = document.vquien.ddomain.value;
if (cadena2 != ""){
        var calculoext = document.vquien.ddomain.value.length - 5
        var nombredeextension = "";   
               for (var x=calculoext; x < document.vquien.ddomain.value.length; x++){
                   nombredeextension += document.vquien.ddomain.value.charAt(x);                
               }
                 if (nombredeextension == ".info"){
                              
                 }
                  else {
                          var calculoext = document.vquien.ddomain.value.length - 4
                          var nombredeextension = "";   
                          for (var x=calculoext; x < document.vquien.ddomain.value.length; x++){
                                nombredeextension += document.vquien.ddomain.value.charAt(x);                
                               } 
                          if ((nombredeextension == ".com") || (nombredeextension == ".net") || (nombredeextension == ".org") || (nombredeextension == ".info") || (nombredeextension == ".name") || (nombredeextension == ".biz") || (nombredeextension == ".edu") || (nombredeextension == ".us") || (nombredeextension == ".ws") || (nombredeextension == ".tv")){
                              
                          }  
                           else { 
                                   var calculoext = document.vquien.ddomain.value.length - 3
                                   var nombredeextension = "";   
                                   for (var x=calculoext; x < document.vquien.ddomain.value.length; x++){
                                        nombredeextension += document.vquien.ddomain.value.charAt(x);                
                                       } 
                                           missinginfo += "\n Su sitio web "+cadena2+"\n\n No termina con .com., .net, .org, .info, .name, .biz, .edu, .us, .ws, .tv  \n \n Por favor escribalo correctamente";
                                           alert(missinginfo);
                                           return false;
                                 }
                        }
}
if (nombredesite < 2){
alert("El nombre de Su sitio web \n debe tener mas de 1 caracter antes de "+nombredeextension);
return false;
}
for (var z=0; z < 2; z++){
if (document.vquien.ddomain.value.charCodeAt(z)==45) {
alert("Por favor, No inicie con (-) despues de www.");
return false;
  }
}
var guion=0;
var banderadeguion=0;
var guionfinal=0;
for (var z=0; z < document.vquien.ddomain.value.length; z++){
   if (document.vquien.ddomain.value.charCodeAt(z)==46){
      banderadeguion=banderadeguion + 1;
     }
    if (banderadeguion==1){
     var guion=guion + 1;
     }
    if (guion==1){
      guionfinal = z;
    }
}
var calculoext = guionfinal;
        var nombredeextension = "";   
               for (var x=calculoext; x < document.vquien.ddomain.value.length; x++){
                   nombredeextension += document.vquien.ddomain.value.charAt(x);                
               }
for (var z=guionfinal-1; z < guionfinal+1; z++){
if (document.vquien.ddomain.value.charCodeAt(z)==45) {
alert("Por favor, No escriba  (-) antes de "+nombredeextension);
return false;
  }
}
for (var z=0; z < document.vquien.ddomain.value.length; z++){
if (((document.vquien.ddomain.value.charCodeAt(z)>1) && (document.vquien.ddomain.value.charCodeAt(z)<45)) || ((document.vquien.ddomain.value.charCodeAt(z)>46) && (document.vquien.ddomain.value.charCodeAt(z)<48)) || ((document.vquien.ddomain.value.charCodeAt(z)>57) && (document.vquien.ddomain.value.charCodeAt(z)<65)) || ((document.vquien.ddomain.value.charCodeAt(z)>90) && (document.vquien.ddomain.value.charCodeAt(z)<97)) || ((document.vquien.ddomain.value.charCodeAt(z)>122) && (document.vquien.ddomain.value.charCodeAt(z)<255))) {
alert("El Sitio web tiene caracteres invalidos");
return false;
  }
}
// If we've gotten this far, everything's valid!
return true;
}

function entrada_focus(o){
	if(document.top_busqueda_caja.q.value=="Digite el Producto a Buscar"){document.top_busqueda_caja.q.value=''}
}
function entrada_blur(o){
	if(document.top_busqueda_caja.q.value==""){document.top_busqueda_caja.q.value='Digite el Producto a Buscar'}
}
function ibuscador_intro(e){
  tecla=(document.all)?e.keyCode:e.which;
  if(tecla==13)
		verificar_busqueda();
}
function verificar_busqueda(){
	if(document.top_busqueda_caja.q.value=="Digite el Producto a Buscar" || document.top_busqueda_caja.q.value==""){
		alert("Debe escribir el nombre de un producto para realizar la busqueda");
		document.top_busqueda_caja.q.focus();
		return false;
	} else {
		window.location = 'buscar.php?q='+q;
	}
}
