function sendOrder() {
	var name = document.getElementById("order_name").value;
	if(name == "" || name == "Vaše jméno") { alert("Zadejte jméno."); document.getElementById("order_name").focus(); return false; }
	if(!alphanumOnly(name)) { alert("Jméno smí obsahovat pouze velká a malá písmena a číslice."); document.getElementById("order_name").focus(); return false; }
	name = chnEncode(name);

	var company = document.getElementById("order_company").value;
	if(company == "") { alert("Zadejte telefon."); document.getElementById("order_company_phone").focus(); return false; }
	company = chnEncode(company);

	var email = document.getElementById("order_email").value;
	if(email == "") { alert("Zadejte email."); document.getElementById("order_email").focus(); return false; }
	if(!checkEmail(email)) { alert("Zadaná emailová adresa je neplatná."); focusError(document.getElementById("order_email"), "blue"); return false; }
	email = chnEncode(email);

	var phone = document.getElementById("order_phone").value;
	if(phone == "") { alert("Zadejte telefon."); document.getElementById("order_phone").focus(); return false; }
	phone = chnEncode(phone);

	var deadline = document.getElementById("deadline").value;
	if(deadline == "") { alert("Zadejte termín zakázky."); document.getElementById("deadline").focus(); return false; }
	deadline = chnEncode(deadline);

	var quantity = document.getElementById("quantity").value;
	if(quantity == "") { alert("Zadejte množství."); document.getElementById("quantity").focus(); return false; }
	quantity = chnEncode(quantity);

	var material = document.getElementById("material").value;
	if(material == "") { alert("Zadejte material."); document.getElementById("material").focus(); return false; }
	material = chnEncode(material);

	var colour = document.getElementById("colour").value;
	if(colour == "") { alert("Zadejte barvu."); document.getElementById("colour").focus(); return false; }
	colour = chnEncode(colour);

	var size = document.getElementById("size").value;
	if(size == "") { alert("Zadejte velikosti."); document.getElementById("size").focus(); return false; }
	size = chnEncode(size);

	var surface = document.getElementById("surface").value;
	if(surface == "") { alert("Zadejte povrch."); document.getElementById("surface").focus(); return false; }
	surface = chnEncode(surface);



	var text = chnEncode(document.getElementById("order_text").value);var antispam = document.getElementById("antispam").value;

	if(antispam == "") { alert("Zadejte kontrolní kód."); document.getElementById("antispam").focus(); return false; }

	var params = "antispam=" + antispam + "&name=" + name + "&company=" + company + "&email=" + email + "&text=" + text;
	params += "&deadline=" + deadline + "&quantity=" + quantity + "&material=" + material + "&colour=" + colour + "&size=" + size + "&surface=" + surface;

	result = loadResultOnly("/" + PATH + "scm/scm_order_post", params);

	if(result == "OK") {
		document.getElementById("order_text").value = "";
		document.getElementById("antispam").value = "";
		now = new Date();
		document.getElementById("antispam_img").src = "/" + PATH + "scm/antispam.php" + "?" + now.getTime();

		document.getElementById("form").style.display = "none";
		document.getElementById("done").style.display = "block";

	} else {
		if(result == "SPAM") {
			alert("Zadali jste špatný kontrolní text.");
			now = new Date();
			document.getElementById("antispam_img").src = "/" + PATH + "scm/antispam.php" + "?" + now.getTime();
			document.getElementById("antispam").focus();
			return false;
		} else {
			alert(result);
			return false;
		}

	}

}

function sendDemand() {
	var name = document.getElementById("demand_name").value;
	if(name == "" || name == "Vaše jméno") { alert("Zadejte jméno."); document.getElementById("demand_name").focus(); return false; }
	if(!alphanumOnly(name)) { alert("Jméno smí obsahovat pouze velká a malá písmena a číslice."); document.getElementById("demand_name").focus(); return false; }
	name = chnEncode(name);

	var company = document.getElementById("demand_company").value;
	if(company == "") { alert("Zadejte telefon."); document.getElementById("demand_company_phone").focus(); return false; }
	company = chnEncode(company);

	var email = document.getElementById("demand_email").value;
	if(email == "") { alert("Zadejte email."); document.getElementById("demand_email").focus(); return false; }
	if(!checkEmail(email)) { alert("Zadaná emailová adresa je neplatná."); focusError(document.getElementById("demand_email"), "blue"); return false; }
	email = chnEncode(email);

	var phone = document.getElementById("demand_phone").value;
	if(phone == "") { alert("Zadejte telefon."); document.getElementById("demand_phone").focus(); return false; }
	phone = chnEncode(phone);

	var deadline = document.getElementById("deadline").value;
	if(deadline == "") { alert("Zadejte termín zakázky."); document.getElementById("deadline").focus(); return false; }
	deadline = chnEncode(deadline);

	var quantity = document.getElementById("quantity").value;
	if(quantity == "") { alert("Zadejte množství."); document.getElementById("quantity").focus(); return false; }
	quantity = chnEncode(quantity);

	var material = document.getElementById("material").value;
	if(material == "") { alert("Zadejte material."); document.getElementById("material").focus(); return false; }
	material = chnEncode(material);

	var colour = document.getElementById("colour").value;
	if(colour == "") { alert("Zadejte barvu."); document.getElementById("colour").focus(); return false; }
	colour = chnEncode(colour);

	var size = document.getElementById("size").value;
	if(size == "") { alert("Zadejte velikosti."); document.getElementById("size").focus(); return false; }
	size = chnEncode(size);

	var surface = document.getElementById("surface").value;
	if(surface == "") { alert("Zadejte povrch."); document.getElementById("surface").focus(); return false; }
	surface = chnEncode(surface);


	var text = chnEncode(document.getElementById("demand_text").value);var antispam = document.getElementById("antispam").value;

	if(antispam == "") { alert("Zadejte kontrolní kód."); document.getElementById("antispam").focus(); return false; }

	var params = "antispam=" + antispam + "&name=" + name + "&company=" + company + "&email=" + email + "&text=" + text;
	params += "&deadline=" + deadline + "&quantity=" + quantity + "&material=" + material + "&colour=" + colour + "&size=" + size + "&surface=" + surface;

	result = loadResultOnly("/" + PATH + "scm/scm_demand_post", params);

	if(result == "OK") {
		document.getElementById("demand_text").value = "";
		document.getElementById("antispam").value = "";
		now = new Date();
		document.getElementById("antispam_img").src = "/" + PATH + "scm/antispam.php" + "?" + now.getTime();

		document.getElementById("form").style.display = "none";
		document.getElementById("done").style.display = "block";

	} else {
		if(result == "SPAM") {
			alert("Zadali jste špatný kontrolní text.");
			now = new Date();
			document.getElementById("antispam_img").src = "/" + PATH + "scm/antispam.php" + "?" + now.getTime();
			document.getElementById("antispam").focus();
			return false;
		} else {
			alert(result);
			return false;
		}

	}

}