﻿// shows small product next to menu
function showProduct(str)
{
    
}

// carousel functionalities
var max = 3;
var cur = 2;

function slide(id)
{
    var currTabElem

    reset()
    
    currTabElem = document.getElementById("slide0" + id);
    currTabElem.style.visibility = "visible";

    currTabElem = document.getElementById("href_0" + id);
    currTabElem.setAttribute("class", "href_0" + id + "_on");
    currTabElem.setAttribute("className", "href_0" + id + "_on");
}

function reset()
{
    var i=0;
    var currTabElem;
    
    for (i=1; i<=3; i++)
    {
        currTabElem = document.getElementById("slide0" + i);
        currTabElem.style.visibility = "hidden";
    
        currTabElem = document.getElementById("href_0" + i);
        currTabElem.setAttribute("class", "href_0" + i + "_off");
        currTabElem.setAttribute("className", "href_0" + i + "_off");
    }
}

function rotateSlide()
{
    if (cur > 3) cur = 1;
    
    slide(cur);
    cur = cur + 1;
}

// timeline functionalities
function selectYear(id)
{
    var currTabElem;
    
    currTabElem = document.getElementById(id);
    currTabElem.setAttribute("class", "historyselected");
    currTabElem.setAttribute("className", "historyselected");
    
    alert(id);
}

function toggleAccordion(url, id, max)
{   
    var currTabElem;
    var tag;
    
    // comparison should be changed to substring
    
    for (var i=1; i<= max; i++)
    {
        currTabElem = document.getElementById("imgAccordion" + i);
        if (i == id)
        {
            tag = currTabElem.src.substring((currTabElem.src.length - 8) ,currTabElem.src.length);
        
            if (tag == "inus.jpg")
            {
                currTabElem.src = url + "resources/images/professionals/plus.jpg";
            }
            else
            {
                currTabElem.src = url + "resources/images/professionals/minus.jpg";
            }
        }
        else
        {
            currTabElem.src = url + "resources/images/professionals/plus.jpg";    
        }
    }
}
