﻿var MasterJS = {


init: function() {
    
        // För att undvika att gamla webbläsare försöker exekvera koden.		
        if (!document.getElementById) return;


        var aNodes;
        var ulNodes = document.getElementsByTagName("ul");
        for (var i = 0; i < ulNodes.length; ++i) {
            aNodes = ulNodes.getElementsByTagName("a");
            for (var i2 = 0; i < aNodes.length; ++i)
                aNodes[i2].onmouseover = MasterJS.mouseOverMeny;

        }
   
    },
    // Exempel 4 och 5
    mouseOverMeny: function() {

        this.style.color = "#791E75";
        return false;
    }
}
window.onload = MasterJS.init;
    

    function P7_colH2() { //v2.1.0 by PVII-www.projectseven.com
        var i, oh, h = 0, tg, el, np, dA = document.p7eqc, an = document.p7eqa; if (dA && dA.length) {
            for (i = 1; i < dA.length; i += 2) { dA[i + 1].style.paddingBottom = ''; } for (i = 1; i < dA.length; i += 2) {
                oh = dA[i].offsetHeight; h = (oh > h) ? oh : h;
            } for (i = 1; i < dA.length; i += 2) {
                oh = dA[i].offsetHeight;
                if (oh < h) {
                    np = h - oh; if (!an && dA[0] == 1) { P7_eqA2(dA[i + 1].id, 0, np); } else {
                        dA[i + 1].style.paddingBottom = np + "px";
                    } 
                } 
            } document.p7eqa = 1;
            document.p7eqth = document.body.offsetHeight;
            document.p7eqtw = document.body.offsetWidth;



        }
    }
    function P7_eqT2() { //v2.1.0 by PVII-www.projectseven.com
        if (document.p7eqth != document.body.offsetHeight || document.p7eqtw != document.body.offsetWidth) { P7_colH2(); }
    }
    function P7_equalCols2() { //v2.1.0 by PVII-www.projectseven.com
try
  {
        var c, e, el; if (document.getElementById) {
            document.p7eqc = new Array();
            document.p7eqc[0] = arguments[0]; for (i = 1; i < arguments.length; i += 2) {
                el = null;
                c = document.getElementById(arguments[i]); if (c) {
                    e = c.getElementsByTagName(arguments[i + 1]);
                    if (e) { el = e[e.length - 1]; if (!el.id) { el.id = "p7eq" + i; } } 
                } if (c && el) {
                    document.p7eqc[document.p7eqc.length] = c; document.p7eqc[document.p7eqc.length] = el
                } 
            }
            setInterval("P7_eqT2()", 1);

        }
  }
catch(err)
  {
	return;
  }

    }
    function P7_eqA2(el, p, pt) { //v2.1.0 by PVII-www.projectseven.com
        var sp = 10, inc = 20, g = document.getElementById(el); np = (p >= pt) ? pt : p;
        g.style.paddingBottom = np + "px"; if (np < pt) {
            np += inc;
            setTimeout("P7_eqA2('" + el + "'," + np + "," + pt + ")", sp);
        }
    }

    // start by getting all the questions and answers
    // these will be put into arrays

    var questions = document.getElementsByTagName('dt');
    var answers = document.getElementsByTagName('dd');


    // function for the link that turns them all off
    function toggleAllOff() {
        for (var i = 0; i < answers.length; i++) {
            answers[i].className = 'hide';
        }
    }

    // function for the link that turns them all on
    function toggleAllOn() {
        for (var i = 0; i < answers.length; i++) {
            answers[i].className = 'show';
        }

    }


    function toggleNext(el) {
        var next = el.nextSibling;

        next.style.display = ((next.style.display == "none") ? "block" : "none");
    }


    //makes the definition lists click-able
    function displayToggle() {

        toggleAllOff(); // calls the toggle all off function to turn all the answers off when the page is loaded
        for (i = 0; i < questions.length; i++) { // loops through the questions a
            questions[i].onclick = function() { // shows the answers onclick
                var next = this.nextSibling;
                while (next.nodeType != 1) next = next.nextSibling; // if it gets to a non-element node, go to the next one
                next.className = ((next.className == "hide") ? "show" : "hide");
            }
        }
    }


