//podziękowania dla autorów www.eti.pg.gda.pl - kod ciasteczek jest w całości ich, kod ukrywania w dużej części wzorowany

function ustawCiastko(name, value, path, expire) {
 document.cookie = name + "=" + escape(value)
 + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
 + ((path == null) ? "" : ("; path=" + path))
}

function czytajCiastko(name) {
 var wanted = name + "="
 if (document.cookie.length != 0) {
    offset = document.cookie.indexOf(wanted) 
    if (offset != -1) { 
       offset += wanted.length 
       end = document.cookie.indexOf(";", offset) 
       if (end == -1) 
          end = document.cookie.length
       return unescape(document.cookie.substring(offset, end))
    } 
 }
}

function SetVisi() {
var stan = czytajCiastko("patron");
	if (stan != "visible") {changeSubmenu("patron", "hidden");} else {changeSubmenu("patron");}
var stan = czytajCiastko("rekrutacja");
	if (stan != "visible") {changeSubmenu("rekrutacja", "hidden");} else {changeSubmenu("rekrutacja");}
var stan = czytajCiastko("kadra");
	if (stan != "visible") {changeSubmenu("kadra", "hidden");} else {changeSubmenu("kadra");}
var stan = czytajCiastko("uczen");
	if (stan != "visible") {changeSubmenu("uczen", "hidden");} else {changeSubmenu("uczen");}
var stan = czytajCiastko("zycie");
	if (stan != "visible") {changeSubmenu("zycie", "hidden");} else {changeSubmenu("zycie");}
var stan = czytajCiastko("przedmiot");
	if (stan != "visible") {changeSubmenu("przedmiot", "hidden");} else {changeSubmenu("przedmiot");}
var stan = czytajCiastko("dokumenty");
	if (stan != "visible") {changeSubmenu("dokumenty", "hidden");} else {changeSubmenu("dokumenty");}
var stan = czytajCiastko("co_robimy");
	if (stan != "visible") {changeSubmenu("co_robimy", "hidden");} else {changeSubmenu("co_robimy");}
var stan = czytajCiastko("wolontariat");
	if (stan != "visible") {changeSubmenu("wolontariat", "hidden");} else {changeSubmenu("wolontariat");}
var stan = czytajCiastko("projekty");
	if (stan != "visible") {changeSubmenu("projekty", "hidden");} else {changeSubmenu("projekty");}
var stan = czytajCiastko("kalendarz");
	if (stan != "visible") {changeSubmenu("kalendarz", "hidden");} else {changeSubmenu("kalendarz");}	
var stan = czytajCiastko("kola");	
	if (stan != "visible") {changeSubmenu("kola", "hidden");} else {changeSubmenu("kola");}
var stan = czytajCiastko("konkursy");
	if (stan != "visible") {changeSubmenu("konkursy", "hidden");} else {changeSubmenu("konkursy");}
var stan = czytajCiastko("Intel");
	if (stan != "visible") {changeSubmenu("Intel", "hidden");} else {changeSubmenu("Intel");}
var stan = czytajCiastko("publikacje");
	if (stan != "visible") {changeSubmenu("publikacje", "hidden");} else {changeSubmenu("publikacje");}
var stan = czytajCiastko("biuletyn");
	if (stan != "visible") {changeSubmenu("biuletyn", "hidden");} else {changeSubmenu("biuletyn");}
var stan = czytajCiastko("dla_rodzicow");
	if (stan != "visible") {changeSubmenu("dla_rodzicow", "hidden");} else {changeSubmenu("dla_rodzicow");}
var stan = czytajCiastko("zdjecia");
	if (stan != "visible") {changeSubmenu("zdjecia", "hidden");} else {changeSubmenu("zdjecia");}
		
}

function changeSubmenu(menu,state) {
	if (document.getElementById('submenu-'+menu) == null) return;
	if ((document.getElementById('submenu-'+menu).style.display == 'block') || (state=='hidden')) {
	 document.getElementById('submenu-'+menu).style.display = 'none';
	 ustawCiastko(menu, "hidden", "/");
	} else {
	 document.getElementById('submenu-'+menu).style.display = 'block'
	 ustawCiastko(menu, "visible", "/");
	}
}
