//=============================================================================
// file: js.js
// auth: nick 23/09/05
// desc: the javascript for schneider ross
//=============================================================================

// init vars
var currentFaq = false;
var currentId  = '';

//==========================================================
// func: faq(id)
// auth: nick 06/05/05
// desc: turns on and off the given details
// args: id - the id of the details to alter
// retn: none
//==========================================================
function faq(id)
{
    // check for no existing details
    if (!currentFaq)
    {
        // show the new details
        showFaq(id);
        
        // set the current details
        currentFaq = id;
    }
    else if (currentFaq != id)
    {
        // hide the current details
        hideFaq(currentFaq);
        
        // show the new details
        showFaq(id);
        
        // set the current details
        currentFaq = id;
    }
    else
    {
        // hide the details
        hideFaq(id);
        
        // set the currentDetails
        currentFaq = false;
    }
}

//==========================================================
// func: showFaq(id)
// auth: nick 06/05/05
// desc: turns on given details
// args: id - the id of the details to alter
// retn: none
//==========================================================
function showFaq(id)
{
    // show the details
    document.getElementById('faqAnswer' + id).style.display = 'block';
    
    // change the image and text
    document.getElementById('faqImage' + id).src      = '/img/buttonMinus.gif';
    document.getElementById('faqImage' + id).alt      = 'Click here to hide the answer.';
    document.getElementById('faqImage' + id).title    = 'Click here to hide the answer.';
    document.getElementById('faqQuestion' + id).title = 'Click here to hide the answer.';
}

//==========================================================
// func: hideFaq(id)
// auth: nick 06/05/05
// desc: turns off given details
// args: id - the id of the details to alter
// retn: none
//==========================================================
function hideFaq(id)
{
    // show the details
    document.getElementById('faqAnswer' + id).style.display = '';
    
    // change the image and text
    document.getElementById('faqImage' + id).src      = '/img/buttonExpand.gif';
    document.getElementById('faqImage' + id).alt      = 'Click here to view the answer.';
    document.getElementById('faqImage' + id).title    = 'Click here to view the answer.';
    document.getElementById('faqQuestion' + id).title = 'Click here to view the answer.';
}