function http(surl, method, post) {
	var xmlHttp;
	if (window.XMLHttpRequest) {
		var xmlHttp = new XMLHttpRequest();
	}
	else if(Window.ActiveXObject) {
		var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlHttp.open(method, surl, false);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send(post);
	
	return xmlHttp.responseText;
}

function check_domain(path, domain, tld, status_img) {
	if(domain != '') {
		new Request({
			'url': path + 'module/hosting/domain_check.php?domain=' + domain + tld,
			'method': 'get',
			'onSuccess': function(response) {
				if(response == 'ok') {
					img = 'yes';
					alt = 'Vefügbar';
					title = 'Vefügbar';
					res = 1;
				} else {
					img = 'no';
					alt = 'Nicht verfügbar';
					title= 'Nicht verfügbar';
					res = 0;
				}
				$(status_img).src = path + 'images/icons/' + img + '.png';
				$(status_img).alt = alt;
				$(status_img).title = title;
				return res;
			}
		}).send();
	} else {
		$(status_img).src = path + 'images/icons/unknown.png';
		$(status_img).alt = '?';
	}
}

function number_format (number, decimals, dec_point, thousands_sep)
{
  var exponent = "";
  var numberstr = number.toString ();
  var eindex = numberstr.indexOf ("e");
  if (eindex > -1)
  {
    exponent = numberstr.substring (eindex);
    number = parseFloat (numberstr.substring (0, eindex));
  }
  
  if (decimals != null)
  {
    var temp = Math.pow (10, decimals);
    number = Math.round (number * temp) / temp;
  }
  var sign = number < 0 ? "-" : "";
  var integer = (number > 0 ? 
      Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
  
  var fractional = number.toString ().substring (integer.length + sign.length);
  dec_point = dec_point != null ? dec_point : ".";
  fractional = decimals != null && decimals > 0 || fractional.length > 1 ? 
               (dec_point + fractional.substring (1)) : "";
  if (decimals != null && decimals > 0)
  {
    for (i = fractional.length - 1, z = decimals; i < z; ++i)
      fractional += "0";
  }
  
  thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ? 
                  thousands_sep : null;
  if (thousands_sep != null && thousands_sep != "")
  {
	for (i = integer.length - 3; i > 0; i -= 3)
      integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
  }
  
  return sign + integer + fractional + exponent;
}
