var arr = new Array(
'.com','.net','.org','.biz','.coop','.info','.museum','.name',
'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
'.wf','.ye','.yt','.yu','.za','.zm','.zw','.ctu','.asia');

function valida_extension(){
campo=document.form.dominio.value;
var comprobacion = campo;
var error = false;
var val = true;
var punto = comprobacion.lastIndexOf(".");
var nombre_dominio = comprobacion.substring(0,punto);
var extension = comprobacion.substring(punto,comprobacion.length);

if(campo==""){
        alert('Debe ingresar su dominio para continuar');
        error = true;
}
else if(punto==-1){
        alert('Debe ingresar la extensión de su dominio');
        error = true;
}
else if(punto>2 && punto<57)
{
        for(var i=0; i<arr.length; i++)
        {
          if(extension == arr[i]){
                 val = true;
                break;
          }
          else{
                 val = false;
          }
        }
        if(val == false){
                 alert("La extensión del  dominio "+extension+" no es correcta");
                 error = true;
        }
        else
        {
                for(var j=0; j<nombre_dominio.length; j++)
                {
                  var dh = nombre_dominio.charAt(j);
                  var hh = dh.charCodeAt(0);
                  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
                  {
                         if((j==0 || j==nombre_dominio.length-1) && hh == 45)
                         {
                                    alert("El nombre de dominio no puede contener el simbolo guion '-' al principio o al final");
                                    error = true;
                                    //return false;
                         }
                  }
                  else{
                           alert("El dominio no puede contener caracteres especiales");
                                    error = true;
                         //return false;
                  }
                }
        }
}

if(error==false)
document.form.submit();
}

function valida_extensionTchile(){
campo=document.form.dominio.value;
var comprobacion = campo;
var error = false;
var val = true;
var punto = comprobacion.lastIndexOf(".");
var nombre_dominio = comprobacion.substring(0,punto);
var extension = comprobacion.substring(punto,comprobacion.length);

if(campo==""){
        alert('Debe ingresar su dominio para continuar');
        error = true;
}
else if(punto>2 && punto<57)
{
        for(var i=0; i<arr.length; i++)
        {
          if(extension == arr[i]){
                 val = true;
                break;
          }
          else{
                 val = false;
          }
        }
        if(val == false){
                 //alert("La extensión del  dominio "+extension+" no es correcta");
                 //error = true;
        }
        else
        {
                for(var j=0; j<nombre_dominio.length; j++)
                {
                  var dh = nombre_dominio.charAt(j);
                  var hh = dh.charCodeAt(0);
                  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
                  {
                         if((j==0 || j==nombre_dominio.length-1) && hh == 45)
                         {
                                    alert("El nombre de dominio no puede contener el simbolo guion '-' al principio o al final");
                                    error = true;
                                    //return false;
                         }
                  }
                  else{
                           alert("El dominio no puede contener caracteres especiales");
                                    error = true;
                         //return false;
                  }
                }
        }
}

if(error==false)
document.form.submit();
}

function envia_form_gratis(value){
        if(document.form.dominio.value==""){
                alert('Ingrese un dominio a buscar');
                document.form.dominio.focus();
        }
        else{
          document.form.buscar.value='Buscando...';
          document.form.buscar.disabled='true';
          document.form.submit();
        }
}

function envia_form_direcc(value){
        if(document.form1.dominio.value==""){
                alert('Ingrese un dominio a buscar');
                document.form1.dominio.focus();
        }
        else{
          document.form1.buscar_x.value='Buscando...';
          document.form1.buscar_x.disabled='true';
          document.form1.submit();
        }
}

function envia_form(value){
        if(document.form.dominio.value==""){
                alert('Ingrese un dominio a buscar');
                document.form.dominio.focus();
        }
        else{
          document.form.buscar.value='Buscando...';
          document.form.buscar.disabled='true';
          document.form.submit();
        }
}

