//	Vyměna barvy pozadí
function setBgColor (id, color) {

	if (document.layers)
		document[id].bgColor = color == 'transparent' ? null : color;
	else if (document.all)
		document.all[id].style.backgroundColor = color;
	else if (document.getElementById)
		document.getElementById(id).style.backgroundColor = color;

}


// Skript pro změnu barvu elementu
function changecolor(id,color) {
	document.getElementById(id).style.color=color;
}


// Zobrazování nejbližších zastávek MHD
function showstation(id) {
	if(id == 'x1') {
		document.getElementById('x1').style.display='';
		document.getElementById('x2').style.display='none';
		document.getElementById('x3').style.display='none';
	}
	if(id == 'x2') {
		document.getElementById('x1').style.display='none';
		document.getElementById('x2').style.display='';
		document.getElementById('x3').style.display='none';
	}
	if(id == 'x3') {
		document.getElementById('x1').style.display='none';
		document.getElementById('x2').style.display='none';
		document.getElementById('x3').style.display='';
	}
}


// Řazení seznamu absolventů
function seraditpodle(co) {
	document.location.href = '/absolventi-zus/' + co + '/';
}


// Regulární výraz pro kontrolu e-mailové adresy
function check_email(adresa) {
	re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;
	return adresa.search(re) == 0;
}


// Kontrola správného vyplnění kontaktního formuláře
function sendmail() {

	if(document.forms[0].jmeno.value == "") {
		alert("Vyplňte, prosím, Vaše jméno a příjmení!");
		document.forms[0].jmeno.focus();
		return false;
	}

	if(document.forms[0].email.value == "") {
		alert("Vyplňte, prosím, Vaši emailovou adresu!");
		document.forms[0].email.focus();
		return false;
	}
	if (!check_email(document.forms[0].email.value) ) {
	   alert("Vaše emailová adresa není vyplněna správně!");
	   document.forms[0].email.focus();
	   return false;
	}
	if(document.forms[0].zprava.value == "") {
		alert("Teď už nám jen něco napište! :-)");
		document.forms[0].zprava.focus();
		return false;
	}
	document.forms[0].akce.value = "sendmail";
	document.forms[0].submit();

}

