<html> 
<head>
<title>Version 0.3 mapa</title>
<script type="text/javascript"> 

<!-- 
var casilla = new Array(); casilla[0] = '1.png'; casilla[1] = '2.png'; casilla[2] = '3.png'; casilla[3] = '4.png'; casilla[4] = '5.png'; casilla[5] = '6.png'; 
casilla[6] = '7.png'; casilla[7] = '8.png'; casilla[8] = '9.png'; casilla[9] = '10.png'; casilla[10] = '11.png';casilla[11] = '12.png'; casilla[12] = '13.png'; casilla[13] = '14.png'; casilla[14] = '15.png'; casilla[15] = '16.png'; casilla[16] = '17.png'; casilla[17] = '18.png';casilla[18] = '19.png';casilla[19] = '20.png'; 
casilla[20] = '21.png'; casilla[21] = '22.png'; casilla[22] = '23.png'; casilla[23] = '24.png';casilla[24] = '25.png'; casilla[25] = '26.png';casilla[26] = '27.png'; 
casilla[27] = '28.png'; casilla[28] = '29.png';casilla[29] = '30.png'; casilla[30] = '31.png'; casilla[31] = '32.png'; casilla[32] = '33.png'; casilla[33] = '34.png'; 
casilla[34] = '35.png'; casilla[35] = '36.png'; casilla[36] = '37.png'; casilla[37] = '38.png'; casilla[38] = '39.png'; casilla[39] = '40.png'; casilla[40] = '41.png'; 

function damevariable()
{
 var x=Math.floor(Math.random()*3);
 if (x>=2)
 {
 var ale = Math.floor(Math.random()*23);
 }
 else
 {
  if(x==1){var ale=9;} 
  else{var ale = Math.floor(Math.random()*casilla.length);}
 }
return ale;
}

function menu()
{
document.write('<form><select id="al" name="alt"><option value="12">12</option><option value="2">2</option><option value="4">4</option><option value="6">6</option><option value="8">8</option><option value="10">10</option><option value="12">12</option><option value="14">14</option><option value="16">16</option><option value="18">18</option></select><select id="an" name="anc"><option value="12">12</option><option value="2">2</option><option value="4">4</option><option value="6">6</option><option value="8">8</option><option value="10">10</option><option value="12">12</option><option value="14">14</option></select><input type="button" value="Generar" onClick="aleatorio();"/></form>');
}

function aleatorio() 
{
     var lista = document.getElementById("al");
     var Altura2 = lista.options[lista.selectedIndex].value; 
     var lista2 = document.getElementById("an");
     var Anchura2 = lista2.options[lista2.selectedIndex].value;

     var Posicion1=40;
     var Posicion2=2;
     var Posicion3=40;
     var Posicion4=67
     var contador=1;

     for (var a=1;a<=Altura2;a++)
      { 
        for (var a2=1;a2<=Anchura2;a2++)
        {
        var ale = damevariable();
        document.write('<div class="cuadra" style="position: absolute;left:' + Posicion2 + 'px;top:' + Posicion1 + 'px; margin: 0 auto;height:50px;width:50px;">  <img src="'+casilla[ale]+'"></div>');

        Posicion2=Posicion2+75;
        contador=contador+1;
        }

        Posicion1 = Posicion1+50;
        Posicion2=2;

       for (var a2=1;a2<=Anchura2;a2++)
        { 
        var ale2 = damevariable();
        document.write('<div class="cuadra" style="position: absolute;left:' + Posicion3 + 'px;top:' + Posicion4 + 'px; margin: 0 auto;height:50px;width:50px;">  <img src="'+casilla[ale2]+'"></div>');

        Posicion3=Posicion3+75;
        contador=contador+1;
        }
        
        Posicion4 = Posicion4+50;
        Posicion3=40;
       
      }
      document.write("<a href=index.php>Volver</a>");
     
      
}
	</script>
</head>
<body>
<script>menu();</script>

</body>
</html>

