function init () {
	menu.init();
}

function validateAge () {
	var birthDay = document.getElementById("birthDay");
	var birthMonth = document.getElementById("birthMonth");
	var birthYear = document.getElementById("birthYear");
	
	var birthDate = new Date(birthYear.value, birthMonth.value - 1, birthDay.value);
	var today = new Date();
	var legalAge = new Date(today.getYear() - 18, today.getMonth(), today.getDate());
	
	var isOldEnough = (legalAge >= birthDate);
	if (isOldEnough) {
		return true;
	} else {
		document.location = "exit.html";
		return false;
	}
}

menu = {
	path	: "images/menu/",
	items	: ["uvod", "produkty", "historie", "akce", "slavnosti", "fotbal", "hokej"],
	
	init : function () {
		// preload mouseover obrazku
		for (var i = 0; i < menu.items.length; i++) {
			var preloadImg = new Image();
			preloadImg.src = menu.getImgPath(menu.items[i], "on");
		}
		return;
	},
	
	swap : function (elm, imgName, state) {
		if (elm) {
			if (imgName) {
				state = (state) ? state : "off";
				elm.previousState = elm.src;
				elm.src = menu.getImgPath(imgName, state);
			} else {
				if (elm.previousState) {
					elm.src = elm.previousState;
					elm.previousState = false;
				}
			}
			return true;
		}
		return false;
	},
	
	getImgPath : function (imgName, state) {
		if (imgName) {
			state = (state) ? state : "off";
			var imgPath = menu.path + state + "/" + imgName + ".gif";
			return imgPath;
		}
		return false;
	}
}

// functions for panoramatic view

function DoAutorotationStart() {
        document.ptviewer.startAutoPan( 0.5, 0.0, 1.0 );
}
function DoAutorotationStop() {
        document.ptviewer.stopAutoPan();
}
function DoZoomIn() {
	document.ptviewer.startAutoPan( 0.0, 0.0, 1.0/1.03 );
}
function DoZoomOut() {
	document.ptviewer.startAutoPan( 0.0, 0.0, 1.03 );
}
function DoShowHideHotspots() {
	document.ptviewer.toggleHS();
}
function DoReset() {
	document.ptviewer.gotoView( -45, 0, 80 );
}
function DisplayPan() {
	status = document.ptviewer.pan().toString() ;
}
function DisplayTilt() {
	status = document.ptviewer.tilt().toString() ;
}
function DisplayFov() {
	status = document.ptviewer.fov().toString() ;
}

function mousehs(n) {
	if( n== -1 )
   			document.cn.hsnum.value = "---" ;
	else
   			document.cn.hsnum.value = n ;
}
function getview(p,t,f) {
   document.cn.pan.value = p ;
   document.cn.tilt.value = t ;
   document.cn.fov.value = f ;
}

function NewPano(  ) {
	document.ptviewer.newPanoFromList(0);
}

// end

// fuction featuring in uvod

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// end

window.onload = init;