function habilita(plan){
    for(i=0;i<document.form.plan.length;i++){
        if(document.form.plan[i].value!=plan){
            if((document.form.plan[i].value!='basico')&&(i<=0)){
                document.form.periodo[i].options[0].selected=true;
            }
            else{
                document.form.periodo[i].options[3].selected=true;
            }

            document.form.periodo[i].disabled=true;
            document.form.valor[i].value='';
            document.form.valor_ahorro[i].value='';
            //j1.style.display='';
            //j2.style.display='';
            //j3.style.display='';
        }
        else{
            if(document.form.valor_ahorro[i].value==""){
                if(plan!='presencia'){
                   document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+plan+'[1]')*document.form.periodo[i].value)-(eval('Precios_'+plan+'[12]')));
                }
                else{
                   document.form.valor_ahorro[i].value = '-';
                }
            }
            document.form.periodo[i].disabled=false;
//alert(document.form.periodo[i].value);
            if(document.form.periodo[i].value==12){
            document.form.valor[i].value=FormatoPesos(eval('Precios_'+plan+'[12]'));
            document.form.valor_plan.value=FormatoPesos(eval('Precios_'+plan+'[12]'));
            }
        }
    }
    if(plan=='basico')      {i=1;}
    if(plan=='estandar')    {i=2;}
    if(plan=='profesional') {i=3;}
    if(document.form.plan.length==4){
        if(((plan=='basico')||(plan=='estandar')||(plan=='profesional'))&&(document.form.periodo[i].value>=12)){
            x.style.display='none';
            y.style.display='';
            z.style.display='';
        }
        else{
            x.style.display='';
            y.style.display='none';
            z.style.display='none';
        }
    }
}

function habilitaTChile(plan){
    for(i=0;i<document.form.plan.length;i++){
        if(document.form.plan[i].value!=plan){
            document.form.periodo[i].disabled = true;
            if((document.form.plan[i].value=='presencia')||(document.form.plan[i].value=='basico')){
               document.form.periodo[i].options[0].selected=true;
            }
            else{
               if(document.form.plan[i].value=='estandar'){
                  document.form.periodo[i].options[2].selected=true;
               }
               else{
                  document.form.periodo[i].options[3].selected=true;
               }

            }

            document.form.valor[i].value='';
            document.form.valor_ahorro[i].value='';
        }
        else{
            document.form.periodo[i].disabled = false;
            if(document.form.valor_ahorro[i].value==""){
                if((plan=='presencia')||(plan=='basico')){
                   document.form.valor_ahorro[i].value = '-';
                }
                else{
                  document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+plan+'[1]')*document.form.periodo[i].value)-(eval('Precios_'+plan+'[12]')));
                  //document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+plan+'[1]')*anios)-numero);
                }
            }


            if(document.form.periodo[i].value==12){
               document.form.valor[i].value=FormatoPesos(eval('Precios_'+plan+'[12]'));
               document.form.valor_plan.value=FormatoPesos(eval('Precios_'+plan+'[12]'));
            }

        }
    }

    if(plan=='basico')      {i=1;}
    if(plan=='estandar')    {i=2;}
    if(plan=='profesional') {i=3;}
    if(document.form.plan.length==4){
        if(((plan=='estandar')||(plan=='profesional'))&&(document.form.periodo[i].value>=12)){
            x.style.display='none';
            y.style.display='';
            z.style.display='';
        }
        else{
            x.style.display='';
            y.style.display='none';
            z.style.display='none';
        }
    }
}
function valida(){
       a = document.getElementById('TengoDominio');
       a1= document.getElementById('TengoDominio2');
       b = document.getElementById('QuieroComprar');
       b1= document.getElementById('QuieroComprar2');
       c = document.getElementById('DeseoOferta');
       c1= document.getElementById('DeseoOferta2');
       d = document.getElementById('DeseoOfertaIgual');
       d1= document.getElementById('DeseoOfertaIgual2');

       sw=0;
       if(a.style.display!='none'){if(a1.checked==true){sw=1;}}
       if(b.style.display!='none'){if(b1.checked==true){sw=1;}}
       if(c.style.display!='none'){if(c1.checked==true){sw=1;}}
       if(d.style.display!='none'){if(d1.checked==true){sw=1;}}

       if(sw==0){alert('Seleccione una de las opciones anteriores')  }
       else{  document.form.submit(); }
}
function validaTChile(){
       a = document.getElementById('TengoDominio');
       a1= document.getElementById('TengoDominio2');
       b = document.getElementById('QuieroComprar');
       b1= document.getElementById('QuieroComprar2');
       c = document.getElementById('DeseoOferta');
       c1= document.getElementById('DeseoOferta2');
       d = document.getElementById('DeseoOfertaIgual');
       d1= document.getElementById('DeseoOfertaIgual2');

       md = document.getElementById('quieroDM');
       md1= document.getElementById('quieroDM2');

       p1 = document.getElementById('plan1');
       p2 = document.getElementById('plan2');
       p3 = document.getElementById('plan3');
       p4 = document.getElementById('plan4');

       sw=0;
       if(p1.checked==true){sw=1;}
       if(p2.checked==true){sw=1;}
       if(p3.checked==true){sw=1;}
       if(p4.checked==true){sw=1;}
       if(sw==0){alert('Seleccione uno de los planes de la lista')  }
       else{
       sw=0;
       if(a.style.display!='none'){if(a1.checked==true){sw=1;}}
       if(b.style.display!='none'){if(b1.checked==true){sw=1;}}
       if(c.style.display!='none'){if(c1.checked==true){sw=1;}}
       if(d.style.display!='none'){if(d1.checked==true){sw=1;}}
       if(md.style.display!='none'){if(md1.checked==true){sw=1;}}
       if(sw==0){alert('Seleccione la opción correspondiente al dominio')  }
       else{  document.form.submit(); }
       }
}

