function validate_napiste(frm) {
	if(frm.elements['jmeno'].value == '') {
		alert('Je nutno vyplnit pole JMENO');
		return false;
	}
	if (!check_email(frm.elements['email'].value,'VÁŠ EMAIL')) return false;
	return true;
}


function check_email(email, notice) {
  if (email == '') {
		alert('Je nutno vyplnit pole: ' + notice);
		return false;
	}
	regex = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
	if(!regex.test(email)) {
		alert('Chybně zadané pole: ' + notice);
		return false;
	}
	return true;
}
  
function otevri_okno(url, width, height) {
	window.open("foto.php?img="+url,"foto","width="+width+",height="+height+",status=1,statusbar=1,toolbar=0,menubar=0,location=0,directories=0,resizable=1,scrollbars=0");
	return false;
}


function light_block_on(tlacitko, obsah) {
  document.getElementById(tlacitko).style.backgroundColor = '#9cce31';
  document.getElementById(obsah).style.color = 'red';
}
function light_block_off(tlacitko, obsah) {
  document.getElementById(tlacitko).style.backgroundColor = '#acacac';
  document.getElementById(obsah).style.color = 'black';
}

// stripe tables
window.onload = init;

function init() {
	//stripeTableById('list');
	stripeAllTables();
}

function stripeTable(t) {
	var i, odd = true;
	for (i=0; i<t.rows.length; i++) {
		t.rows[i].className += odd ? ' odd' : ' even';
	 odd = !odd;
  }
}
	
function stripeTableById(id) {
	var t = document.getElementById(id);
	if (t) stripeTable(t);
}

function stripeAllTables() {
	var t = document.getElementsByTagName('TABLE');
	for (var i=0; i<t.length; i++) {    
    if (t[i].id=='list') stripeTable(t[i]);
  }
}

