﻿/* ************************************************************************************ */
/* LinkTicker Control Javascript Support                                                */
/* ---> Requires jQuery library                                                         */
/* ************************************************************************************ */
/* Change Log                                                                           */
/*                                                                                      */
/* 15-09-2009  - Richard Chapman - Deltasoft - Create Timer init, tick and callback     */
/*                                             complete functions to support LinkTicker */
/* ************************************************************************************ */
function LTclitimer_init(s,e)
{
// Force the first link to be displayed
LTclicallback.PerformCallback('GET');

// Now set a 4 second timer for the link scrolling
LTclitimer.SetInterval(4000);
LTclitimer.SetEnabled(true);

// Set up a function to ensure that when the mouse hovers over the link, the ticker stops scrolling, starting again on mouseout
jQuery('div.LinkTicker').hover(function(){LTclitimer.SetEnabled(false);},function(){LTclitimer.SetEnabled(true);});
}

function LTclitimer_tick(s,e)
{
var ltidiv = jQuery('div.LinkTickerInner');

// Scroll the link up by the height of the div + 5px, then reset the div below ready to scroll up into view when callback complete
// is called. Finally perform the callback to collect the link text
ltidiv.animate({top: -(ltidiv.height()+5)},'slow',function(){ltidiv.css({top: (ltidiv.height()+5)}); LTclicallback.PerformCallback('GET');});
}

function LTclicallback_complete(s,e)
{
var ltidiv = jQuery('div.LinkTickerInner');

// Put the returned text in the div if there is something to display
if (e.result !== '') 
   {
   ltidiv.html(e.result);
   }

// Now scroll the div (new link) into view
ltidiv.animate({'top': '0px'}, 'slow');
}