function valida_vps(){
       a = document.getElementById('TengoDominio');
       a1= document.getElementById('TengoDominio2');
       c = document.getElementById('DeseoOferta');
       c1= document.getElementById('DeseoOferta2');
       d = document.getElementById('DeseoOfertaIgual');
       d1= document.getElementById('DeseoOfertaIgual2');
       sw=0;
       if(a1.checked==true){            sw=1;            }
       if(c1.checked==true){            sw=1;            }
       if(d1.checked==true){            sw=1;            }
       if(sw==0){ alert('Seleccione una de las opciones anteriores')  }
       else{ document.form.submit(); }
}

function CambiaValor(anios){
    for(i=0;i<document.form.periodo.length;i++){
        if(document.form.periodo[i].disabled!=true){
          planx = document.form.plan[i].value;
          numero = eval('Precios_'+planx+'['+anios+']');
          document.form.valor[i].value = FormatoPesos(numero);
          if(planx!='presencia'){
              document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[1]')*anios)-numero);
          }
          else{
              document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[12]')*(anios/12))-numero);
          }

//          if(document.form.valor_ahorro[i].value !=0){
//            document.form.valor_ahorro[i].style.textDecoration='line-through';
//          }
          document.form.valor_plan.value=FormatoPesos(numero);
          //m=i-2;
          //m=i;
          //if((planx=='basico')||(planx=='estandar')||(planx=='profesional')){
                //if((años==12)||(años==24)||(años==36)){
                    //if((m!=0)&&(m!=1))
                    //eval("j"+m+".style.display='block';");
                //}
                //else{
                    //if((m!=0)&&(m!=1))
                    //eval("j"+m+".style.display='none';");
                //}
          //}
          //else{

          //}
        }
    }
    if(((planx=='basico')||(planx=='estandar')||(planx=='profesional'))&&(anios==12)){
        y.style.display='';
        z.style.display='';
        x.style.display='none';
    }
    else{
        y.style.display='none';
        z.style.display='none';
        x.style.display='';
    }
}


