
function getAjaxObject() {

  // -- inicializace privatni instance pro ajax request
  if (typeof XMLHttpRequest == "undefined") {
     xmlhttp = new ActiveXObject(navigator.userAgent.indexOf("MSIE 5") >= 0 ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
  }
  else {
    xmlhttp = new XMLHttpRequest();
  }

  return xmlhttp;
}

/**
*  Formátování čísla na masku ### ###.##
*  Pokud dec == false, tak nebudou použita desetinná místa
*/
function FormatMoney(value,dec) {
  value = value.split('.');

  if (value[0].length > 3) {
    var res = '';
    var j = 0;
    for (var i=value[0].length-1; i>=0; i--) {
      if (j==3) {
        j = 0;
        res = ' ' + res;
      }
      res = value[0].substr(i,1) + res;
      j++;
    }
    value[0] = res;
  }

  if (dec) {
    if (value.length == 1) value[1] = '00';
    else if (value[1].length < 2) value[1] = value[1] + '0';
    else value[1] = value[1].substr(0,2);

    return value[0] + ',' + value[1];
  }

  return value[0];
}
