function tisk() {
window.print();
}

function validate(formular)
	{
	
	if (formular.jmeno.value=="")
		{
		alert("Vyplňte kolonku jméno a příjmení prosím.");
		formular.jmeno.focus();
		return false;
		}
	if (formular.email.value=="")
		{
		alert("Vyplňte kolonku email prosím.");
		formular.email.focus();
		return false;
		}
	else 
		{
    return true;
    }
  }


	function changeAction(obec, zastavka) {
		var form = document.getElementById('spojeni_form');
		var select = document.getElementById('spojeni_jizdni_rad');
		var kam = document.getElementById('spojeni_kam');
		var action = select.value;
		if (action=='vlaky') kam.value = zastavka;
		else kam.value = obec;
		form.action = 'http://www.idos.cz/'+action+'/';
	}
	
	function y2k(number) { return (number < 1000) ? number + 1900 : number; }
	
	
	function dateUp() {
		var input = document.getElementById('spojeni_datum');
		var pole = input.value.split('.');
		var milliseconds =
	    Date.UTC(y2k(pole[2]),pole[1]-1,pole[0]);
	    milliseconds += 86400000;
	    formatDate(milliseconds);
	}
	
	function dateDown() {
		var input = document.getElementById('spojeni_datum');
		var pole = input.value.split('.');
		var milliseconds =
	    Date.UTC(y2k(pole[2]),pole[1]-1,pole[0]);
	    milliseconds -= 86400000;
	    formatDate(milliseconds);
	}
	
	function timeUp() {
		var input = document.getElementById('spojeni_cas');
		var pole = input.value.split(':');
		var milliseconds = 
	    Date.UTC(2008,1,1, pole[0]-1, pole[1]);
	    milliseconds += 60000;
	    formatTime(milliseconds);
	}
	
	function timeDown() {
		var input = document.getElementById('spojeni_cas');
		var pole = input.value.split(':');
		var milliseconds = 
	    Date.UTC(2008,1,1, pole[0]-1, pole[1]);
	    milliseconds -= 60000;
	    formatTime(milliseconds);
	}
	
	function timeUpM() {
		var input = document.getElementById('spojeni_cas');
		var pole = input.value.split(':');
		var milliseconds = 
	    Date.UTC(2008,1,1, pole[0]-1, pole[1]);
	    milliseconds += 60*60000;
	    formatTime(milliseconds);
	}
	
	function timeDownM() {
		var input = document.getElementById('spojeni_cas');
		var pole = input.value.split(':');
		var milliseconds = 
	    Date.UTC(2008,1,1, pole[0]-1, pole[1]);
	    milliseconds -= 60*60000;
	    formatTime(milliseconds);
	}
	
	function formatDate(milliseconds) {
		var input = document.getElementById('spojeni_datum');
	    date = new Date(milliseconds);
	    var year = date.getYear();
	    var month = date.getMonth() + 1;
	    var day = date.getDate();
	    input.value = ((day < 10) ? '0' + day : day) + '.' +
	    							  ((month < 10) ? '0' + month : month) + '.' +
	    							  ((year < 1000) ? year + 1900 : year);
	}
	
	function formatTime(milliseconds) {
		var input = document.getElementById('spojeni_cas');
	    date = new Date(milliseconds);
	    var hour = date.getHours();
	    var minute = date.getMinutes();
	    input.value = ((hour < 10) ? '0' + hour : hour) + ':' +
	    							  ((minute < 10) ? '0' + minute : minute);
	}

