﻿
﻿/*Clara, 06/05/2011, No he podido ofuscar este JS, así que simplemente está comprimido */
var eubol=new Array(50);var estrellabol=new Array(12);var numnumeros=0;var numestrellas=0;var tipojuego=0;var numjugadas=-1;var columnas=new Array();var activo=1;var boleto=1;var minNums=6;var numEstr=2;var maxEstr=2
var precio_ap=0;var cols_bol_sencillo=5;var maxBoletos=99;var apminimo=0;var apmaximo=0;function ini_bol()
{numnumeros=0;numestrellas=0;numjugadas=0;for(j=0;j<51;j++)
{if(eubol[j])
{eubol[j]=false;pinta_simb(j);}}
for(j=0;j<12;j++)
{if(estrellabol[j])
{estrellabol[j]=false;pinta_simb_es(j);}}
establecer_Minimo();pintar_activo();pintaTextos();pintar_tabla_boleto();pintar_texto_bloque();pintaTablaBotones();};function pintar_tabla_boleto()
{tabla=document.getElementById("tbboleto");switch(tipojuego)
{case 0:tabla.style.visibility="visible";break;case 1:tabla.style.visibility="hidden";break;}};function pintar_texto_bloque()
{bact=document.getElementById("textobloque");switch(tipojuego)
{case 0:bact.innerHTML="Bloque ";break;case 1:bact.innerHTML="Boleto ";break;}};function pintar_activo()
{bact=document.getElementById("bactivo");bact.innerHTML=boleto;bact=document.getElementById("bloqueactivo");switch(tipojuego)
{case 1:bact.innerHTML=activo;break;case 0:res=activo%cols_bol_sencillo;if(res==0)
{res=cols_bol_sencillo;}
bact.innerHTML=res;break;}};function reiniciar_todo()
{columnas=new Array();activo=1;boleto=1;ini_bol();pintar_totales_boletos();reiniciar_boleto();};function TipoJuego(tipo)
{if(tipo!=tipojuego)
{if(numnumeros>0||numestrellas>0||columnas.length>0)
{if(confirm("Si cambias de tipo de boleto perderás la jugada actual.\n¿Quieres continuar?"))
{reiniciar_todo();tipojuego=tipo;}
else
{switch(tipojuego)
{case 1:actchek=document.getElementById("ckmultiple");break;case 0:default:actchek=document.getElementById("cksencillo");break;}
actchek.checked=true;}}
else
{tipojuego=tipo;}}
establecer_Minimo();pintar_coste_boleto();pintar_tabla_boleto();pintaTextos();pintaTablaBotones();pintar_texto_bloque();};function establecer_Minimo()
{switch(tipojuego)
{case 1:minNums=5;maxEstr=5;break;case 0:minNums=5;maxEstr=2;break;}};function pintar_coste_boleto()
{apuestas=document.getElementById("totApuestasBoleto");precio=document.getElementById("CosteBoleto");switch(tipojuego)
{case 1:case 0:apuestas.style.visibility="visible";precio.style.visibility="visible";break;}};function pintaTablaBotones()
{img_src="../Recursos/Aspectos/boletos/euromillones/";btn1=document.getElementById("btn1Aleatorios");btn2=document.getElementById("btn2Aleatorios");btn3=document.getElementById("btn3Aleatorios");btn4=document.getElementById("btn4Aleatorios");btn5=document.getElementById("btn5Aleatorios");switch(tipojuego)
{case 1:btn1.src=img_src+"6numeros.gif";btn2.src=img_src+"7numeros.gif";btn3.src=img_src+"8numeros.gif";btn4.src=img_src+"9numeros.gif";btn5.src=img_src+"10numeros.gif";break;case 0:btn1.src=img_src+"1bloque.gif";btn2.src=img_src+"2bloques.gif";btn3.src=img_src+"3bloques.gif";btn4.src=img_src+"4bloques.gif";btn5.src=img_src+"5bloques.gif";break;}};function pintaTextos()
{actcab=document.getElementById("txtCabeceraTipo");actTipoAp=document.getElementById("txtTipoAp");actTipoAl=document.getElementById("txtAleatorios");switch(tipojuego)
{case 1:actcab.innerHTML="Marca 5, 6, 7, 8, 9 ó 10 números y hasta 5 estrellas en cada boleto.";actTipoAp.innerHTML=" APUESTAS MÚLTIPLES";actTipoAl.innerHTML=" Elige la cantidad de números<br/>(+hasta 5 estrellas) que quieres jugar";break;case 0:default:actcab.innerHTML="Marca 5 números y 2 estrellas por bloque. Cada 5 bloques se completa un boleto.";actTipoAp.innerHTML=" APUESTAS SENCILLAS";actTipoAl.innerHTML=" Elige el número de bloques automáticos que quieres añadir al Boleto";break;}};function pinta_simb(pos)
{acttex=document.getElementById("numero"+pos);img_src="../Recursos/Aspectos/Bolas/";spos=pos;if(pos<10)
spos="0"+pos;if(eubol[pos])
{acttex.src=img_src+"amarillas/"+spos+"s.gif";}
else
{acttex.src=img_src+"rojas/"+spos+".gif";}};function pinta_simb_es(pos)
{acttex=document.getElementById("estrella"+pos);img_src="../Recursos/Aspectos/Bolas/amarillas/estrellas/";spos=pos;if(pos<10)
spos="0"+pos;if(estrellabol[pos])
{acttex.src=img_src+spos+"s.gif";}
else
{acttex.src=img_src+spos+".gif";}};function cs(pos)
{if(numjugadas==-1)
ini_bol();if(eubol[pos])numnumeros--;else numnumeros++;if((tipojuego==0)&&(numnumeros>5))
{alert('Solo se pueden marcar 5 numeros');numnumeros=5;return;}
if((tipojuego==1)&&(numnumeros>10))
{alert('Solo se pueden marcar 10 numeros');numnumeros=10;return;}
eubol[pos]=!eubol[pos];pinta_simb(pos);pinta_boleto_apuestas();};function es(pos)
{if(numjugadas==-1)
{ini_bol();}
if(estrellabol[pos])
{numestrellas--;}
else
{numestrellas++;}
if(numestrellas>maxEstr)
{alert('Solo se pueden marcar '+maxEstr+' estrellas');numestrellas=maxEstr;return;}
estrellabol[pos]=!estrellabol[pos];pinta_simb_es(pos);pinta_boleto_apuestas();};function pinta_boleto_apuestas()
{if(comprobar_numeros_estrellas())
{switch(tipojuego)
{case 1:pintar_boleto_multiple();break;case 0:default:pintar_bloque_sencillo();break;}}
else
{if(tipojuego==1)
{reiniciar_boleto();}}};function pintar_apuestas_precio_boleto(num_jugadas)
{if(num_jugadas<0)
num_jugadas=0;jugadas=document.getElementById("totApuestasBoleto");jugadas.innerHTML="APUESTAS "+num_jugadas;precio=document.getElementById("CosteBoleto");precio.innerHTML=" COSTE "+(num_jugadas*precio_ap)+"  €";};function calcular_apuestas_directo(numnu,numes)
{combNums=combEs=0;if(numnu>=5&&numes>=2)
{combNums=calcular_combinaciones_directo_mums(numnu,5);combEs=calcular_combinaciones_directo_mums(numes,2);return combNums*combEs;}
else
{return 0;}};function formato_millares(mvalor)
{valor=mvalor.toString();ipto=valor.indexOf(".");if(ipto>0)
{svalor=valor.substring(0,ipto);valor=valor.substring(0,ipto)+","+valor.substring(ipto+1,valor.length);}
else svalor=valor;if(svalor.length>3)
{cont=parseInt(svalor.length/3);resto=svalor.length%3;res="";if(resto>0)
{res=svalor.substring(0,resto)+".";}
for(i=1;i<=cont;i++)
{res+=svalor.substring(resto+((i-1)*3),resto+(i*3))+".";}
if(res.charAt(res.length-1)==".")
res=res.substring(0,res.length-1);if(ipto>0)
{res+=valor.substring(ipto,valor.length);}
return res;}
else return valor;};function calcular_combinaciones_directo_mums(Nums,sNums)
{return miFactorial(Nums,sNums)/factorial(sNums);};function miFactorial(iNum,sNums)
{loRes=iNum;for(i=1;i<sNums;i++)
{loRes=loRes*(iNum-i);}
return loRes;};function factorial(iNum)
{loResult=1;for(var iCont=1;iCont<=iNum;iCont++)
loResult=loResult*iCont;return loResult;};function pintar_boleto_multiple()
{numjugadas=calcula_jugadas_boleto(numnumeros,numestrellas);pintar_apuestas_precio_boleto(numjugadas);pintar_bloque(1);};function calcula_jugadas_bol_activo()
{mboleto=parseInt((activo-1)/cols_bol_sencillo)+1;ini=(mboleto-1)*cols_bol_sencillo;fin=ini+5;if(fin>columnas.length)
{fin=columnas.length;}
return(fin-ini);};function pintar_boleto_sencillo()
{num_jugadas=calcula_jugadas_bol_activo();pintar_apuestas_precio_boleto(num_jugadas);boleto_ant=boleto;boleto=parseInt((activo-1)/cols_bol_sencillo)+1;if(boleto!=boleto_ant)
{reiniciar_boleto_sencillo();ini=0;fin=boleto*cols_bol_sencillo;if((boleto-1)*cols_bol_sencillo<columnas.length)
{ini=(boleto-1)*cols_bol_sencillo;}
if(fin>columnas.length)
{fin=columnas.length;}
if(ini==((boleto-1)*cols_bol_sencillo))
{cont=1;for(i=ini;i<fin;i++)
{num=document.getElementById("columna"+cont);num.innerHTML=cont;num=document.getElementById("mas"+cont);num.innerHTML="+";valor=columnas[i];c=0;for(r=1;r<=minNums;r++)
{num=document.getElementById("Num"+cont+"_"+r);num.innerHTML=valor[c];c++;}
c=10;for(e=1;e<=numEstr;e++)
{num=document.getElementById("est"+cont+"_"+e);num.innerHTML=valor[c];c++;}
cont++;}}}
pintar_activo();};function reiniciar_boleto()
{pintar_apuestas_precio_boleto("0");switch(tipojuego)
{case 1:reiniciar_boleto_multiple();break;case 0:reiniciar_boleto_sencillo();break;}};function reiniciar_boleto_multiple()
{reiniciar_bloque(1);};function reiniciar_boleto_sencillo()
{for(i=1;i<=cols_bol_sencillo;i++)
{reiniciar_bloque(i);}};function reiniciar_bloque(i)
{num=document.getElementById("columna"+i);num.innerHTML=" ";num=document.getElementById("mas"+i);num.innerHTML=" ";totnums=10;switch(tipojuego)
{case 0:totnums=5;break;case 1:totnums=10;break;}
for(r=1;r<=totnums;r++)
{num=document.getElementById("Num"+i+"_"+r);num.innerHTML=" ";}
for(e=1;e<=maxEstr;e++)
{num=document.getElementById("est"+i+"_"+e);num.innerHTML=" ";}};function pintar_bloque(i)
{if(comprobar_numeros_estrellas())
{num=document.getElementById("columna"+i);num.innerHTML=""+i;num=document.getElementById("mas"+i);num.innerHTML="+";cont=1;for(j=0;j<51;j++)
{if(eubol[j])
{num=document.getElementById("Num"+i+"_"+cont);num.innerHTML=""+j;cont++;}}
for(k=cont;k<=10;k++)
{num=document.getElementById("Num"+i+"_"+k);num.innerHTML="";}
cont=1;for(e=0;e<12;e++)
{if(estrellabol[e])
{num=document.getElementById("est"+i+"_"+cont);num.innerHTML=""+e;cont++;}
if(cont==maxEstr+1)
{e=12;}}
for(k=cont;k<=5;k++)
{num=document.getElementById("est"+i+"_"+k);num.innerHTML="";}}};function pintar_bloque_sencillo()
{pp=activo%cols_bol_sencillo;if(pp==0)
{pp=cols_bol_sencillo;}
pintar_bloque(pp);if(numnumeros>=minNums&&numestrellas==numEstr)
{num_jugadas=calcula_jugadas_bol_activo();if(pp>num_jugadas)
{num_jugadas++;}
pintar_apuestas_precio_boleto(num_jugadas);}};function reiniciar_bloque_sencillo()
{pp=activo%cols_bol_sencillo;if(pp==0)
{pp=cols_bol_sencillo;}
num_jugadas=calcula_jugadas_bol_activo()-1;pintar_apuestas_precio_boleto(num_jugadas);reiniciar_bloque(pp);};function calcula_jugadas_boleto(numeros,estre)
{switch(tipojuego)
{case 0:switch(numeros)
{case 5:return 1;default:return 0;}
case 1:return calcular_apuestas_directo(numeros,estre);default:return 0;}};function obtener_total_apuestas()
{switch(tipojuego)
{case 1:tot_cols=0;for(c=0;c<columnas.length;c++)
{num_nums=0;num_estr=0;valor=columnas[c];array_numeros=valor.slice(0,10);if(valor.length==12)
{numE=2;array_estrellas=valor.slice(10,12);}
else
{numE=5;array_estrellas=valor.slice(10,15);}
for(n=0;n<10;n++)
{if(array_numeros[n]!=-1)
{num_nums++;}}
for(e=0;e<array_estrellas.length;e++)
{if(array_estrellas[e]!=-1)
{num_estr++;}}
tot_cols+=calcula_jugadas_boleto(num_nums,num_estr);}
return tot_cols;case 0:return columnas.length;}};function jugar()
{if(guardar_activo2())
{ctot=obtener_total_apuestas();if(ctot>0)
{if(ctot>=apminimo&&ctot<=apmaximo)
{ddls=document.getElementById("ctl00_ContentPlaceHolderCentral_CBoletoDirectoEuromillones1_CSelectorSorteosMixto1_ddlSorteos");if(ddls==null)
{ddls=document.getElementById("ctl00_ContentPlaceHolder2_CBoletoDirectoEuromillones1_CSelectorSorteosMixto1_ddlSorteos");}
if(ddls==null)
{alert("Problemas con contenedor de la Master. Imposible continuar");return;}
rr=ddls.value.indexOf("-");temporada=parseInt(ddls.value.substring(rr-4,rr));jornada=ddls.options[ddls.value.substring(0,rr-4)].innerHTML;fecha=ddls.value.substring(rr+1,ddls.value.length);dia=parseInt(parseFloat(fecha.substring(0,fecha.indexOf("/"))));mes=parseInt(parseFloat(fecha.substring(fecha.indexOf("/")+1,fecha.lastIndexOf("/"))));anio=parseInt(fecha.substring(fecha.length-4,fecha.length));PageMethods.ObtenerValores(tipojuego,columnas,temporada,jornada,anio,mes,dia,obtenerdias(),OnSucceeded,OnFailed);}
else
{alert("Debes jugar un mínimo de "+apminimo+" y máximo de "+apmaximo+" apuestas");}}
else
{alert("No has añadido ningún bloque");}}};function obtenerdias()
{semana=new Array("ChkL","ChkM","ChkX","ChkJ","ChkV","ChkS","ChkD");dias=0;for(j=0;j<=6;j++)
{check=document.getElementById("ctl00_ContentPlaceHolderCentral_CBoletoDirectoEuromillones1_CSelectorSorteosMixto1_"+semana[j]);if(check==null)
{check=document.getElementById("ctl00_ContentPlaceHolder2_CBoletoDirectoEuromillones1_CSelectorSorteosMixto1_"+semana[j]);}
if(check!=null)
{if(check.checked)
{dias=dias+parseInt(Math.pow(2,j));}}}
return dias;};function OnSucceeded(result,userContext,methodName)
{window.location='../boletos/respuestaBoletos.aspx?p='+iRespuesta;};function OnFailed(error,userContext,methodName)
{alert("Error controlado en servidor, imposible continuar");};function siguiente()
{if(comprobar_numeros_estrellas())
{valor=obtener_columna_numeros();if(activo<=columnas.length)
{modificar_columna(activo-1,valor);}
else
{anyadir_columna(valor);}
podemos=podemos_siguiente();if(podemos)
{activo++;}
cargar_bol(activo);}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return;}}};function anterior(cuantos)
{valor=obtener_columna_numeros();if(activo<=columnas.length)
{if(comprobar_numeros_estrellas())
{modificar_columna(activo-1,valor);}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return;}}}
else
{if(numnumeros!=0||numestrellas!=0)
{if(comprobar_numeros_estrellas())
{anyadir_columna(valor);}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return;}}}}
if(activo>cuantos)
{switch(tipojuego)
{case 0:if(cuantos>1)
{activo-=cuantos;if((activo)%5!=1)
{activo=(boleto-2)*5+1;}}
else
{res=(activo-1)%cols_bol_sencillo;if(res!=0)
activo-=cuantos;}
break;case 1:activo-=cuantos;break;}}
cargar_bol(activo);};function boleto_anterior()
{anterior(cols_bol_sencillo);};function podemos_siguiente()
{podemos=true;mivalor=0;switch(tipojuego)
{case 0:mivalor=parseInt((activo)/cols_bol_sencillo)+1;if(mivalor!=boleto)
{alert("No puedes jugar más de "+cols_bol_sencillo+" bloques por boleto.\nPara jugar más bloques pasa al siguiente boleto.");podemos=false;}
break;case 1:mivalor=activo+1;break;}
if(mivalor>maxBoletos)
{podemos=false;alert("No puedes jugar más de "+maxBoletos+" boletos");}
return podemos;};function podemos_boleto()
{num_jugadas=calcula_jugadas_bol_activo();if(num_jugadas==cols_bol_sencillo)
{return true;}
else
{alert("Para pasar a otro boleto debes rellenar los "+cols_bol_sencillo+" bloques que completan un boleto oficial");return false;}};function boleto_siguiente()
{if(numnumeros>=minNums&&numestrellas==numEstr)
{valor=obtener_columna_numeros();if(activo<=columnas.length)
{modificar_columna(activo-1,valor);}
else
{anyadir_columna(valor);}
if(podemos_boleto())
{if(boleto==maxBoletos)
{alert("No puedes jugar más de "+maxBoletos+" boletos");}
else
{ini=boleto*cols_bol_sencillo;if(ini<=columnas.length)
{activo=ini+1;}}
cargar_bol(activo);}}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return;}}};function anyadir_columna(valor)
{columnas.push(valor);};function modificar_columna(indice,valor)
{columnas.splice(indice,1,valor);};function cargar_valores_eubol(valor)
{array_numeros=valor.slice(0,10);if(valor.length==12)
{numE=2;array_estrellas=valor.slice(10,12);}
else
{numE=5;array_estrellas=valor.slice(10,15);}
for(i=0;i<51;i++)
{eubol[i]=false;}
for(j=0;j<12;j++)
{estrellabol[j]=false;}
for(n=0;n<10;n++)
{if(array_numeros[n]!=-1)
{numnumeros++;eubol[array_numeros[n]]=true;}}
for(e=0;e<numE;e++)
{if(array_estrellas[e]!=-1)
{numestrellas++;estrellabol[array_estrellas[e]]=true;}}};function pintar_boleto()
{switch(tipojuego)
{case 0:pintar_boleto_sencillo();break;case 1:pintar_boleto_multiple();break;}};function cargar_bol(ibol)
{numnumeros=0;numestrellas=0;numjugadas=0;if(ibol<=columnas.length)
{valor=columnas[ibol-1];cargar_valores_eubol(valor);pintar_cuadricula();pintar_boleto();}
else
{ini_bol();switch(tipojuego)
{case 1:reiniciar_boleto();break;case 0:pintar_boleto();break;}}
pintar_totales_boletos();pintar_activo();};function pintar_cuadricula()
{for(n=1;n<51;n++)
{pinta_simb(n);}
for(e=1;e<12;e++)
{pinta_simb_es(e);}};function obtener_columna_numeros()
{numerillos=new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);estrellitas=new Array(-1,-1,-1,-1,-1);ncont=0;nestr=0;for(i=0;i<51;i++)
{if(eubol[i])
{numerillos[ncont]=i;ncont++;}}
for(j=0;j<12;j++)
{if(estrellabol[j])
{estrellitas[nestr]=j;nestr++;}}
return numerillos.concat(estrellitas);};function pintar_totales_boletos()
{num=document.getElementById("totBoletos");switch(tipojuego)
{case 1:num.innerHTML=columnas.length;break;case 0:if(columnas.length>0)
{num.innerHTML=parseInt((columnas.length-1)/cols_bol_sencillo)+1;}
else
{num.innerHTML="0";}
break;}
tot_cols=0;for(c=0;c<columnas.length;c++)
{num_nums=0;num_estr=0;valor=columnas[c];array_numeros=valor.slice(0,10);if(valor.length==12)
{numE=2;array_estrellas=valor.slice(10,12);}
else
{numE=5;array_estrellas=valor.slice(10,15);}
for(n=0;n<10;n++)
{if(array_numeros[n]!=-1)
{num_nums++;}}
for(e=0;e<array_estrellas.length;e++)
{if(array_estrellas[e]!=-1)
{num_estr++;}}
tot_cols+=calcula_jugadas_boleto(num_nums,num_estr);}
num=document.getElementById("SumaTotalApuestas");num.innerHTML=""+formato_millares(tot_cols.toString());precioTotal=document.getElementById("CosteTotal");precioTotal.innerHTML=" "+formato_millares((tot_cols*precio_ap).toString())+"  €";};function aleatorios(btn)
{switch(tipojuego)
{case 1:switch(btn)
{case 1:n=6;break;case 2:n=7;break;case 3:n=8;break;case 4:n=9;break;case 5:n=10;break;}
num_aleatorios(n);guardar_activo();break;case 0:bloques_aleatorios(btn);break;}};function bloques_aleatorios(cuantos)
{baleatorios=new Array();for(i=0;i<cuantos;i++)
{valor=obtener_bloque_aleatorio();baleatorios.push(valor);}
ini=boleto*cols_bol_sencillo-cuantos;for(j=0;j<cuantos;j++)
{columnas.splice(ini+j,1,baleatorios[j]);}
cargar_bol(activo);boleto=-1;pintar_boleto();};function obtener_bloque_aleatorio()
{superior=50;inferior=1;res=0;numerillos=new Array(-1,-1,-1,-1,-1);numerillos2=new Array(-1,-1,-1,-1,-1);estrellitas=new Array(-1,-1);for(n=0;n<5;n++)
{numPosibilidades=superior-inferior;aleat=Math.random()*numPosibilidades;res=Math.round(parseInt(inferior)+aleat);seguimos=true;for(j=0;j<5;j++)
{if(numerillos[j]==res)
{seguimos=false;n--;}}
if(seguimos)
{numerillos[n]=res;}}
superior=11;inferior=1;for(n=0;n<2;n++)
{numPosibilidades=superior-inferior;aleat=Math.random()*numPosibilidades;res=Math.round(parseInt(inferior)+aleat);estrellitas[n]=res;if(n==1&&(res==estrellitas[0]))
{n--;}}
return numerillos.sort(ordenacion).concat(numerillos2.concat(estrellitas.sort(ordenacion)));};function ordenacion(x,y)
{if(x<y)return-1;if(x>y)return 1;return 0;};function num_aleatorios(cuantos)
{superior=50;inferior=1;res=0;ini_bol();reiniciar_boleto_multiple();nestrellas=numEstr;for(n=0;n<cuantos;n++)
{numPosibilidades=superior-inferior;aleat=Math.random()*numPosibilidades;res=Math.round(parseInt(inferior)+aleat);if(eubol[res])
{n--;}
else
{cs(res);}}
superior=11;inferior=1;for(n=0;n<nestrellas;n++)
{numPosibilidades=superior-inferior;aleat=Math.random()*numPosibilidades;res=Math.round(parseInt(inferior)+aleat);if(estrellabol[res])
{n--;}
else
{es(res);}}};function reiniciar_activo()
{ini_bol();switch(tipojuego)
{case 1:reiniciar_boleto();break;case 0:reiniciar_bloque_sencillo();break;}};function eliminar_activo()
{columnas.splice(activo-1,1);cargar_bol(activo);switch(tipojuego)
{case 1:break;case 0:boleto=-1;pintar_boleto();break;}};function guardar_activo2()
{valor=obtener_columna_numeros();if(activo<=columnas.length)
{if(comprobar_numeros_estrellas())
{modificar_columna(activo-1,valor);}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return false;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return false;}}}
else
{if(numnumeros!=0||numestrellas!=0)
{if(comprobar_numeros_estrellas())
{anyadir_columna(valor);}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return false;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return false;}}}}
cargar_bol(activo);return true;};function guardar_activo()
{if(comprobar_numeros_estrellas())
{valor=obtener_columna_numeros();if(activo<=columnas.length)
{modificar_columna(activo-1,valor);}
else
{anyadir_columna(valor);}
cargar_bol(activo);}
else
{switch(tipojuego)
{case 0:alert("Debes seleccionar al menos "+minNums+" números y "+numEstr+" estrellas");return;case 1:alert("Debes seleccionar al menos "+minNums+" números y 3 estrellas");return;}}};function eliminar_boleto()
{boleto=parseInt((activo-1)/cols_bol_sencillo)+1;ini=(boleto-1)*cols_bol_sencillo;columnas.splice(ini,5);activo=ini+1;cargar_bol(activo);boleto=-1;pintar_boleto();};function inicializar(precio,min,max,iResp)
{iRespuesta=iResp;precio_ap=precio;apminimo=min;apmaximo=max;ini_bol();};function comprobar_numeros_estrellas()
{switch(tipojuego)
{case 1:{totSuma=numnumeros+numestrellas;if(totSuma>=8)
{return true;}
else
{return false;}}
case 0:default:if(numnumeros>=minNums&&numestrellas>=numEstr)
{return true;}
else
{return false;}}};
