Type.registerNamespace('Viagogo'); Viagogo.TickerControl = function(element) { Viagogo.TickerControl.initializeBase(this, [element]); this._canvasControlId = null; this._tickerServiceUrl = null; this._tickerServiceMethod = null; this._tickerScrollTimeout = null; this._tickerScrollIncrement = null; this._maxScrolls = null; this._currentCanvasPosition = null; this._tickerWidth = null; this._currentScrollCount = null; this._tickerScrollTimerTickHandler = null; this._tickerScrollTimer = null; } function Viagogo$TickerControl$_callTickerService() { var params = new Object(); if (!this._tickerServiceUrl || !this._tickerServiceMethod) { return; } this._stopTickerScroller(); Sys.Net.WebServiceProxy.invoke( this._tickerServiceUrl, this._tickerServiceMethod, false, params, Function.createDelegate(this, this._onTickerServiceComplete), Function.createDelegate(this, this._onTickerServiceFailed)); } function Viagogo$TickerControl$_initializeTickerScroller() { this._tickerScrollTimerTickHandler = Function.createDelegate(this, this._onTickerScrollTimerTick); this._tickerScrollTimer = new Sys.Timer(); this._tickerScrollTimer.set_interval(this._tickerScrollTimeout); this._tickerScrollTimer.add_tick(this._tickerScrollTimerTickHandler); this._stopTickerScroller(); } function Viagogo$TickerControl$_startTickerScroller() { this._tickerScrollTimer.set_enabled(true); } function Viagogo$TickerControl$_stopTickerScroller() { this._tickerScrollTimer.set_enabled(false); } function Viagogo$TickerControl$_resetCanvasPosition() { this._currentCanvasPosition = 0; this._updateCanvasPosition(); } function Viagogo$TickerControl$_updateCanvasPosition() { this.get_element().scrollLeft = (this._currentCanvasPosition * -1); } function Viagogo$TickerControl$_iterateScroll() { this._currentScrollCount++; if (this._currentScrollCount > this._maxScrolls) { this._stopTickerScroller(); this._callTickerService(); } this._resetCanvasPosition(); this._startTickerScroller(); } function Viagogo$TickerControl$_onTickerServiceComplete(results) { this._currentScrollCount = 0; if (results.substring(0, 1) == "{") { var max = parseInt(results.substring(1, results.indexOf("}", 1)), 10); if (max > 0) { this.set_maxScrolls(max); } results = results.substring(results.indexOf("}", 0) + 1); } $get(this._canvasControlId).innerHTML = results; this._iterateScroll(); } function Viagogo$TickerControl$_onTickerServiceFailed(args) { Sys.Debug.traceDump(args); } function Viagogo$TickerControl$_onTickerScrollTimerTick() { this._currentCanvasPosition -= this._tickerScrollIncrement; var canvasWidth = $get(this._canvasControlId).scrollWidth; if (this._currentCanvasPosition < ((canvasWidth - this._tickerWidth) * -1)) { this._iterateScroll(); } else { this._updateCanvasPosition(); } } function Viagogo$TickerControl$initialize() { Viagogo.TickerControl.callBaseMethod(this, 'initialize'); this._initializeTickerScroller(); this._callTickerService(); this._tickerWidth = ViagogoAjax.WindowHelper.getElementWidth(this.get_element()); $get(this._canvasControlId).style.paddingLeft = this._tickerWidth + 'px'; $get(this._canvasControlId).style.paddingRight = this._tickerWidth + 'px'; } function Viagogo$TickerControl$dispose() { if (this._tickerScrollTimer) this._tickerScrollTimer.dispose(); Viagogo.TickerControl.callBaseMethod(this, 'dispose'); } function Viagogo$TickerControl$get_canvasControlId() { return this._canvasControlId } function Viagogo$TickerControl$set_canvasControlId(value) { if (this._canvasControlId != value) { this._canvasControlId = value; this.raisePropertyChanged('canvasControlId'); } } function Viagogo$TickerControl$get_tickerServiceUrl() { return this._tickerServiceUrl; } function Viagogo$TickerControl$set_tickerServiceUrl(value) { if (this._tickerServiceUrl != value) { this._tickerServiceUrl = value; this.raisePropertyChanged('tickerServiceUrl'); } } function Viagogo$TickerControl$get_tickerServiceMethod() { return this._tickerServiceMethod; } function Viagogo$TickerControl$set_tickerServiceMethod(value) { if (this._tickerServiceMethod != value) { this._tickerServiceMethod = value; this.raisePropertyChanged('tickerServiceMethod'); } } function Viagogo$TickerControl$get_tickerScrollTimeout() { return this._tickerScrollTimeout; } function Viagogo$TickerControl$set_tickerScrollTimeout(value) { if (this._tickerScrollTimeout != value) { this._tickerScrollTimeout = value; this.raisePropertyChanged('tickerScrollTimeout'); } } function Viagogo$TickerControl$get_tickerScrollIncrement() { return this._tickerScrollIncrement; } function Viagogo$TickerControl$set_tickerScrollIncrement(value) { if (this._tickerScrollIncrement != value) { this._tickerScrollIncrement = value; this.raisePropertyChanged('tickerScrollIncrement'); } } function Viagogo$TickerControl$get_maxScrolls() { return this._maxScrolls; } function Viagogo$TickerControl$set_maxScrolls(value) { if (this._maxScrolls != value) { this._maxScrolls = value; this.raisePropertyChanged('maxScrolls'); } } Viagogo.TickerControl.prototype = { get_canvasControlId: Viagogo$TickerControl$get_canvasControlId, set_canvasControlId: Viagogo$TickerControl$set_canvasControlId, get_tickerServiceUrl: Viagogo$TickerControl$get_tickerServiceUrl, set_tickerServiceUrl: Viagogo$TickerControl$set_tickerServiceUrl, get_tickerServiceMethod: Viagogo$TickerControl$get_tickerServiceMethod, set_tickerServiceMethod: Viagogo$TickerControl$set_tickerServiceMethod, get_tickerScrollTimeout: Viagogo$TickerControl$get_tickerScrollTimeout, set_tickerScrollTimeout: Viagogo$TickerControl$set_tickerScrollTimeout, get_tickerScrollIncrement: Viagogo$TickerControl$get_tickerScrollIncrement, set_tickerScrollIncrement: Viagogo$TickerControl$set_tickerScrollIncrement, get_maxScrolls: Viagogo$TickerControl$get_maxScrolls, set_maxScrolls: Viagogo$TickerControl$set_maxScrolls, initialize: Viagogo$TickerControl$initialize, dispose: Viagogo$TickerControl$dispose, _callTickerService: Viagogo$TickerControl$_callTickerService, _initializeTickerScroller: Viagogo$TickerControl$_initializeTickerScroller, _startTickerScroller: Viagogo$TickerControl$_startTickerScroller, _stopTickerScroller: Viagogo$TickerControl$_stopTickerScroller, _resetCanvasPosition: Viagogo$TickerControl$_resetCanvasPosition, _updateCanvasPosition: Viagogo$TickerControl$_updateCanvasPosition, _iterateScroll: Viagogo$TickerControl$_iterateScroll, _onTickerServiceComplete: Viagogo$TickerControl$_onTickerServiceComplete, _onTickerServiceFailed: Viagogo$TickerControl$_onTickerServiceFailed, _onTickerScrollTimerTick: Viagogo$TickerControl$_onTickerScrollTimerTick } Viagogo.TickerControl.registerClass('Viagogo.TickerControl', Sys.UI.Control); if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();