// JavaScript Document 'menu_cev_viana','menu_kultura','menu_fotogalerie','menu_kontakty','menu_bakalarske_studium'
menu_item = new Array('menu_skola','menu_studium','menu_prijimaci_rizeni','menu_sluzby_skoly','menu_pro_rodice','menu_sport','menu_souteze');

function openWindow(theURL,winName,width,height) {
	// Zjist rozlien monitoru (velikost obrazovky)
	var Browser = navigator.appName;
	var Version = parseInt(navigator.appVersion);
	if ((Browser == "Netscape" && Version >= 4) || (Browser == "Microsoft Internet Explorer" && Version >= 4)){
		ScrH = screen.height;
		ScrW = screen.width;
	} else {
		ScrH = 0;
		ScrW = 0;
	}

  var Position;
	if ((ScrH > 0) && (ScrW > 0)) Position = ",left="+(ScrW - 640)/2+",top="+(ScrH-640)/2;
	else Position = "";

	var features;
	features = 'width='+width+',height='+height+',left=0,top=0,scrollbars=no'+Position;
	window.open(theURL,winName,features);
}

/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


function toggle_menu(list){
	var listElementStyle=document.getElementById(list).style;
	setCookie('menuItemName',list);
	if (listElementStyle.display=="block"){ 
		listElementStyle.display="none";
		setCookie('menuItemProperty',"none");
	} else { 
		for(i=0;i<menu_item.length;i++){
			document.getElementById(menu_item[i]).style.display="none"; 
		}
		listElementStyle.display="block"; 
		setCookie('menuItemProperty',"block");
	} 
} 

function start(){
	if (getCookie('menuItemName')!=null && getCookie('menuItemProperty')!=null){
		document.getElementById(getCookie('menuItemName')).style.display=getCookie('menuItemProperty');
	} 
}

function collapse_all(){
	for(i=0;i<menu_item.length;i++){
//		setCookie('menuItemName',menu_item[i]);
		setCookie('menuItemProperty',"none");
		document.getElementById(menu_item[i]).style.display="none"; 
	}
}

//var listElementStyle=document.getElementById('menu_skola').style;
//alert(listElementStyle);
//document.getElementById('menu_skola').style.display="block";
