﻿// clear content value of the obj passed: search text box
function clearContent(obj)
{
    obj.value = '';
}

// update all font size for <p> tags under <div name="content_text">
// updates the toggle image
function toggleText(path)
{
    // swap text size
    var p = document.getElementById('content_text').getElementsByTagName('p');
    
    // loop through all P
    for(i=0;i<p.length;i++) {
        // if it's been defined
        if ((p[i].style.fontSize == "") || (p[i].style.fontSize == "12px"))
        {
            p[i].style.fontSize = "14px";
           // document.getElementsByName('lnkText')[0].style.backgroundImage = "url('" + path + "resources/images/templates/text_button_down.jpg')";
        }
        else
        {
            p[i].style.fontSize = "12px";
           // document.getElementsByName('lnkText')[0].style.backgroundImage = "url('" + path + "resources/images/templates/text_button_up.jpg')";
        }
    }
    
    // swap text size
    var li = document.getElementById('content_text').getElementsByTagName('li');
    
    // loop through all LI
    for(i=0;i<li.length;i++) {
        // if it's been defined
        if ((li[i].style.fontSize == "") || (li[i].style.fontSize == "12px"))
        {
            li[i].style.fontSize = "14px";
        }
        else
        {
            li[i].style.fontSize = "12px";
        }
    }
}

// default submit delegator
function keyPress(evt, clientID)
{
    if(evt.which || evt.keyCode)
    {
        // applies to only ENTER key
        if((evt.which == 13) || (evt.keyCode == 13))
        {
            location = document.getElementById(clientID).href;
            return false;
        }
        return true;
    }
}

// return height of document
function footerRelocate()
{
    // docY = document size
    // winY = window size
    // obj = obj of footer bg

    var docY = document.body.offsetHeight;
    var winY = document.documentElement.clientHeight;
    var obj = document.getElementById('footerbg');
    
    if (docY < (winY - 50))
    {
        obj.style.position = 'absolute';
    } else
    {
        obj.style.position = 'relative';
    }
}