// define a namespace to hold our widget specific functions,
// avoid polluting the global namespace
var pickupTruck = pickupTruck || {};

pickupTruck.vote = function ( id )
{
    document.getElementById("vote_link").className = "goodOneThanks";
    document.getElementById("vote_link").href = "#";
    document.getElementById("spam_link").href = "#";
    
    var xhr = new XMLHttpRequest ();
    xhr.onreadystatechange = function ()
    {
        if ( this.readyState == 4 )
        {
            switch ( this.status )
            {
                case 200:
                    break;
                case 400:
                    break;
            }
        }
    }   
    xhr.open( 'GET', 'http://www.thepickuptruck.com/pickups/vote/' + id, false );
    xhr.send();
}

pickupTruck.spam = function ( id )
{
    document.getElementById("spam_link").className = "spamThanks";
    document.getElementById("vote_link").href = "#";
    document.getElementById("spam_link").href = "#";

    var xhr = new XMLHttpRequest ();
    xhr.onreadystatechange = function ()
    {
        if ( this.readyState == 4 )
        {
            switch ( this.status )
            {
                case 200:
                    document.getElementById("spam_link").innerHTML = "Thanks";
                    break;
                case 400:
                    break;
            }
        }
    }   
    xhr.open( 'GET', 'http://www.thepickuptruck.com/pickups/spam/' +id, false );
    xhr.send();
}
