function wi(url, width, height)
{
	width += 50; height += 50;
	window.open(url, 'foto', 'width='+width+', height='+height+', toolbar=no, location=no, resizable=yes, scrollbars=yes, top=100, left=100');
	return false; 
}

function w(url)
{
    window.open(url, "page", "menubar=yes, location=yes, status=yes, toolbar=no, scrollbars=yes, resizable=yes");
    return false;
}

function check_value()
{
    var el = document.getElementById('check_value');
    el.value = 1;
    return true;
}


function trim(hodnota)
{
	if(hodnota.charAt(0) == " ") {
		hodnota = hodnota.substring(1,hodnota.length);
		hodnota = trim(hodnota);
	}
	if(hodnota.charAt(hodnota.length-1) == " ") {
		hodnota = hodnota.substring(0,hodnota.length-1);
		hodnota=trim(hodnota);
	}
	return hodnota;
}

function validate_form()
{
	var error = false;
	var report = '';

	var jmeno = document.getElementById('jmeno').value;
	jmeno = trim(jmeno);
	if (jmeno.length == 0) {
		report += 'Nebylo zadáno jméno!\n';
		error = true;
	}

	var email = document.getElementById('email').value;
	email = trim(email);
	if (email.length == 0) {
		report += 'Nebyl zadán e-mail!\n';
		error = true;
	}

	var telefon = document.getElementById('telefon').value;
	telefon = trim(telefon);
	if (telefon.length == 0) {
		report += 'Nebyl zadán telefon!\n';
		error = true;
	}

	var zprava = document.getElementById('zprava').value;
	zprava = trim(zprava);
	if (zprava.length == 0) {
		report += 'Nebyla zadána zpráva!\n';
		error = true;
	}
	if (error) {
		alert (report);
		return false;
	}
	

	check_value();
	return true;
}