function CambiaValorTchile(anios){
    for(i=0;i<document.form.periodo.length;i++){
        if(document.form.periodo[i].disabled!=true){
          planx = document.form.plan[i].value;
          numero = eval('Precios_'+planx+'['+anios+']');
          document.form.valor[i].value = FormatoPesos(numero);
          //if(planx=='presencia'){
            document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[1]')*anios)-numero);
          //}
          /*
          else if(planx=='basico'){

          }
          else if(planx=='estandar'){

          }
          else if(planx=='profesional'){

          }


          if((planx=='estandar')){
             document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[1]')*anios)-numero);

             if(document.form.valor_ahorro[i].value=='-0'){
                  document.form.valor_ahorro[i].value= '0';
             }
          }
          else{
             document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[1]')*anios)-numero);
          }
          */
          document.form.valor_plan.value=FormatoPesos(numero);
        }
    }
    if(((planx=='basico')||(planx=='estandar')||(planx=='profesional'))&&(anios>=12)){
        y.style.display='';
        z.style.display='';
        x.style.display='none';
    }
    else{
        y.style.display='none';
        z.style.display='none';
        x.style.display='';
    }
}

function CambiaValorVPS(anios){

   for(i=0;i<document.form.periodo.length;i++){
        if(document.form.periodo[i].disabled!=true){
          planx = document.form.plan[i].value;

          numero = eval('Precios_'+planx+'['+anios+']');
          document.form.valor[i].value = FormatoPesos(numero);
          if(planx!='presencia'){
              if(anios==12){
                  document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[1]')*anios)-numero+eval('instalacioVPS_'+planx));
              }
              else{
                  document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[1]')*anios)-numero);
              }
          }
          else{
              document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+planx+'[12]')*(anios/12))-numero);
          }

//          if(document.form.valor_ahorro[i].value !=0){
//            document.form.valor_ahorro[i].style.textDecoration='line-through';
//          }
          document.form.valor_plan.value=FormatoPesos(numero);
          //m=i-2;
          //m=i;
          //if((planx=='basico')||(planx=='estandar')||(planx=='profesional')){
                //if((años==12)||(años==24)||(años==36)){
                    //if((m!=0)&&(m!=1))
                    //eval("j"+m+".style.display='block';");
                //}
                //else{
                    //if((m!=0)&&(m!=1))
                    //eval("j"+m+".style.display='none';");
                //}
          //}
          //else{

          //}
        }
    }
    if(((planx=='basico')||(planx=='estandar')||(planx=='profesional'))&&((anios==12)||(anios==24)||(anios==36))){
        y.style.display='';
        z.style.display='';
        x.style.display='none';
    }
    else{
        y.style.display='none';
        z.style.display='none';
        x.style.display='';
    }
}

function habilitaVPS(plan){
    for(i=0;i<document.form.plan.length;i++){
        if(document.form.plan[i].value!=plan){
            if((document.form.plan[i].value!='basico')&&(i<=0)){
                document.form.periodo[i].options[0].selected=true;
            }
            else{
                document.form.periodo[i].options[3].selected=true;
            }

            document.form.periodo[i].disabled=true;
            document.form.valor[i].value='';
            document.form.valor_ahorro[i].value='';
        }
        else{
            if(document.form.valor_ahorro[i].value==""){
                if(plan!='presencia'){
                   document.form.valor_ahorro[i].value = FormatoPesos((eval('Precios_'+plan+'[1]')*document.form.periodo[i].value)-(eval('Precios_'+plan+'[12]'))+eval('instalacioVPS_'+plan));
                }
                else{
                   document.form.valor_ahorro[i].value = '-';
                }
            }
            document.form.periodo[i].disabled=false;
            if(document.form.periodo[i].value==12){
               document.form.valor[i].value=FormatoPesos(eval('Precios_'+plan+'[12]'));
               document.form.valor_plan.value=FormatoPesos(eval('Precios_'+plan+'[12]'));
            }
        }
    }
    if(plan=='basico')      {i=1;}
    if(plan=='estandar')    {i=2;}
    if(plan=='profesional') {i=3;}
    if(document.form.plan.length==4){
        if(((plan=='basico')||(plan=='estandar')||(plan=='profesional'))&&(document.form.periodo[i].value>=12)){
            x.style.display='none';
            y.style.display='';
            z.style.display='';
        }
        else{
            x.style.display='';
            y.style.display='none';
            z.style.display='none';
        }
    }
}

