// (c) 2002 - 2003 Tom Dolezal
// require: IE5+
// version: 1.01
// updated: 25.1.2003 18:22

// nove okno
function win(url, width, height)
{
	if (!width)
		width = 300;
	if (!height)
		width = 200;
	
	if (document.all)
	{
		var x = Math.round(window.screen.availWidth / 2 - width / 2);
		var y = Math.round(window.screen.availHeight / 2 - height / 2);
		if (x < 0) x = 10;
		if (y < 0) y = 10;
	}
	else
		var x = 200, y = 200;

	var features = 'height='+height+', left='+x+', location=no, menubar=no, '
		+'resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no, top='+y+', width='+width;
	window.open(url, '_blank', features);
}

function checkInquiry(form)
{
	var elm = form.elements['Inquiry'];
	if (!elm.value.length)
	{
		alert('Dotaz je povinná položka.');
		elm.focus();
		return false;
	}
	elm = form.elements['Email'];
	if (!elm.value.length)
	{
		alert('E-mail je povinná položka.');
		elm.focus();
		return false;
	}
	else if (!elm.value.match(/^[\w\.-]+@([a-z0-9-]+\.)+[a-z]{2,}$/i))
	{
		alert('E-mail adresa musí mít platný formát.');
		elm.focus();
		return false;
	}
	return true;
}

function checkReg(form)
{
	var elm = form.elements['Login'];
	if (!elm.value.length)
	{
		alert('Přihlašovací jméno je povinná položka.');
		elm.focus();
		return false;
	}
	if (elm.value.length < 3)
	{
		alert('Přihlašovací jméno musí mít minimálně 3 znaky.');
		elm.focus();
		return false;
	}
	elm = form.elements['Password'];
	if (!elm.value.length)
	{
		alert('Přihlašovací heslo je povinná položka.');
		elm.focus();
		return false;
	}
	if (elm.value.length < 3)
	{
		alert('Přihlašovací heslo musí mít minimálně 3 znaky.');
		elm.focus();
		return false;
	}
	var elm2 = form.elements['PasswordRE'];
	if (elm.value != elm2.value)
	{
		alert('Přihlašovací heslo a jeho kontrola se neshodují.');
		elm.focus();
		return false;
	}
	elm = form.elements['Name'];
	if (!elm.value.length)
	{
		alert('Jméno je povinná položka.');
		elm.focus();
		return false;
	}
	elm = form.elements['Surname'];
	if (!elm.value.length)
	{
		alert('Příjmení je povinná položka.');
		elm.focus();
		return false;
	}
	elm = form.elements['Phone'];
	if (!elm.value.length)
	{
		alert('Telefon je povinná položka.');
		elm.focus();
		return false;
	}
	elm = form.elements['Email'];
	if (!elm.value.length)
	{
		alert('E-mail je povinná položka.');
		elm.focus();
		return false;
	}
	else if (!elm.value.match(/^[\w\.-]+@([a-z0-9-]+\.)+[a-z]{2,}$/i))
	{
		alert('E-mail adresa musí mít platný formát.');
		elm.focus();
		return false;
	}
	return true;
}
