    var myDictionary = new CMyDictionary("myDictionary", 1, 10);
    
    var aFlagsLeft = new Array("english.gif","slovene.gif","italian.gif","german.gif","france.gif","russian.gif", "spain.gif");
    var aFlagsLeftDescription = new Array("English", "Slovene","Italian","German","France","Russian", "Spanish");
      
    var aFlagsRight = new Array("slovene.gif", "english.gif","german.gif","france.gif","russian.gif", "spain.gif","italian.gif");
    var aFlagsRightDescription = new Array("Slovene","English","German","France","Russian", "Spanish","Italian");
    
    var nFlagLeftSelected = 1;
    var nFlagRightSelected = 1;
    var pTimerID = 0;
    
    function fOnLoad()
    {
      myDictionary.Type_Set((getFlagLeftSelected()*1000)+getFlagRightSelected());
      myDictionary.Hash_Set(0);
      
      selectFlag('flagleft', getFlagLeftSelected());
      selectFlag('flagright', getFlagRightSelected());
      
      //myDictionary.OnLoad();
    }
    
    function fDisplayFlags()
    {      
      document.write("<table bgcolor='#eaf3ff' width='520' cellspacing='0' cellpadding='0'><tr>");
      
      // flags on the left
      document.write("<td align='right'><table>");
      for(i=0; i<aFlagsLeft.length; i++)
      {
        document.write("<tr>");
        document.write("<td nowrap='nowrap'><div style='border: 1px solid;border-color: #eaf3ff;' onmouseover='javascript:selOn(this)' onmouseout='javascript:selOff(this, \"flagleft\", "+(i+1)+")' onmousedown='selDown(this)' onmouseup='selUp(this)' onclick='javascript:selectFlag(\"flagleft\","+(i+1)+")' name='fl"+(i+1)+"' id='fl"+(i+1)+"'><div style=' MARGIN-TOP: 4px'><input type='radio' name='flagleft' value='"+(i+1)+"' /><img src='img/"+aFlagsLeft[i]+"' width='24' height='16' alt='"+aFlagsLeftDescription[i]+"' />&nbsp;"+aFlagsLeftDescription[i]+"&nbsp;</div></div></td>");
        document.write("</tr>");
      }
      document.write("</table></td>");
      
      document.write("<td width='64' valign='middle' align='center'><img src='img/lefttoright.gif' width='32' height='80' alt='' /></td>");
      
      // flags on the right
      document.write("<td align='left'><table>");
      for(i=0; i<aFlagsRight.length; i++)
      {
        document.write("<tr>");
        document.write("<td nowrap='nowrap'><div style='border: 1px solid;border-color: #eaf3ff;' onmouseover='javascript:selOn(this)' onmouseout='javascript:selOff(this, \"flagright\", "+(i+1)+")' onmousedown='selDown(this)' onmouseup='selUp(this)' onclick='javascript:selectFlag(\"flagright\","+(i+1)+")' name='fr"+(i+1)+"' id='fr"+(i+1)+"'><div style=' MARGIN-TOP: 4px'><input type='radio' name='flagright' value='"+(i+1)+"' /><img src='img/"+aFlagsRight[i]+"' width='24' height='16' alt='"+aFlagsRightDescription[i]+"' />&nbsp;"+aFlagsRightDescription[i]+"&nbsp;</div></div></td>");
        document.write("</tr>");
      }
      document.write("</table></td>");
      
      document.write("</tr></table>");
    }
    function getFlagLeftSelected()
    {
      var nNum = parseInt(GetCookie("FlagLeftSelected"));
      if(!((nNum>0) && (nNum<=aFlagsLeft.length)))
      {
        nNum = 1;
      }
      nFlagLeftSelected = nNum;
      return nFlagLeftSelected;
    }
    function setFlagLeftSelected(nId)
    {
      SetCookie("FlagLeftSelected", ""+nId);
      nFlagLeftSelected = nId;
      document.getElementById("langsource").innerHTML = "&nbsp;&nbsp;<img src='img/"+aFlagsLeft[(nId-1)]+"' width='24' height='16' alt='' />&nbsp;"+aFlagsLeftDescription[(nId-1)];
    }
    function getFlagRightSelected()
    {
      var nNum = parseInt(GetCookie("FlagRightSelected"));
      if(!((nNum>0) && (nNum<=aFlagsLeft.length)))
      {
        nNum = 1;
      }
      nFlagRightSelected = nNum;
      return nFlagRightSelected;
    }
    function setFlagRightSelected(nId)
    {
      SetCookie("FlagRightSelected", ""+nId);
      nFlagRightSelected = nId;
      document.getElementById("langdestination").innerHTML = "<img src='img/"+aFlagsRight[(nId-1)]+"' width='24' height='16' alt='' />&nbsp;"+aFlagsRightDescription[(nId-1)];
    }
    function selectFlag(sName, nId)
    {
      if(sName=='flagleft')
      {
        clearSelections(sName, nId);
        var radios = document.getElementsByName(sName);
        radios[nId-1].checked = true;
        nFlagLeftSelected = nId;
        document.getElementById("fl"+(nId)).style.borderColor = '#000000';
        document.getElementById("fl"+(nId)).style.backgroundColor = '#B5BED6';
        setFlagLeftSelected(nId);
      }
      else if(sName=='flagright')
      {
        clearSelections(sName, nId);
        var radios = document.getElementsByName(sName);
        radios[nId-1].checked = true;
        nFlagRightSelected = nId;
        document.getElementById("fr"+(nId)).style.borderColor = '#000000';
        document.getElementById("fr"+(nId)).style.backgroundColor = '#B5BED6';
        setFlagRightSelected(nId);
      }
      myDictionary.Type_Set((getFlagLeftSelected()*1000)+getFlagRightSelected());
      myDictionary.Hash_Set(0);
      if(pTimerID)
      {
        clearTimeout(pTimerID);
        pTimerID = 0;
      }
      pTimerID = setTimeout("ReloadDictionary()", 500);
    }
    function ReloadDictionary()
    {
      myDictionary.OnLoad();
    }
    function clearSelections(sName, nID)
    {
      if(sName=='flagleft')
      {
        for(i=0; i<aFlagsLeft.length; i++)
        {
          if((nID-1)!=i)
          {
            document.getElementById("fl"+(i+1)).style.borderColor = '#eaf3ff';
            document.getElementById("fl"+(i+1)).style.backgroundColor = '#eaf3ff';
          }
        }
      }
      else if(sName=='flagright')
      {
        for(i=0; i<aFlagsLeft.length; i++)
        {
          if((nID-1)!=i)
          {
            document.getElementById("fr"+(i+1)).style.borderColor = '#eaf3ff';
            document.getElementById("fr"+(i+1)).style.backgroundColor = '#eaf3ff';
          }
        }
      }
    }
    function selOn(ctrl)
    {
      ctrl.style.borderColor = '#000000';
      ctrl.style.backgroundColor = '#B5BED6';
      ctrl.style.cursor = 'pointer';
    }
    function selOff(ctrl, sLR, nNum)
    {      
      var sObj = getValue(sLR);
      
      if(sLR=='flagleft')
      {
        if(!(""+nFlagLeftSelected==""+nNum))
        {
          ctrl.style.borderColor = '#eaf3ff';  
          ctrl.style.backgroundColor = '#eaf3ff';
        }
      }
      else if(sLR=='flagright')
      {
        if(!(""+nFlagRightSelected==""+nNum))
        {
          ctrl.style.borderColor = '#eaf3ff';  
          ctrl.style.backgroundColor = '#eaf3ff';
        }
      }
    }
    function selDown(ctrl)
    {
      ctrl.style.backgroundColor = '#8492B5';
    }
    function selUp(ctrl)
    {
      ctrl.style.backgroundColor = '#B5BED6';
    }
  
    function getValue(radioGroupName)
    {
        var radios = document.getElementsByName(radioGroupName);
        for (i = 0; i < radios.length; i++) 
        {
            if (radios[i].checked) return radios[i].value;
        }
    }
    function SetCookie(sCookieName, sCookieValue)
    {
      var exdate=new Date();
      exdate.setDate(exdate.getDate()+365);
      window.document.cookie = sCookieName+"=" + escape(sCookieValue) + ";expires="+exdate.toGMTString()+"; path=/";
    } 
    function GetCookie(sCookieName) 
    {
      var prefix = sCookieName + "="
      var cookieStartIndex = document.cookie.indexOf(prefix);
      if (cookieStartIndex == -1)
      {
         return "0";
      }
      var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
      if (cookieEndIndex == -1)
      {
         cookieEndIndex = document.cookie.length;
      }
      var sReturn = unescape(document.cookie.substring(cookieStartIndex +  prefix.length, cookieEndIndex));
      if((sReturn==null) || (sReturn==""))
      {
        sReturn = 0;
      }
      return sReturn;
    }