//=============================================================================
// file: js.js
// auth: nick 06/05/05
// desc: the javascript for trademarkroom
//=============================================================================

// init vars
var currentDetails = false;

//==========================================================
// func: details(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 details(id)
{
    // check for no existing details
    if (!currentDetails)
    {
        // show the new details
        showDetails(id);
        
        // set the current details
        currentDetails = id;
    }
    else if (currentDetails != id)
    {
        // hide the current details
        hideDetails(currentDetails);
        
        // show the new details
        showDetails(id);
        
        // set the current details
        currentDetails = id;
    }
    else
    {
        // hide the details
        hideDetails(id);
        
        // set the currentDetails
        currentDetails = false;
    }
}

//==========================================================
// func: showDetails(id)
// auth: nick 06/05/05
// desc: turns on given details
// args: id - the id of the details to alter
// retn: none
//==========================================================
function showDetails(id)
{
    // show the details
    document.getElementById('classDetails' + id).style.display = 'block';
    
    // change the image and text
    document.getElementById('classImage' + id).src   = '/img/buttonMinus.gif';
    document.getElementById('classImage' + id).alt   = 'Click here to hide details';
    document.getElementById('classImage' + id).title = 'Click here to hide details';
}

//==========================================================
// func: hideDetails(id)
// auth: nick 06/05/05
// desc: turns off given details
// args: id - the id of the details to alter
// retn: none
//==========================================================
function hideDetails(id)
{
    // show the details
    document.getElementById('classDetails' + id).style.display = 'none';
    
    // change the image and text
    document.getElementById('classImage' + id).src   = '/img/buttonExpand.gif';
    document.getElementById('classImage' + id).alt   = 'Click here to view more details';
    document.getElementById('classImage' + id).title = 'Click here to view more details';
}

//==========================================================
// func: openAssistance()
// auth: nick 19/05/05
// desc: opens the assistance popup
// args: none
// retn: none
//==========================================================
function openAssistance()
{
    // store the id needed
    var assistance = document.getElementById('country').value;
    
    // open the assistance popup window
    window.open('/assistance.php?id=' + assistance, 'trademarkRoomAssistance', 'status=1,toolbar=0,menubar=0,location=0,directories=0,resizable=1,scrollbars=1,width=400,height=500'); 
}

//==========================================================
// func: autofill(id)
// auth: nick 06/09/05
// desc: autofill the data
// args: none
// retn: none
//==========================================================
function autofill(id)
{
    if (document.getElementById(id).value == "")
        document.getElementById(id).value = 'No Trademark Entered';
}