function LimpiaCampo(txt1,txt2){
        if(txt1.value=='Email')
           txt1.value = '';
        if(txt2.value=='password')
          txt2.value = '';

}
function LlenaCampo(txt1,txt2){
        if(!txt1.value){
                txt1.value='Email';
                txt1.blur();
        }
        if((!txt2.value)&&(txt1.value=='Email')){
                txt2.value='password';
                txt2.blur();
        }
}
function CampoLleno(txt1,txt2){
        if ((txt1.value=="Email")||(txt1.value=="")){
                alert("Debe ingresar su mail");
                txt1.value='Email';
                txt1.focus();
        }
        else{
           if(txt2.value==""){
                alert("Debe ingresar su password");
                txt2.focus();
           }
        }
}

function CargaCodigoFono(IdPais){
             document.frm_registro.cod_pais_fono.value = combo[IdPais];
}

function ValidaCamposCliente(){
             email         = document.getElementById('email');
             password      = document.getElementById('password');
             confirmacion  = document.getElementById('confirmacion');
             nombre        = document.getElementById('nombre');
             apellidos     = document.getElementById('apellidos');
             pais_cliente  = document.getElementById('pais_cliente');
             cod_pais_fono = document.getElementById('cod_pais_fono');
             cod_ciudad    = document.getElementById('cod_ciudad');
             telefono      = document.getElementById('telefono');
             direccion     = document.getElementById('direccion');
             ciudad        = document.getElementById('ciudad');


             if(email.value ==""){
                alert('Por favor, ingrese su dirección de correo');
                email.focus();
             }
             else if(password.value ==""){
                alert('Por favor, ingrese la password que utilizará en CTUHosting');
                password.focus();
             }
             else if(confirmacion.value ==""){
                alert('Por favor, ingrese la confirmación de la password');
                confirmacion.focus();
             }
             else if(nombre.value ==""){
                alert('Por favor, ingrese su nombre');
                nombre.focus();
             }
             else if(apellidos.value ==""){
                alert('Por favor, ingrese su apellido');
                apellidos.focus();
             }
             else if(cod_pais_fono.value ==""){
                alert('Por favor, seleccione su pais');
                cod_pais_fono.focus();
             }
             else if(cod_ciudad.value ==""){
                alert('Por favor, ingrese el código de área de su ciudad');
                cod_ciudad.focus();
             }
             else if(telefono.value ==""){
                alert('Por favor, ingrese su teléfono');
                telefono.focus();
             }
             else if(direccion.value ==""){
                alert('Por favor, ingrese su dirección');
                direccion.focus();
             }
             else if(ciudad.value ==""){
                alert('Por favor, ingrese su ciudad');
                ciudad.focus();
             }
             else{
                 document.frm_registro.submit();
             }



}

