var ImagePath = 'posnetek/mini18/';

function loadFen(fenString,boardEl)
    {
        var items = fenString.split(/\s/g);
        var pieces = items[0];
        Border = 0;
        var arr_squareLetter = new Array("a","b","c","d","e","f","g","h");
        PiecePic = new Array();

        for (jj=0; jj<64; jj++)
        {
        PiecePic[jj] = ImagePath + "t.gif";
        }
        var currentCol = 0;
        for(var no=0;no<pieces.length;no++){
            var character = pieces.substr(no,1);

            if(character.match(/[A-Z]/i)){  /* White pieces */  
                if(character.match(/[A-Z]/)){   /* White pieces */                      
                    var color = 'w';
                }
                if(character.match(/[a-z]/)){   /* Black pieces */
                    var color = 'b';
                }
            img = ImagePath + color + character.toLowerCase() + '.gif';
            PiecePic[currentCol] = img;
            currentCol++;
            }
            if(character.match(/[0-8]/))currentCol+=character/1;
        }

        kk=0;
        squareCol="w.gif"
        document.write("<TABLE style='border:4px #999999 double; background-color:#E3E3E3; margin-top:5px' cellpadding=1 cellspacing=1>");
        for (jj=0; jj<8; jj++)
        {
        document.write("<tr>");
        for (nn=0; nn<8; nn++)
        {
        document.write("<td background='"+ImagePath+squareCol+"' width=18 height=18><img src='"+PiecePic[kk]+"'></td>");
        if (squareCol=="b.gif")
        {
        squareCol="w.gif";
        }
        else
        {
        squareCol="b.gif";
        }
        kk++;
        }
        lf = 8 - jj;
        document.write("<td width=12 align=center>"+lf+"</td></tr>");
        if (squareCol=="b.gif")
        {
        squareCol="w.gif";
        }
        else
        {
        squareCol="b.gif";
        }
        }
        for(var i=0;i<8;++i)
        {
        document.write("<td height=14 align=center class='labela'>"+arr_squareLetter[i]+"</td>");
        }
        document.writeln("</table>");

}





