<!-- Flooble.com peeptin start -->
		var max = 3;
		var scoreP = 0;
		var movesP = 0;
		var ex = 3;
		var ey = 3;
    var imgP = new Array();
    var imgPath = "/images/games/orderstamps/";
    
    for (var x = 0; x < 16; x++)
    {
    imgP[x] = new Image(); imgP[x].src = imgPath + 'peeptin_' + x + '.gif';
    }
		
		function shuffle15() 
    {
		  for (i = 0; i < 150; i++) 
      {
			  x = Math.floor(Math.random(4) * 4);
				     if (x == 0) { toggle15(ex, ey, ex + 1, ey); }
				else if (x == 1) { toggle15(ex, ey, ex - 1, ey); }
				else if (x == 2) { toggle15(ex, ey, ex, ey + 1); }
				else if (x == 3) { toggle15(ex, ey, ex, ey - 1); }
			}
		  scoreP = 0;
			movesP = 0;
    }

		function press15(x, y) 
    {
			if (Math.abs(ex - x) + Math.abs(ey - y) == 1) 
      {
				done = toggle15(x, y, x+1, y);
				if (!done) { done = toggle15(x, y, x-1, y); }
				if (!done) { done = toggle15(x, y, x, y+1); }
				if (!done) { done = toggle15(x, y, x, y-1);	}
				movesP++;
				if (check15()) {
					
          
        alert('You win after ' + movesP + ' moves!');
        var nPoints = Math.round(100 / movesP * 400);
        var strMsg = "Your score is " + nPoints + " points.\n Please enter your name for the scoreboard:";
        var strPlayerName = "";
        strName = prompt(strMsg, strPlayerName);
        if(strName != null && strName != "")
        {
         strPlayerName = strName.substr(0, 20);
         strURL = "/html/games/games_addscore.php" + "?b=orderstamps&n=" + escape(strPlayerName) + "&p=" + nPoints;
         window.open(strURL, "Highscore", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=440,height=600");
        }
          resetboard15();
				}
			}
		}

		function resetboard15(form) 
    {
			var cnt = 0;
      for (i = 1; i < 5; i++) 
      {
				for (j = 1; j < 5; j++) 
        {
          document.images[x + "p" + y].src = imgP[cnt].src;
          document.images[x + "p" + y].id = cnt;
          cnt++;
			  }
			scoreP = 0;
			movesP = 0;
			ex = 3;
			ey = 3;
		  }
    }
	
		function toggle15(x, y, x1, y1) {
			if (x < 0 || y < 0 || x > max || y > max) {return false;}
			if (x1 < 0 || y1 < 0 || x1 > max || y1 > max) {return false;}
			button = document.images[x + "p" + y];
			button1 = document.images[x1 + "p" + y1];
			if (button.id == 0 || button1.id == 0) 
      {
				var tmp1,tmp2; 
            tmp1  =  button.id; 
            tmp2 =  button.src;
				 button.id  = button1.id;
         button.src = button1.src;
				button1.id  =     tmp1;
        button1.src =     tmp2;
        
				if (button.id == 0) {ex = x; ey = y;} 
        else {ex = x1; ey = y1;}
				return true;
			}
			return false;
		}
		
		function check15() 
    {
      c1 = "" + document.images["0p0"].id + document.images["0p1"].id + document.images["0p2"].id + document.images["0p3"].id
              + document.images["1p0"].id + document.images["1p1"].id + document.images["1p2"].id + document.images["1p3"].id
              + document.images["2p0"].id + document.images["2p1"].id + document.images["2p2"].id + document.images["2p3"].id
              + document.images["3p0"].id + document.images["3p1"].id + document.images["3p2"].id + document.images["3p3"].id;
      if (c1 == "1591326101437111548120") {return true;} else {return false;}
		}
	
  document.write('<table style="border: thin dotted #999999;" border=0 cellspacing="0" cellpadding="1" >');
  document.write('<form><tr>');
  document.write('		  <td><img id="1"  src="' + imgP[1].src  + '" name="0p0" onclick="press15(0,0);" /></td>');
  document.write('		  <td><img id="2"  src="' + imgP[2].src  + '" name="1p0" onclick="press15(1,0);" /></td>');
  document.write('		  <td><img id="3"  src="' + imgP[3].src  + '" name="2p0" onclick="press15(2,0);" /></td>');
  document.write('		  <td><img id="4"  src="' + imgP[4].src  + '" name="3p0" onclick="press15(3,0);" /></td>');
  document.write('    </tr><tr>');
  document.write('		  <td><img id="5"  src="' + imgP[5].src  + '" name="0p1" onclick="press15(0,1);" /></td>');
  document.write('		  <td><img id="6"  src="' + imgP[6].src  + '" name="1p1" onclick="press15(1,1);" /></td>');
  document.write('		  <td><img id="7"  src="' + imgP[7].src  + '" name="2p1" onclick="press15(2,1);" /></td>');
  document.write('		  <td><img id="8"  src="' + imgP[8].src  + '" name="3p1" onclick="press15(3,1);" /></td>');
	document.write('    </tr><tr>');
  document.write('		  <td><img id="9"  src="' + imgP[9].src  + '" name="0p2" onclick="press15(0,2);" /></td>');
  document.write('		  <td><img id="10" src="' + imgP[10].src + '" name="1p2" onclick="press15(1,2);" /></td>');
  document.write('		  <td><img id="11" src="' + imgP[11].src + '" name="2p2" onclick="press15(2,2);" /></td>');
  document.write('		  <td><img id="12" src="' + imgP[12].src + '" name="3p2" onclick="press15(3,2);" /></td>');
	document.write('    </tr><tr>');
  document.write('		  <td><img id="13" src="' + imgP[13].src + '" name="0p3" onclick="press15(0,3);" /></td>');
  document.write('		  <td><img id="14" src="' + imgP[14].src + '" name="1p3" onclick="press15(1,3);" /></td>');
  document.write('		  <td><img id="15" src="' + imgP[15].src + '" name="2p3" onclick="press15(2,3);" /></td>');
  document.write('		  <td><img id="0"  src="' + imgP[0].src  + '" name="3p3" onclick="press15(3,3);" /></td>');
  document.write('</tr></form>');
  document.write('</table>');

  document.write('<table border=0 cellspacing="0" cellpadding="1">');
	document.write('  <form name="frmToggler"><tr>');
	document.write('    </tr><tr>');
  document.write('      <td>');
  document.write('        <a class="nolnk" href="javascript:ShowBoard()"><img border=0 src="/images/games/highscore.gif" alt="[Show High Scores]" /></a>');
  document.write('      </td><td>');
  document.write('      <td colspan="2" align=center><input style="width:62px;" type="button" value="Shuffle" onclick="shuffle15();"></td>');
	document.write('    </tr><tr>');
  document.write('      <td colspan="4" style="font-family:Verdana; font-size:10px;"><a href="http://www.flooble.com/scripts/peeptin.php">Adapted from <b>peeptin</b></a> @ <a href="http://www.flooble.com/">flooble</a></td>');
	document.write('    </tr></form>');
  document.write('</table>');

  shuffle15();
  
<!-- Flooble.com peeptin end   -->