/*
 * DO NOT REMOVE THIS NOTICE
 *
 * PROJECT:   MyGosuMenu
 * VERSION:   1.5.5
 * COPYRIGHT: (c) 2003-2009 Cezary Tomczak
 * LINK:      http://www.gosu.pl/MyGosuMenu/
 * LICENSE:   BSD revised (free for any use)
 */

function BarMenu(id) {
    this.box1Hover = true;
    this.box2Hover = true;
    this.highlightActive = false;

    this.init = function() {
        if (!document.getElementById(this.id)) {
            alert("Element '"+this.id+"' does not exist in this document. BarMenu cannot be initialized");
            return;
        }
        this.parse(document.getElementById(this.id).childNodes, this.tree, this.id);
        this.load();
        if (window.attachEvent) {
            window.attachEvent("onunload", function(e) { self.save(); });
        } else if (window.addEventListener) {
            window.addEventListener("unload", function(e) { self.save(); }, false);
        }
    }

    this.parse = function(nodes, tree, id) {
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].nodeType != 1) {
                continue;
            }
            if (nodes[i].className) {
                if ("box1" == nodes[i].className.substr(0, 4)) {
                    nodes[i].id = id + "-" + tree.length;
                    tree[tree.length] = new Array();
                    eval('nodes[i].onmouseover = function() { self.box1over("'+nodes[i].id+'"); }');
                    eval('nodes[i].onmouseout = function() { self.box1out("'+nodes[i].id+'"); }');
                    eval('nodes[i].onclick = function() { self.box1click("'+nodes[i].id+'"); }');
                }
                if ("section" == nodes[i].className) {
                    id = id + "-" + (tree.length - 1);
                    nodes[i].id = id + "-section";
                    tree = tree[tree.length - 1];
                }
                if ("box2" == nodes[i].className.substr(0, 4)) {
                    nodes[i].id = id + "-" + tree.length;
                    tree[tree.length] = new Array();
                    eval('nodes[i].onmouseover = function() { self.box2over("'+nodes[i].id+'", "'+nodes[i].className+'"); }');
                    eval('nodes[i].onmouseout = function() { self.box2out("'+nodes[i].id+'", "'+nodes[i].className+'"); }');
                }
            }
            if (this.highlightActive && nodes[i].tagName && nodes[i].tagName == "A") {
                if (document.location.href == nodes[i].href) {
                    nodes[i].className = (nodes[i].className ? ' active' : 'active')
                }
            }
            if (nodes[i].childNodes) {
                this.parse(nodes[i].childNodes, tree, id);
            }
        }
    }

    this.box1over = function(id) {
        if (!this.box1Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = (this.id_openbox == id ? "box1-open-hover" : "box1-hover");
    }

    this.box1out = function(id) {
        if (!this.box1Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = (this.id_openbox == id ? "box1-open" : "box1");
    }

    this.box1click = function(id) {
        if (!document.getElementById(id)) {
            return;
        }
        var id_openbox = this.id_openbox;
        if (this.id_openbox) {
            if (!document.getElementById(id + "-section")) {
                return;
            }
            this.hide();
            if (id_openbox == id) {
                if (this.box1hover) {
                    document.getElementById(id_openbox).className = "box1-hover";
                } else {
                    document.getElementById(id_openbox).className = "box1";
                }
            } else {
                document.getElementById(id_openbox).className = "box1";
            }
        }
        if (id_openbox != id) {
            this.show(id);
            var className = document.getElementById(id).className;
            if ("box1-hover" == className) {
                document.getElementById(id).className = "box1-open-hover";
            }
            if ("box1" == className) {
                document.getElementById(id).className = "box1-open";
            }
        }
    }

    this.box2over = function(id, className) {
        if (!this.box2Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = className + "-hover";
    }

    this.box2out = function(id, className) {
        if (!this.box2Hover) return;
        if (!document.getElementById(id)) return;
        document.getElementById(id).className = className;
    }

    this.show = function(id) {
        if (document.getElementById(id + "-section")) {
            document.getElementById(id + "-section").style.display = "block";
            this.id_openbox = id;
        }
    }

    this.hide = function() {
        document.getElementById(this.id_openbox + "-section").style.display = "none";
        this.id_openbox = "";
    }

    this.save = function() {
        if (this.id_openbox) {
            this.cookie.set(this.id, this.id_openbox);
        } else {
            this.cookie.del(this.id);
        }
    }

    this.load = function() {
        var id_openbox = this.cookie.get(this.id);
        if (id_openbox) {
            this.show(id_openbox);
            document.getElementById(id_openbox).className = "box1-open";
        }
    }

    function Cookie() {
        this.get = function(name) {
            var cookies = document.cookie.split(";");
            for (var i = 0; i < cookies.length; i++) {
                var a = cookies[i].split("=");
                if (a.length == 2) {
                    a[0] = a[0].trim();
                    a[1] = a[1].trim();
                    if (a[0] == name) {
                        return unescape(a[1]);
                    }
                }
            }
            return "";
        }
        this.set = function(name, value) {
            document.cookie = name + "=" + escape(value);
        }
        this.del = function(name) {
            document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
        }
    }

    var self = this;
    this.id = id;
    this.tree = new Array();
    this.cookie = new Cookie();
    this.id_openbox = "";
}

if (typeof String.prototype.trim == "undefined") {
    String.prototype.trim = function() {
        var s = this.replace(/^\s*/, "");
        return s.replace(/\s*$/, "");
    }
}


function copyright() {
var datum = new Date();
var rok = datum.getFullYear();
var copy = "";
//copy += "MS Internet Explorer 7+ | Opera 9.5+ | Mozilla Firefox 3+ | ";
//copy += "<a href='http://jigsaw.w3.org/css-validator/check/referer'>CSS 2.1</a> &amp; <a href='http://validator.w3.org/check/referer'>XHTML 1.0</a> | Všechna práva vyhrazena | © <a href='mailto:ORosenberg@seznam.cz'>Ondřej Rosenberg</a> 2009-";
//copy += rok;
copy += "Obec Újezd u Valašských Klobouk | Všechna práva vyhrazena | © <a href='mailto:ORosenberg@seznam.cz'>Ondřej Rosenberg</a> 2009-";
copy += rok;
copy += "<br />";
copy += "MS Internet Explorer 7+ | Opera 9.5+ | Mozilla Firefox 3+<br />";
copy += "<a href='http://jigsaw.w3.org/css-validator/check/referer'>CSS 2.1</a> &amp; <a href='http://validator.w3.org/check/referer'>XHTML 1.0</a>";
document.write(copy);
}

function dnesnidatum() {
var dnes = new Date(); // aktuální datum
var denVTydnu = new Array("neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota");
var mesicVRoce = new Array("ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince");
var retezec = "";
retezec += denVTydnu[dnes.getDay()] + ", ";
retezec += dnes.getDate() + ". ";
retezec += mesicVRoce[dnes.getMonth()] + " ";
retezec += dnes.getFullYear();
document.write(retezec);
}

function menu() {
document.write("<div id='bar-menu1' class='bar-menu'>");

document.write("<a class='menu_odkaz' href='index.php'><p class='box1'>Home</p></a>");

document.write("<p class='box1'>Historie<img src='images/arrow1.gif' alt='' width='11' height='11'></p>");
document.write("<div class='section'>");
document.write("<p class='box2'><a href='historie1.php'>Historie obce</a></p>");
document.write("<p class='box2'><a href='historie2.php'>Obec během druhé světové války</a></p>");
document.write("<p class='box2'><a href='historie3.php'>Obec v datech</a></p>");
document.write("<p class='box2'><a href='odkazy.php'>Kronika obce</a></p>");
document.write("</div>");

document.write("<p class='box1'>Informace<img src='images/arrow1.gif' width='11' height='11' alt=''></p>");
document.write("<div class='section'>");
/*document.write("<p class='box2'><a href='aktuality.php'>Aktuálně</a></p>");
document.write("<p class='box2'><a href='uredni_deska.php'>Úřední deska</a></p>");*/
document.write("<p class='box2'><a href='zastupitelstvo.php'>Zastupitelstvo</a></p>");
document.write("<p class='box2'><a href='nas_mapovy_portal.php'>Náš mapový portál</a></p>");
document.write("<p class='box2'><a href='uzemni_plan.php'>Územní plán</a></p>")
document.write("<p class='box2'><a href='odkazy.php'>Jízdní řád</a></p>");
document.write("<p class='box2'><a href='oteviraci_doby.php'>Otevírací doby</a></p>");
document.write("<p class='box2'><a href='komunalni_odpad.php'>Komunální odpad</a></p>");
document.write("</div>");

document.write("<p class='box1'>Zajímavosti<img src='images/arrow1.gif' width='11' height='11' alt=''></p>");
document.write("<div class='section'>");
document.write("<p class='box2'><a href='kostel.php'>Kostel sv. Mikuláše</a></p>");
document.write("<p class='box2'><a href='socha.php'>Socha sv. Jana Nepomuckého</a></p>");
document.write("<p class='box2'><a href='hradisko.php'>Hradisko</a></p>");
document.write("<p class='box2'><a href='fasanky.php'>Fašanky</a></p>");
document.write("</div>");

document.write("<p class='box1'>Volný čas<img src='images/arrow1.gif' width='11' height='11' alt=''></p>");
document.write("<div class='section'>");
document.write("<p class='box2'><a href='odkazy.php'>Kino</a></p>");
document.write("<p class='box2'><a href='http://www.knihovnaujezduklobouk.wz.cz/'>Knihovna</a></p>");
document.write("<p class='box2'><a href='vlek.php'>Lyžařský areál</a></p>");
document.write("<p class='box2'><a href='koupaliste.php'>Areál koupaliště</a></p>");
document.write("<p class='box2'><a href='http://www.skujezd.estranky.cz/'>TJ Sokol</a></p>");
document.write("<p class='box2'><a href='http://www.sdhujezd.wz.cz/'>Hasiči</a></p>");
document.write("</div>");

document.write("<a class='menu_odkaz' href='fotogalerie.php'><p class='box1'>Fotogalerie</p></a>");

document.write("<p class='box1'>Odkazy<img src='images/arrow1.gif' width='11' height='11' alt=''></p>");
document.write("<div class='section'>");
document.write("<p class='box2'><a href='http://www.jiznivalassko.cz/'>Jižní Valašsko</a></p>");
document.write("<p class='box2'><a href='http://www.mas.plostina.cz/'>Mikroregion Ploština</a></p>");
document.write("<p class='box2'><a href='http://www.zsujezd.cz/'>Základní škola</a></p>");
document.write("<p class='box2'><a href='http://www.materskaskolaujezd.estranky.cz/'>Mateřská škola</a></p>");
document.write("</div>");

document.write("<div class='stuhy'><img src='images/zlatastuha.gif' width='120' height='30' alt='Zlatá stuha' />");
document.write("<img src='images/modrastuha.gif' width='120' height='30' alt='Modrá stuha' />");
document.write("<img src='images/bilastuha.gif' width='120' height='30' alt='Bílá stuha' /></div>");
document.write("</div>");

var barMenu1 = new BarMenu('bar-menu1');
barMenu1.init();
}

function runClock() {
today   = new Date();
hours   = today.getHours();
minutes = today.getMinutes();
seconds = today.getSeconds();
timeValue = hours;
timeValue += ((minutes <10) ? ".0" : ".") + minutes;
timeValue += ((seconds <10) ? ":0" : ":") + seconds;
document.getElementById('hodiny').innerHTML = timeValue+".";
window.setTimeout("runClock()",1000);
}


function copyright_admin() {
var dnes = new Date(); // aktuální datum
var denVTydnu = new Array("Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota");
var mesicVRoce = new Array("ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince");

var retezec = "<div id='zapati'>";
retezec += denVTydnu[dnes.getDay()] + " ";
retezec += dnes.getDate() + ". ";
retezec += mesicVRoce[dnes.getMonth()] + " ";
retezec += dnes.getFullYear();
retezec += " | <a href='http://jigsaw.w3.org/css-validator/check/referer'>CSS 2.1</a> &amp; <a href='http://validator.w3.org/check/referer'>XHTML 1.0</a> | <a href='index.php'>Administrace</a> | Všechna práva vyhrazena | © <a href='mailto:ORosenberg@seznam.cz'>Ondřej Rosenberg</a> ";
retezec += dnes.getFullYear() + "</div>";
document.write( retezec );
}



