﻿// JScript source code

function panelOn(i) {
    var temp = "panel_box" + i;
    var templink = "panel_link" + i;
    
    if(document.getElementById(temp.toString()).style.display.indexOf("block") != -1)
    {
        document.getElementById(temp.toString()).style.display = 'none';
        document.getElementById(templink.toString()).setAttribute("class", "panel_link");
    }
    else
    {
        panelsOff();
        
        document.getElementById(temp.toString()).style.display = 'block';

        linkOn(i);
    }
}
function panelsOff() {

    var colpanels = getElementsByClass('panel_box');
    if (colpanels != null);
    {
        for (i = 1; i <= colpanels.length; i++) {
            //colpanels[i - 1].setAttribute("class", "panel_link");
            colpanels[i - 1].style.display = 'none';
        }
    }
}


//..............................................................................
function linkOn(i) {

    linksOff();

    var temp = "panel_link" + i;
    document.getElementById(temp.toString()).setAttribute("class", "panel_link_active");
}
function linksOff() {
    var collinks = getElementsByClass('panel_link_active');
    if (collinks != null);
    {
        for (i = 1; i <= collinks.length; i++) {
            collinks[i - 1].setAttribute("class", "panel_link");
        }
    }
}


function closePanel()
{
    panelsOff();
    linksOff();
}

//..........................................................................................................................page

function pageOn(i) {
    pagesOff();

    var temp = "page_box" + i;
    document.getElementById(temp.toString()).style.display = 'block';

    PageLinkOn(i);
}
function pagesOff() {

    var colpanels = getElementsByClass('page_box');
    if (colpanels != null);
    {
        for (i = 1; i <= colpanels.length; i++) {
            //colpanels[i - 1].setAttribute("class", "panel_link");
            colpanels[i - 1].style.display = 'none';
        }
    }
}


//..............................................................................
function PageLinkOn(i) {

    PageLinksOff();

    var temp = "page_link" + i;
    document.getElementById(temp.toString()).setAttribute("class", "page_link_active");
}
function PageLinksOff() {
    var collinks = getElementsByClass('page_link_active');
    if (collinks != null);
    {
        for (i = 1; i <= collinks.length; i++) {
            collinks[i - 1].setAttribute("class", "page_link");
        }
    }
}



//..........................................................................................................................page

function contentOn(i) {

    var temp = "content_box" + i;
    var templink = "content_link" + i;
    
    if(document.getElementById(temp.toString()).style.display.indexOf("block") != -1)
    {
        document.getElementById(temp.toString()).style.display = 'none';
        document.getElementById(templink.toString()).setAttribute("class", "content_link");
    }
    else
    {
        contentsOff();

        document.getElementById(temp.toString()).style.display = 'block';

        contentLinkOn(i);
    }

}
function contentsOff() {

    var colpanels = getElementsByClass('content_box');
    if (colpanels != null);
    {
        for (i = 1; i <= colpanels.length; i++) {
            //colpanels[i - 1].setAttribute("class", "panel_link");
            colpanels[i - 1].style.display = 'none';
        }
    }
}


//..............................................................................
function contentLinkOn(i) {

    contentLinksOff();

    var temp = "content_link" + i;
    document.getElementById(temp.toString()).setAttribute("class", "content_link_active");
}
function contentLinksOff() {
    var collinks = getElementsByClass('content_link_active');
    if (collinks != null);
    {
        for (i = 1; i <= collinks.length; i++) {
            collinks[i - 1].setAttribute("class", "content_link");
        }
    }
}




//......................................................................

function closeContent()
{
    contentsOff();
    contentLinksOff();
}





//......................................................................
function getElementsByClass(searchClass, domNode, tagName) {
    if (domNode == null) domNode = document;
    if (tagName == null) tagName = '*';

    var el = new Array();
    var tags = domNode.getElementsByTagName(tagName);
    var tcl = " " + searchClass + " ";

    for (i = 0, j = 0; i < tags.length; i++) {
        var test = " " + tags[i].className + " ";
        if (test.indexOf(tcl) != -1)
            el[j++] = tags[i];
    }
    return el;
}

