// Set navigation menu

var sfHover = function() {
    //set hovers 
    if (document.getElementById("navMenu")) {
        if ((/msie 6/i.test(navigator.userAgent)) || (/msie 7/i.test(navigator.userAgent)))
        //if ((/msie 6/i.test(navigator.userAgent))) 
        {
            // iframe coverage for IE6 and below
            var frm = document.createElement("iframe");
            frm.className = "cover-frm";
            frm.frameBorder = 0;
            //frm.src = "/Error.aspx";
            frm.src = "/templates/Content_Page/Blank.aspx";
            document.getElementById("wrapper").appendChild(frm);

            var sfEls = document.getElementById("navMenu").getElementsByTagName("li");
            for (var i = 0; i < sfEls.length; i++) {
                sfEls[i].onmouseover = function() {
                    ClassName.remove(this, "closed");
                    ClassName.add(this, "open");
                };
                sfEls[i].onmouseout = function() {
                    ClassName.remove(this, "open");
                    ClassName.add(this, "closed");
                };
            }

            var links = document.getElementById("navMenu").getElementsByTagName("a");
            for (var j = 0; j < links.length; j++) {
                if (links[j].className.indexOf('topItem') == -1) {
                    links[j].style.filter = 'alpha(opacity: 85)';
                    links[j].onmouseover = function() { this.style.filter = 'alpha(opacity: 100)'; };
                    links[j].onmouseout = function() { this.style.filter = 'alpha(opacity: 85)'; };
                }
                else {
                    links[j].style.filter = 'alpha(opacity: 100)';
                }
            }
        }
    }
};
//if (window.attachEvent) window.attachEvent("onload", sfHover);

EventListener.addEvent(window, "load", function() {
    sfHover();
});


/*******
** vp - ClassName module - (c) Indivirtual 2008 - 1.0 **	
*******/

var ClassName = {
    add: function(node, name) {
        if (!this.contains(node, name)) node.className += ' ' + name;
    },

    remove: function(node, name) {
        if (node.className)
            node.className = node.className.replace(new RegExp('(^|\\s)' + name + '(\\s|$)', 'g'), '');
        node.className = node.className.replace(' ' + name, '');
    },

    contains: function(node, name) {
        return new RegExp('(^|\\s)' + name + '(\\s|$)').test(node.className);
    },

    swap: function(node, old, name) {
        node.className = this.contains(node, old) ?
			node.className.replace(new RegExp('(^|\\s)' + old + '(\\s|$)', 'g'), '$1' + name + '$2') :
			node.className.replace(new RegExp('(^|\\s)' + name + '(\\s|$)', 'g'), '$1' + old + '$2');
    },

    toggle: function(node, name) {
        if (!this.contains(node, name)) {
            this.add(node, name);
        }
        else {
            this.remove(node, name);
        }
    }
};


