function PuzzleBoard( path, fenString, pgnString )
{
    //SetImagePath( "alpha30/" );//use this function when your images are in another directory
    SetImagePath( path );//use this function when your images are in another directory
    EvalUrlString("SetImagePath");
    ImageOffset=document.images.length;
    var ImageStyle="";

    if( document.layers )
    {
        ImageStyle="border=1 ";
    } 
    else
    {
        ImageStyle="style='border-width:1px; border-style:solid; border-color:#333333;' ";
    }
    var html = "<table border=0 cellpadding=0 cellspacing=0 class='board'><tr>";
    for ( var ii = 0; ii < 64; ii++ )
    {
        if ( ( 9 * ii - ii % 8 ) % 16 == 0 )
        {
            html += "<td background='"+ImagePath+"w.gif'>";
        }
        else
        {
            html += "<td background='"+ImagePath+"b.gif'>";
        }
        html += "<img src='" + ImagePath + "t.gif' " + ImageStyle + " id='" + ii + "' onMouseDown='BoardClick( " + ii + ")'/></td>";
      
        if ( ii % 8 == 7 )
        {
            if ( ii < 63 )
            {
                html += "</tr><tr>";
            }
            else
            {
                html += "</tr></table>";
            }
        }    
    }
    document.write(html);
    Init( fenString );
    ApplyPgnMoveText( pgnString );
    //EvalUrlString();
    
    AllowRecording( true );
    AllowNullMove( false );
    setTimeout( "RefreshBoard( true )", 1000 );
}
function UserMove( isTextMove, MoveText )
{
    var isSolved   = false;
    var wrongMoves = 0;

    if ( !isSolved )
    {    
        mm = MoveCount;
        if ( ( isTextMove ) && ( MoveText.indexOf( "?" ) < 0 ) )
        {
            var mm = MoveCount;
            MoveForward(1);
           
            if ( mm == MoveCount )
            {
                isSolved = true;
                EnableNavigation();
            }
        }
        else
        {
            alert( "Dit is niet de goede zet." );
            wrongMoves++;
            MoveBack(1);
        }
    }
    else
    {
        return;
    }
}
function ShowAnswer()
{
	EnableNavigation();
}
function EnableNavigation()
{
	if ( document.getElementById )
	{
		document.getElementById('gameText').innerHTML=GetHTMLMoveText();
		
		var gameTextTr = document.getElementById('gameTextTr');
		try
		{
			gameTextTr.style.display="table-row";
		}
		catch(ex)
		{
			gameTextTr.style.display="block";
		}	
		document.getElementById('btnInit').disabled= false;
		document.getElementById('btnMB1').disabled = false;
		document.getElementById('btnMF1').disabled = false;
		document.getElementById('btnMF1000').disabled = false;
	}
}