function AgregarDominio(chk,sel,txt,valor)
{
        b3 = document.getElementById('ValorDominio_'+chk.value+'_PorAnio');
        b4 = document.getElementById("CLP"+chk.value);
        if(chk.checked){
                b3.style.color='#000000';
                b4.style.color='#000000';
                sel.disabled=false;
                txt.value=FormatoPesos(eval('Precios_'+chk.value+'['+sel.value+'] * sel.value ;'));
                eval('PreciosDominioPeriodo[\''+chk.value+'\']='+'Precios_'+chk.value+'['+sel.value+'] * sel.value ;');
                r = FormatoPesos(eval('Precios_'+chk.value+'['+sel.value+'];'));
                valor.value = r;

        }
        else{
                b3.style.color='#DEE3E7';
                b4.style.color='#DEE3E7';
                sel.disabled=true;
                txt.value='';
                eval('PreciosDominioPeriodo[\''+chk.value+'\']=0;');
        }
        CalcularTotales(document.dominios.ValorTotalIva);
}

function FormatoPesos(num)
{
        separador_miles='.';
        num = num.toString().replace(/\$|\,/g,'');
        if(isNaN(num))
                num = "0";
        sign = (num == (num = Math.abs(num)));
        num = Math.floor(num*100+0.50000000001);
        cents = num%100;
        num = Math.floor(num/100).toString();
        if(cents<10)
                cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        {
                num = num.substring(0,num.length-(4*i+3))+separador_miles+
                num.substring(num.length-(4*i+3));
        }
        return (((sign)?'':'-') + num );
}
function CalcularTotales(Total)
{
        Suma = 0;
        for (i in PreciosDominioPeriodo)
        {
                Suma = Suma + (eval('PreciosDominioPeriodo[\''+i+'\']'));
        }
        ValorTotalIvaFinal = Suma;
        if(Total)
        {
           Total.value = FormatoPesos(Suma);
        }
}
function EscondeCajaURL(chk,ext)
{
  //capturamos los div
  a1 = document.getElementById('CajaURL_'+ext);
  a2 = document.getElementById('CajaMasking_'+ext);
  a3 = document.getElementById('CajaPeriodoRedir_'+ext);
  a4 = document.getElementById('CajaValorRedir_'+ext);
  a5 = document.getElementById('CajaValorFinalMirror_'+ext);
  for(i=1;i<=5;i++)
  {
          r=eval('a'+i);
          if(chk.checked==true)
          {
                if((eval('a'+i)!=a4)&&(eval('a'+i)!=a3))
                r.style.display='block';
          }
          else
          {
                if((eval('a'+i)!=a4)&&(eval('a'+i)!=a3))
                r.style.display='none';
          }
  }
  if(chk.checked==true)
  CalculaValorAnio(ext)
}

function CalculaValorAnio(ext)
{
  //capuramos los objetos del form
  b1 = document.getElementById("Periodo_Mirror_"+ext);
  b2 = document.getElementById("ValorMirrorPorAnio_"+ext);
  b3 = document.getElementById("ValorFinalMirror_"+ext);
  b4 = document.getElementById("periodo_"+ext);
  b5 = document.getElementById("ValorTotalIva");
  b2.value = FormatoPesos(PrecioMirror[b1.value]);
  b3.value = FormatoPesos(PrecioMirror[b1.value] * b1.value);
  a = eval('Precios_'+ ext +'['+ b4.value +']')* b4.value;
  b = eval('PrecioMirror['+ b1.value +']')* b1.value;
  PreciosDominioPeriodo[ext] = a + b;
  CalcularTotales(b5);
}

function RestaValorOculto(chk,ext)
{
   if(chk.checked==false)
   {
          b1 = document.getElementById("Periodo_Mirror_"+ext);
          b5 = document.getElementById("ValorTotalIva");
          b  = eval('PrecioMirror['+ b1.value +']')* b1.value;
          valor = eval('PreciosDominioPeriodo[\''+ext+'\']');
          x = (valor-b);
          eval('PreciosDominioPeriodo[\''+ext+'\']='+x)
          ValorTotalIvaFinal = ValorTotalIvaFinal - b;
          b5.value = FormatoPesos(ValorTotalIvaFinal);
   }
}
