$(function() {

    var tickerText = "Calling all enigma morph leopard gecko keepers &hellip;  Click here for information on Phase II of the Enigma Syndrome Study (TESS)";

    if(window.location == 'http://gecko.ignominious.org/tess.html') {
        $('#main').css('margin-top', '6em');
    } else  {
        $('#top').after('<div id="ticker"><span id="ticker-text">' + tickerText + '</span></div>');
        $('#ticker').css('margin-top', '6em');
        $('#main').css('margin-top', '1em');
        $('#ticker').click(function() {
            window.location='http://gecko.ignominious.org/tess.html';
        });
        reset();
    }
});

function transit()  {
    var boxWidth = $('#ticker').width();
    var textWidth = $('#ticker-text').width();
    var period = boxWidth * 15;
    $('#ticker-text').animate({'margin-left': - textWidth}, period, 'linear', reset);
}

function reset()    {
    var boxWidth = $('#ticker').width();
    $('#ticker-text').css('margin-left', boxWidth);
    transit();
}

