var b = new Array();
var P = new Array();
var K = new Array();
var n = 0;
var a,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15;
var A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15;
var z=0;
var p=0;
var k=0;

//Bild 1
 
function bild1 (p,k){
   
  var win,win_1,win_2,win_3,Eingabe;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  b[n] = 1;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche card.
   n=2;
   }

      
  if( a1==1){ //wenn die 2 Card schon aus dem Spiel sind!!
  A1=1;
   n=n-1;
  }
  else{
   
      win_1=window.open("","Ziehen","width=150,height=120,left=770,top=190");
      win_1.document.write("<h1>Card " + n + "</h1>");
      win_1.document.bgColor="#DD11AF";
      win_1.document.fgColor="#FFFF00";
      win_1.setTimeout('window.close()',500);
      }
       
  if(b[n] == b[n-1] && A1 != 1){
  a1 = 1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',500);
  } 
  if (n > 1 ){
  n = 0;
  }
  if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no")
  win_3.setTimeout('window.close()',2000);
  }	   
 }

//Bild 2

function bild2 (p,k){
  pos1=0;
  pos2=11;
  var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  b[n] = 2;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  if( a2==1){
  A2=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";
   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A2 !=1){
  a2=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
  n = 0;
   }
  if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);
  }
 }

//Bild 3

function bild3 (p,k){
  var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  b[n] = 3;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  if( a3==1){
  A3=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";
   win_1.setTimeout('window.close()',500);
   }

 if(b[n] == b[n-1] && A3 !=1){
  a3=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
  if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);
  }
 }

//Bild 4

 function bild4 (p,k){
  var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  b[n] = 4;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  if( a4==1){
  A4=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";
   win_1.setTimeout('window.close()',500);
   }

 if(b[n] == b[n-1] && A4 != 1){ 
  a4=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
  if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}

//Bild 5

 function bild5 (p,k){
  var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 5;
  if( a5==1){
  A5=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A5 != 1){
  a5=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);
  }
}

//Bild 6

 function bild6 (p,k){
  var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 6;
  if( a6==1){
  A6=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A6!=1){
  a6=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);
  }
}

//Bild7

function bild7 (p,k){
  var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 7;
  if( a7==1){
  A7=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";
   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A7!=1){
  a7=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}


//Bild 8

function bild8 (p,k){
 var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 8;
  if( a8==1){
  A8=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A8!=1){
  a8=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}

//Bild 9

function bild9 (p,k){
 var win,win_1,win_2;
 n = n + 1;
 P[n] = p;
 K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 9;
  if( a9==1){
  A9=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A9!=1){
  a9=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}

//Bild 10

function bild10 (p,k){
 var win,win_1,win_2;
 n = n + 1;
 P[n] = p;
 K[n] = k;
 if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

b[n] = 10;
  if( a10==1){
  A10=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A10!=1){
  a10=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}


//Bild 11

function bild11 (p,k){
 var win,win_1,win_2;
 n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 11;
  if( a11==1){
  A11=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A11!=1){
  a11=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}
 

//Bild 12

function bild12 (p,k){
 var win,win_1,win_2;
  n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 11;
  if( a12==1){
  A12=1;
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A12!=1){
  a12=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}

//Bild 13

function bild13 (p,k){
 var win,win_1,win_2;
 n = n + 1;
 P[n] = p;
 K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 13;
  if( a13==1){
  A13=1;
  
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A13!=1){
  a13=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}

//Bild 14

function bild14 (p,k){
 var win,win_1,win_2;
 n = n + 1;
 P[n] = p;
 K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }

  b[n] = 14;
  if( a14==1){
  A14=1;
  win.setTimeout('window.close()',500);
  n=n-1;
  }
  else{
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A14!=1){
  a14=1;
  z=z+1;
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

   }
}

//Bild 15

function bild15 (p,k){
 var win,win_1,win_2;
 n = n + 1;
  P[n] = p;
  K[n] = k;
  if(P[n] == P[n-1] && K[n]== K[n-1]){ //2x die gleiche Card.
   n=n-1;
   }
  if(P[n] == P[n-1] && K[n]!= K[n-1]){ //2x die gleiche Card.
   n=2;
   }
  b[n] = 15;

  if( a15==1){
  A15=1;
  //win=window.open( "bg_1.gif" ,"bild15", "width=300,height=250,left=770,top=470,resizable=no");
  win.setTimeout('window.close()',500);
  n=n-1;
  }
  else{
   //win=window.open("pic15.gif" ,"bild15", "width=300,height=250,left=770,top=470,resizable=no");
   //win.setTimeout('window.close()',500);
   win_1=window.open("","Ziehen","width=150,height=200,left=770,top=190");
   win_1.document.write("<h1> Card " + n + "</h1>");
   win_1.document.bgColor="#DD11AF";
   win_1.document.fgColor="#FFFF00";

   win_1.setTimeout('window.close()',500);
   }
 if(b[n] == b[n-1] && A15!=1){
  a15=1;
  z=z+1;
  //win_2=window.open("","Vergleichen","width=250,height=50,left=770,top=330,resizable=no");
  win_1.document.write("<h1>Bingo!!</h1>");
  win_1.setTimeout('window.close()',900);
  }
 if (n > 1 ){
   n = 0;
   }
 if(z == 15){
  win_3=window.open("ende.html","Ende", "width=400,height=300,resizable=no");
  win_3.setTimeout('window.close()',2000);

  }
}



















 



 