function fruit(targetID)
{
    var tDiv = document.getElementById(targetID);
    
    tDiv.innerHTML += 'BOOYAH';
}

/**
    Used by the voting button to submit information to pollProcess.cfc
*/
function jsSubmitPoll(formName, companyID, containerID, optionName, pollDiv)
{
    var optionValue = '';
    
    //get the option value that was voted on
    for(var i=0; i<optionName.length; i++)
    {
        if(optionName[i].checked)
            optionValue = optionName[i].value;
    }
    
    //make the request if the value is set and an option is checked
    //otherwise warn the user that they need to select an option before voting
    if(!optionName.checked && optionValue)
    {
        jsAjaxOutputToDiv('./pollProcess.cfm?cp=' + companyID + '&ct=' + containerID + '&op=' + optionValue, pollDiv);
    }
    else
    {
        alert('You must select an option before voting.');
        return false;
    }
    return true;
}

/**
    Make an ajax request to a page and place the result in the container with ID targetID
*/
function jsAjaxOutputToDiv(url, targetID)
{
    //get the container to fill with content
    var ajaxTarget = document.getElementById(targetID);
    
    //if the container does not exist, we can't load content into it, so quit
    if(!ajaxTarget)
        return false;
    
    //depending on the browser, make a different request object
    if(window.XMLHttpRequest)
    {
        http_request = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
        http_request = new ActiveXObject('Microsoft.XMLHTTP');
    }
    
    //make the asynchronous request
    http_request.onreadystatechange = function ()
    {
        if(http_request.readyState == 4)
        {
            if(http_request.status == 200)
            {
                //override the HTML of the container
                ajaxTarget.innerHTML = http_request.responseText;
            }
            else
            {
                //we have failed let the user know
                ajaxTarget.innerHTML = http_request.responseText;
            }
        }
    };
    http_request.open('POST', url + '', true);
    http_request.send(url);
}
