function send_xmlhttprequest(obsluha, method, url, content, headers) {
	var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));

	if (!xmlhttp)
		return false;

	xmlhttp.open(method, url);

	if (obsluha != null)
		xmlhttp.onreadystatechange = function() {
			obsluha(xmlhttp);
		};

	if (headers) {
		for (var key in headers)
			xmlhttp.setRequestHeader(key, headers[key]);
	}

	xmlhttp.send(content);
	return true;
}

function open_popup(dokument, sirka, vyska, scrollbars) {
	so = screen.width;
	vo = screen.height;
	zleva = ((so - sirka) / 2) - 13;
	shora = 120;
	popup_win = window.open(dokument,"popup_okno","width="+sirka+",height="+vyska+",left="+zleva+",top="+shora+",location=0,menubar=0,resizable=1,scrollbars="+scrollbars+",status=0,titlebar=0,toolbar=0");
	popup_win.focus();
}

function Show(id, show) {
  if (show)
    document.getElementById(id).style.visibility='visible';
  else
    document.getElementById(id).style.visibility='hidden';
}


function detail_image_category(obj, width, height, scrollbars) {
	url = obj.href;
	open_popup(url, width, height, scrollbars);
}

function anonym_email(formular, profile, language) {
	var email = formular.email.value;

	if (!send_xmlhttprequest(anonym_email_r, 'GET', '/register_aemail.php?p=' + profile + '&l=' + language + '&e=' + email)) {
		return true;
	}

	return false;
}

function anonym_email_r(xmlhttp) {
	if (xmlhttp.readyState == 4)
		alert(xmlhttp.responseText);
}
