function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function odeslatForm(){
   var chyby = 0;
   id = 'jmeno'; if(trim(document.getElementById(id).value) == ''){chyby += 1;}
   id = 'mail'; if(trim(document.getElementById(id).value) == ''){chyby += 1;}
   id = 'text'; if(trim(document.getElementById(id).value) == ''){chyby += 1;}
   
   var text = document.getElementById('mail').value;
	var vyraz = new RegExp("^[_a-zA-Z0-9-]+([\.]{1}[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+([\.]{1}[a-zA-Z0-9-]+)*[\.]{1}[a-z]{2,3}$");
	var result = text.search(vyraz);
	if(result == -1){chyby += 1;}
   
   if(chyby == 0){document.forms.kontakt.submit();}else{alert('Vyplňte správně všechna povinná pole označená hvězdičkou.');}
}

function newsletterOdeslat(){
   var chyby = 0;
   id = 'mail'; if(trim(document.getElementById(id).value) == ''){chyby += 1;}
   
   var text = document.getElementById('mail').value;
	var vyraz = new RegExp("^[_a-zA-Z0-9-]+([\.]{1}[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+([\.]{1}[a-zA-Z0-9-]+)*[\.]{1}[a-z]{2,3}$");
	var result = text.search(vyraz);
	if(result == -1){chyby += 1;}
   
   if(chyby == 0){document.forms.newsletter.submit();}else{alert('Vyplňte správně Vaší e-mailovou adresu.');}
}

function open_video(){
   okno = window.open('/video/index.php', 'Video', 'scrollbars=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, copyhistory=no, width=810, height=650');
}