$(document).ready(function() {
    var scriptTag = document.createElement("script");
    var random = Math.floor(Math.random() * 9999999).toString();
    scriptTag.id = "mixcnt" + random;
    scriptTag.setAttribute("type", "text/javascript");
    scriptTag.setAttribute("src", "http://train.nextfit.com/lab/web_data/new_year_resolutions??" + random);
    $("head")[0].appendChild(scriptTag);

    $("#resolution-ticker").bxSlider({
        mode: "fade",
        speed: 1250,
        pause: 5000,
        width: 750,
        height: 40,
        wrapper_class: 'resolutions'
    });
			
    $(".slideshow").cycle({
        mode: "fade",
        speed: 1250,
        pause: 5000
    });
});

function setResolutions(dataText) {
    var data = eval(dataText);
    $.each(data, function(i, item) {
        var firstName = item.user.user_account.first_name;
        firstName = firstName.charAt(0).toUpperCase() + firstName.substring(1).toLowerCase() + " ";
        var lastInitial = item.user.user_account.last_name.charAt(0).toUpperCase() + ".";
        
        $("<li>").html("<a href='2010resolutions.html'>" + firstName + lastInitial + ' - ' +item.musing + "</a>").appendTo("#resolution-ticker");
    });
} 