// JavaScript Document

//Written by Jonathan Snook, http://www.snook.ca/jonathan
//Add-ons by Robert Nyman, http://www.robertnyman.com
function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
            }
        }
    return (arrReturnElements)
    }


function showinfo(id) {
        //set all infoarea divs to display: none
        var thedivs = new Array();
        //get all div elements within the element named “infowrapper”, with a “infoarea” class.
        thedivs  = getElementsByClassName(document.getElementById("infowrapper"), "div", "infoarea");        
        //alert(thedivs.length);
        for (x in thedivs)
        {
            thedivs[x].style.display = 'none';
        }

        //set display: block for the selected div
        var td = document.getElementById(id);
        if (td) 
        {
            td.style.display = 'block';
        } 
    }  
    

    
    

//Creates a new div inside infowrapper
/*
function createinfo(id, description)
    {
        //remove the current infoarea div if it exists
        var ta = document.getElementById('infowrapper')
        if (ta) 
        {
            var ia = document.getElementById('infoarea')
                if (ia)
                {
                ta.removeChild(ia);
                }
        }
        //create the new infoarea div
        var newdiv = document.createElement('div');
        var divIdName = 'infoarea';
        newdiv.setAttribute('id',divIdName);
        newdiv.innerHTML = '<h1>' + id + '</h1><p>' + description + '</p>';
        ta.appendChild(newdiv);
        
    }  
*/ 