/*
*   jscript.js
*   3.7.2007 14:59:58
*/

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Kontrola spravnosti vlozenych dat na strane klienta pro formular
*  "diskuse_nova_save.php" - prihlaseny uzivatel - jen dve polozky
*/
function form_nova_reg() {
var retval;
var msg;
msg = "Některé z povinných položek nebyly vyplněny!\nProsím opravte zadání\n\n";
retval = true;

if (document.d_nova.subject.value == "" || document.d_nova.subject.value == "?") {
  document.d_nova.subject.focus();
  msg += "PŘEDMĚT\t - nevyplněn !\n";
  retval = false;
}

if (document.d_nova.message.value == "" || document.d_nova.message.value == "?") {
  document.d_nova.message.focus();
  msg += "ZPRÁVA\t\t - nevyplněno !\n";
  retval = false;
}

if ( !(retval) ) { window.alert(msg); }
return retval;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Kontrola vlozenych dat na strane klienta pro formular
*  "forget_form.php" - zaslat zapomenute heslo
*/
function form_forget() {
var retval;
var msg;
msg = "Některé z povinných položek nebyly vyplněny!\nProsím opravte zadání\n\n";
retval = true;

if (document.forget.login.value == "" || document.forget.login.value == " ") {
  document.forget.login.focus();
  msg += "Vyplňte prosím vaše přihlašovací jméno!\n";
  retval = false;
}

if ( !(retval) ) { window.alert(msg); }
return retval;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Kontrola spravnosti vlozenych dat na strane klienta pro formular
*  "diskuse_nova_save.php" neprihlaseny uzivatel - vice polozek ke kontrole
*/
function form_nova() {
var retval;
var msg;
msg = "Některé z povinných položek nebyly vyplněny!\nProsím opravte zadání\n\n";
retval = true;

if (document.d_nova.subject.value == "" || document.d_nova.subject.value == "?") {
  document.d_nova.subject.focus();
  msg += "PŘEDMĚT\t - nevyplněn !\n";
  retval = false;
}

if (document.d_nova.message.value == "" || document.d_nova.message.value == "?") {
  document.d_nova.message.focus();
  msg += "ZPRÁVA\t\t - nevyplněno !\n";
  retval = false;
}

if (document.d_nova.jmeno.value == "" || document.d_nova.jmeno.value == "?") {
  document.d_nova.jmeno.focus();
  msg += "JMÉNO\t\t - nevyplněno !\n";
  retval = false;
}

if (document.d_nova.email.value == "" || document.d_nova.email.value == "?") {
  document.d_nova.email.focus();
  msg += "EMAIL\t\t - nevyplněn !\n";
  retval = false;
}

// code string
var x = document.d_nova.code.value;
if ( x == "" || /\D/.test(x) || x.length != 6) {
  document.d_nova.code.value = "";
  document.d_nova.code.focus();
  msg += "KÓD\t\t - opiště přesně kontrolní zobrazený kód.\n";
  retval = false;
}

if ( !(retval) ) { window.alert(msg); }
return retval;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Kontrola spravnosti vlozenych dat na strane klienta pro formular
*  "diskuse_nova_save.php" - prihlaseny uzivatel - jen dve polozky
*/
function form_reg() {
var retval;
var msg;
msg = "Některé z povinných položek nebyly vyplněny!\nProsím opravte zadání\n\n";
retval = true;

if (document.reg.login.value == "" || document.reg.login.value == "?") {
  document.reg.login.focus();
  msg += "Login\t - nevyplněno !\n";
  retval = false;
}

if (document.reg.heslo.value == "" || document.reg.heslo.value == "?") {
  document.reg.heslo.focus();
  msg += "Heslo\t - nevyplněno !\n";
  retval = false;
}

if (document.reg.heslo.value == "" || document.reg.heslo.value == "?") {
  document.reg.heslo.focus();
  msg += "Heslo 2\t - nevyplněno !\n";
  retval = false;
}

if (document.reg.jmeno.value == "" || document.reg.jmeno.value == "?") {
  document.reg.jmeno.focus();
  msg += "Jméno\t - nevyplněno !\n";
  retval = false;
}

if (document.reg.prijmeni.value == "" || document.reg.prijmeni.value == "?") {
  document.reg.prijmeni.focus();
  msg += "Příjmení\t - nevyplněno !\n";
  retval = false;
}

if (document.reg.email.value == "" || document.reg.email.value == "?") {
  document.reg.email.focus();
  msg += "E-mail\t - nevyplněno !\n";
  retval = false;
}


if ( !(retval) ) { window.alert(msg); }
return retval;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Kontrola spravnosti vlozenych dat na strane klienta pro formular
*  "diskuse_nova_save.php" - prihlaseny uzivatel - jen dve polozky
*/
function vloz_smajlika(textarea, text) {
	textarea = document.getElementById(textarea);

	// pro IE a jiné prohlížeče, které podporují "document.selection"
	if (document.selection) {
		textarea.focus();
		vyber = document.selection.createRange();
		vyber.text = text;
	}

	// pro prohlížeče postavené na jádře Gecko
	else if (textarea.selectionStart || textarea.selectionStart == 0) {
		startPos = textarea.selectionStart;
		endPos = textarea.selectionEnd;
		textarea.value = textarea.value.substring(0, startPos) + text + textarea.value.substring(endPos, textarea.value.length);
	}

	else textarea.value += text;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *




/*
var x = document.akce_a.phone.value;
if ( x == "" || /\D/.test(x) || x.length != 9) {
  document.akce_a.phone.value = "?";
  document.akce_a.phone.focus();
  msg += "TELEFON\t\t - mohou být pouze číslice (max.9) Bez mezer (xxxyyyzzz)!\n";
  retval = false;
}

// kontrola zadani poctu hracu - pri chybe vypise do daneho pole "?" a nastavi na nej fokus
if ( document.d_nova.p_01.value == "" || !(/[0-9]/.test(document.d_nova.p_01.value))) {
  document.d_nova.p_01.value = "?";
  document.d_nova.p_01.focus();
  msg += "POČET HRÁČŮ\t - může být pouze číslice (max.99), nebo \"0\".\n";
  retval = false;
}


*/
