//Rutinas Generales var portletID; function imprimirFactura(pt){ var ficha=document.getElementById("divImprimir"); var ventimp=window.open('','popimpr'); var codigo ='.bloque_carrito_proceso3_f2_c1{width: auto;height: auto;padding: 10px 10px 10px 10px;margin-bottom: 3px;background: #ffffff url('+ PTIncluder.imageServerURL + 'plumtree/portal/custom/publico/images/fondo_carrito_central7.gif) no-repeat ;}' + '.bloque_carrito_proceso3_f3_c1{width: auto;height: auto;padding: 10px 10px 10px 14px;margin-bottom: 3px;background: #ffffff url('+ PTIncluder.imageServerURL + 'plumtree/portal/custom/publico/images/fondo_carrito_central7.gif) no-repeat ;}'+ '.contenedor_datos_resumen1{width: auto;height: auto;padding: 20px 20px 10px 20px;margin: 0px auto;}' + '.contenedor_datos_resumen2{width: 654px;height: auto;padding: 0px 20px 10px 20px;margin: 0px auto;}'+ '.contenedor_datos_texto1{width: auto;height: 36px;padding: 0px 0px 0px 0px;}'+ '.contenedor_datos_texto1 h2{font: bold 11px Arial, Helvetica, sans-serif;margin: 0px 0px 0px 0px;}'+ '.contenedor_datos_texto1 h3{font: normal 11px "Arial Narrow", Arial, Helvetica, sans-serif;margin: 0px 0px 0px 0px;color: #6F6661;}'+ '.contenedor_datos_texto1 span{color: #930e14;margin-left: 5px;}'+ '.contenedor_datos_texto2{width: auto; height: auto; padding: 20px 0px 0px 0px;}' + '.contenedor_datos_texto2 h2{font: bold 11px Arial, Helvetica, sans-serif; margin: 0px 0px 0px 0px;}' + '.contenedor_datos_texto2 h3{font: normal 11px "Arial Narrow", Arial, Helvetica, sans-serif; margin: 0px 0px 0px 0px; color: #6F6661;}' + '.contenedor_datos_texto3{width: auto;height: auto;padding: 20px 0px 0px 0px;}'+ '.contenedor_datos_texto3 h2{font: bold 11px Arial, Helvetica, sans-serif;margin: 0px 0px 0px 0px;}'+ '.contenedor_datos_texto3 h3{font: normal 11px "Arial Narrow", Arial, Helvetica, sans-serif;margin: 0px 0px 0px 0px;color: #6F6661;}'+ '.contenedor_resumen_compra{width: auto;height: auto;padding: 20px 20px 10px 20px;margin: 0px auto;}'+ '.contenedor_pago_electronico{width: 654px;height: auto;padding: 20px 20px 10px 20px;margin: 0px auto;}' + '.txt_datos_titulo1{color: #70190F;}'+ '.txt_datos_titulo2{color: #5D5D5F;}'+ '.division_planes{width: 700px;height: 1px;background: #e2e3e3;overflow: hidden;}'+ '.td_compra_generico1{padding: 4px 2px;margin: 0px;border-collapse: collapse;font: normal 10px "Arial Narrow", Arial, Helvetica, sans-serif;color: #5F6062;background: #D2D3D4;text-align: center;}'+ '.td_compra_generico1 a:link{text-decoration: none;color: #743F3F;}'+ '.td_compra_generico1 a:visited{text-decoration: none;color: #743F3F;}'+ '.td_compra_generico1 a:hover{text-decoration: underline;color: #743F3F;}'+ '.td_compra_generico1 a:active{text-decoration: none;color: #743F3F;}'+ '.td_compra_producto{padding: 4px 2px 4px 2px;margin: 0px;border-collapse: collapse;font: normal 12px "Arial Narrow", Arial, Helvetica, sans-serif;color: #ffffff;background: #49494B;text-align: center;}'+ '.td_compra_plan{width: 300px;padding: 4px 2px 4px 2px;margin: 0px;border-collapse: collapse;font: normal 12px "Arial Narrow", Arial, Helvetica, sans-serif;color: #ffffff;background: #666668;text-align: center;}'+ '.td_compra_cantidad{padding: 4px 2px 4px 2px;margin: 0px;border-collapse: collapse;font: normal 12px "Arial Narrow", Arial, Helvetica, sans-serif;color: #ffffff;background: #49494B;text-align: center;}'+ '.td_compra_monto{padding: 4px 2px 4px 2px;margin: 0px;border-collapse: collapse;font: normal 12px "Arial Narrow", Arial, Helvetica, sans-serif;color: #ffffff;background: #666668;text-align: center;}'+ '.td_compra_generico3{font: normal 11px Arial, Helvetica, sans-serif;color: #ffffff;margin: 0px;padding: 3px 0px 3px 0px;text-align: center;background: #550D0D;}'+ '.td_compra_generico4{padding: 4px 2px;margin: 0px;border-collapse: collapse;font: normal 10px "Arial Narrow", Arial, Helvetica, sans-serif;color: #5F6062;background: #D9DADB;text-align: right;}'+ '.tr_compra_borde td{border-bottom: solid 1px #743F3F;}' + '.td_datos_pago_titulo{width: 150px !important;padding: 0px 0px 3px 0px !important;font: bold 11px Arial, Helvetica, sans-serif !important;color: #595A5B !important;}'; var html = ""; html = ""; html = html + "
"; html = html + ""; html = html + ""; html = html + "" + ficha.innerHTML + ""; html = html + ""; ventimp.document.write(html); ventimp.document.close(); ventimp.print(); ventimp.close(); return false; } function MostrarFecha(txt,anchor) { cal = new CalendarPopup(); cal.select(document.getElementById(txt),anchor,'dd/MM/yyyy'); } function MostrarFechaDiv(txt,anchor,div) { cal = new CalendarPopup(div); cal.select(document.getElementById(txt),anchor,'dd/MM/yyyy'); } function setHiddenInput(form, name, value){ var newInput = document.createElement('input'); newInput.setAttribute('type','hidden'); newInput.setAttribute('name',name); newInput.setAttribute('value',value); form.appendChild(newInput); } function valor(form){ var nombre= form + ":txtClave"; return document.getElementById(nombre).value; } function CrearLogin(form,num) { var x=num.value; var nombre= form + ":txtClave"; if(document.getElementById(nombre).value.length<6) document.getElementById(nombre).value+=x; } function LimpiarClave(form){ var nombre= form + ":txtClave"; document.getElementById(nombre).value=""; } function LimpiarClaveVenta(form){ var nombre= form + ":txtClave"; document.getElementById(nombre).value=""; return false; } function CrearIFrame() { //var html = ''; //var html = '' var ifrBusqueda = document.createElement("iframe"); ifrBusqueda.src=PTPortlet.getPortletByID(portletID).transformURL('../Busqueda/BUS01.jspx');//"http://172.22.111.231:7001/portal/server.pt/gateway/PTARGS_0_2_311_0_0_43/http%3B/172.22.111.213%3B7101/SelfCare-ViewController-context-root/faces/Busqueda/BUS01.jspx"; //ifrBusqueda.src="../Busqueda/BUS01.jspx"; ifrBusqueda.hspace="0"; ifrBusqueda.marginwidth="0"; ifrBusqueda.marginheight="0"; ifrBusqueda.frameborder="0"; ifrBusqueda.scrolling="yes"; ifrBusqueda.style.height="400px"; ifrBusqueda.style.width="600px" ; ifrBusqueda.style.background.color="white"; ifrBusqueda.id="ifrBusqueda"; document.getElementById("divBusqueda").appendChild(ifrBusqueda); } function MostrarBusqueda(form) { var ifrBusqueda=window.parent.document.getElementById("ifrBusqueda"); if(ifrBusqueda==null) CrearIFrame(); document.getElementById("divPantalla").style.visibility="visible"; // document.getElementById("divPantalla").style.display="inline"; document.getElementById("divPantalla").style.height=document.getElementById(form).offsetHeight; //document.getElementById("divPantalla").style.filter="alpha(opacity=20)"; document.getElementById("divBusqueda").style.visibility="visible"; //setHiddenInput(window.parent.document.frmROA010102,window.parent.document.frmROA010102.name,'hlkAgregar') return false; } function OcultarBusqueda(btnRefrescar) { window.parent.document.getElementById("divBusqueda").style.visibility="hidden"; window.parent.document.getElementById("divPantalla").style.visibility="hidden"; // window.parent.document.getElementById("divPantalla").style.display="none"; var ifrBusqueda=window.parent.document.getElementById("ifrBusqueda"); //window.parent.Refrescar(); window.parent.document.getElementById(btnRefrescar).click(); if(ifrBusqueda!=null) window.parent.document.getElementById("divBusqueda").removeChild(ifrBusqueda); return false; } function ValidarCheckCobertura(chk,form, name, value) { if(document.getElementById(chk).checked==false) { alert("Debe seleccionar el check He Verificado la Cobertura"); return false; } setHiddenInput(form,name,value); //return(true); } function crearScript(portletID,js){ var s = document.createElement("script"); s.type = "text/javascript"; s.src = PTPortlet.getPortletByID(portletID).transformURL(js); document.getElementsByTagName("head")[0].appendChild(s); } //Validar Fechas function EsFecha(Cadena) { var Fecha = new String(Cadena); var RealFecha = new Date(); var Ano = new String(Fecha.substring(Fecha.lastIndexOf("/")+1,Fecha.length)); var Mes = new String(Fecha.substring(Fecha.indexOf("/")+1,Fecha.lastIndexOf("/"))); var Dia = new String(Fecha.substring(0,Fecha.indexOf("/"))); if (isNaN(Ano) || Ano.length<4 || parseFloat(Ano)<1900) { return false; } if (isNaN(Mes) || parseFloat(Mes)<1 || parseFloat(Mes)>12) { return false; } if (isNaN(Dia) || parseInt(Dia, 10)<1 || parseInt(Dia, 10)>31) { return false; } if (Mes==4 || Mes==6 || Mes==9 || Mes==11 || Mes==2) { if (Mes==2 && Dia > 28 || Dia>30) { return false; } } return true; } function CompararFechas(Fecha1, Fecha2) { var bRes = false; var sDia1 = Fecha1.substr(0, 2); var sMes1 = Fecha1.substr(3, 2); var sAno1 = Fecha1.substr(6, 4); var sDia2 = Fecha2.substr(0, 2); var sMes2 = Fecha2.substr(3, 2); var sAno2 = Fecha2.substr(6, 4); if (sAno1 > sAno2) bRes = true; else { if (sAno1 == sAno2) { if (sMes1 > sMes2) bRes = true; else { if (sMes1 == sMes2) if (sDia1 >= sDia2) { bRes = true; } } } } return bRes; } function FechaActual() { var Fecha = new Date(); var Ano = Fecha.getYear(); if (Ano < 1000) Ano+=1900; var Dia = Fecha.getDay(); var Mes = Fecha.getMonth() + 1; if (Mes<10) Mes = "0" + Mes; var Dia = Fecha.getDate(); if (Dia<10) Dia = "0" + Dia; return(Dia + "/" + Mes + "/" + Ano); } function ValidarFecha(Texto,Mensaje) { if(Texto.value=='') { alert('Ingresa ' + Mensaje); Texto.focus(); return false; } if(!EsFecha(Texto.value)) { alert(Mensaje + ' Invalida'); Texto.focus(); return false; } if(!CompararFechas(Texto.value,FechaActual())) { alert(Mensaje + ' debe ser mayor o igual a Hoy'); Texto.focus(); return false; } return true; } //Validar Paginas function ValidarSeleccion(chk,form, name, value) { var filas=document.getElementById(form.name + ':dtTelefonos').rows.length; if(filas==1) { alert('Debe selecionar al menos un equipo'); return(false); } if(ValidarFecha(document.getElementById(form.name+':txtFechaA'),'Fecha de Activacion')==false) return(false); if(ValidarFecha(document.getElementById(form.name+':txtFechaD'),'Fecha de Desactivacion')==false) return(false); if(document.getElementById(chk).checked==false) { alert("Debe seleccionar el check He Verificado la Cobertura"); document.getElementById(chk).focus(); return false; } setHiddenInput(form,name,value); return true; } function ValidarSeleccionCDI(chk,form, name, value,mensaje) { var filas=document.getElementById(form.name + ":dtTelefonos").rows.length; if(filas==1) { alert('Debe selecionar al menos un equipo'); return(false); } if(ValidarFecha(document.getElementById(form.name +":txtFecha"),mensaje)==false) return(false); if(document.getElementById(chk).checked==false) { alert("Debe seleccionar el check He Verificado la Cobertura"); document.getElementById(chk).focus(); return false; } setHiddenInput(form,name,value); return true; } function ValidarClave(form, name, value){ var clave = document.getElementById(form.name + ":txtClave").value if(clave==''){ alert('Debe ingresar nuevamente su clave'); return false; } setHiddenInput(form,name,value); return true; } function ValidarConfirmacion(form, name, value) { var aceptar=clave=document.getElementById("rbnAcepto"); var clave=document.getElementById(form.name + ":txtClave"); if(aceptar.checked==false) { alert("Debe Aceptar las Condiciones para continuar"); return false; } if(clave.value=="") { alert("Debe ingresar nuevamente la clave"); return false; } /* if(clave.value=="") { alert("La clave debe ser de 6 digitos"); return false; }*/ setHiddenInput(form,name,value); return true; } function ValidarSeleccionRoaming(chk,form, name, value) { var tabla=document.getElementById(form.name + ':dtTelefonos'); var filas=tabla.rows.length; var cols=(tabla.cells.length/filas); if(filas==1) { alert('Debe existir al menos un equipo para Activar'); return(false); } else{ var numsel=0; var n=""; if(cols==2){ for(i=1; i