function IsNumeric(sText)
{
  return (sText.match(/^(\d*)$/g) == null) ? false : true;
}




function utf8(wide) {
  var c, s;
  var enc = new Array();
  var i = 0;
  while(i<wide.length) {
    c= wide.charCodeAt(i++);
    // handle UTF-16 surrogates
    if (c>=0xDC00 && c<0xE000) continue;
    if (c>=0xD800 && c<0xDC00) {
      if (i>=wide.length) continue;
      s= wide.charCodeAt(i++);
      if (s<0xDC00 || c>=0xDE00) continue;
      c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
    }
    // output value
    if (c<0x80) enc.push(String.fromCharCode(c));
    else if (c<0x800) enc.push(String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F)));
    else if (c<0x10000) enc.push(String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F)));
    else enc.push(String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F)));
  }
  return enc.join('');
}

function okURIchars (c) {
  return (s >= 48 && s <= 57) || (s >= 65 && s<=90) || (s >= 97 && s<=122) || s==45 || s==95;
}

if (typeof encodeURIComponent != "function")
{
  encodeURIComponent = function(s) 
  {
    var s = utf8(s);
    var c;
    var enc = "";
    for (var i= 0; i<s.length; i++) {
      if (!okURIchars(s.charAt(i)))
        enc += "%"+s.charCodeAt(i).toString(16);
      else
        enc += s.charAt(i);
    }
    return enc;
  }
}

function AddPoint(emneNr, x, y) {
  var div = document.createElement("div");
  div.style.zIndex = '400';
  div.style.border = '0px';
  div.innerHTML = "<"+"a href='javascript:windowopen(" + emneNr + ")' onmouseover='ShowInfobox(this," + emneNr + "," + x + "," + y + ");' onmouseout='RemoveInfoBox();'><"+"img src='/templates/www.oline.dk/images/dot.gif' style='border:0px;' /><"+"/a>";
  document.getElementById('mapContainer').appendChild(div);
  tc.addPoi(new KrakMap.Poi(div, new KrakMap.Coordinate(x,y), 'MyCategory', 10, 10));
}
function RemoveInfoBox() {
  var container = document.getElementById('mapContainer')
  var oldBox = document.getElementById('mapInfoBox');
  if(oldBox) container.removeChild(oldBox);
}





