Type.createNamespace('ChannelNavigationComponent');

////////////////////////////////////////////////////////////////////////////////
// ChannelNavigationComponent.ChannelNavigationComponent

ChannelNavigationComponent.ChannelNavigationComponent = function ChannelNavigationComponent_ChannelNavigationComponent() {
    this._navigationSection$1 = String.Empty;
    this._currentChannel$1 = String.Empty;
    ChannelNavigationComponent.ChannelNavigationComponent.constructBase(this);
}
ChannelNavigationComponent.ChannelNavigationComponent.prototype = {
    _parameters$1: null,
    _repaintOnUserChanged$1: false,
    _repaintOnPageFilterChanged$1: false,
    _protocol$1: null,
    _activeElement$1: null,
    _navigationService$1: null,
    
    setNavigationService: function ChannelNavigationComponent_ChannelNavigationComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
    },
    
    onPageFilterChanged: function ChannelNavigationComponent_ChannelNavigationComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        if (this._repaintOnPageFilterChanged$1) {
            this.repaint();
        }
        else {
            this._setActiveElement$1();
        }
    },
    
    _userService$1: null,
    
    setUserService: function ChannelNavigationComponent_ChannelNavigationComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function ChannelNavigationComponent_ChannelNavigationComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        if (this._repaintOnUserChanged$1) {
            this.repaint();
        }
    },
    
    init: function ChannelNavigationComponent_ChannelNavigationComponent$init(environment, componentInstanceName, domElementId, parameters) {
        ChannelNavigationComponent.ChannelNavigationComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._repaintOnUserChanged$1 = Boolean.parse(parameters['repaint-onuserchanged']);
        this._repaintOnPageFilterChanged$1 = Boolean.parse(parameters['repaint-onpagefilterchanged']);
        this._protocol$1 = parameters['protocol'];
        this._navigationSection$1 = parameters['navigation-section'];
        this._currentChannel$1 = parameters['current-channel'];
    },
    
    repaint: function ChannelNavigationComponent_ChannelNavigationComponent$repaint() {
        this._log.debug('Repaint');
        var xsltParameters = {};
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        xsltParameters['component-dom-element-id'] = this._domElementId;
        xsltParameters['current-channel'] = this._currentChannel$1;
        this.show();
        this._environment.transformAndUpdate(this._domElementId, this._parameters$1.get_contentUrl(), this._parameters$1.get_xsltUrl(), xsltParameters, Delegate.create(this, function() {
            this._setActiveElement$1();
        }));
    },
    
    _setActiveElement$1: function ChannelNavigationComponent_ChannelNavigationComponent$_setActiveElement$1() {
        var action = this._navigationService$1.getAction();
        if (String.isNullOrEmpty(action)) {
            action = null;
        }
        var liElements = this._environment.getDomElement(this._domElementId).getElementsByTagName('LI');
        this._deactivateElement$1();
        for (var i = 0; i < liElements.length; i++) {
            var liElement = liElements[i];
            if (liElement.attributes.getNamedItem('action') && liElement.attributes.getNamedItem('action').value === this._currentChannel$1) {
                this._activateElement$1(liElement);
                break;
            }
        }
    },
    
    setPageFilter: function ChannelNavigationComponent_ChannelNavigationComponent$setPageFilter(liElement, area) {
        if (liElement.tagName !== 'LI') {
            throw new Error('Expected an LI element');
        }
        this._deactivateElement$1();
        this._activateElement$1(liElement);
        var pageFilter = {};
        pageFilter['action'] = liElement.attributes.getNamedItem('action').value;
        this._log.debug('SetPageFilter');
        this._navigationService$1.goTo(area, pageFilter);
        return false;
    },
    
    setPageFilterWithRegion: function ChannelNavigationComponent_ChannelNavigationComponent$setPageFilterWithRegion(liElement, area, region) {
        if (liElement.tagName !== 'LI') {
            throw new Error('Expected an LI element');
        }
        this._deactivateElement$1();
        this._activateElement$1(liElement);
        var pageFilter = {};
        pageFilter['action'] = liElement.attributes.getNamedItem('action').value;
        this._log.debug('SetPageFilter, region=' + region);
        this._environment.changeRegion(region, area, pageFilter);
        return false;
    },
    
    _activateElement$1: function ChannelNavigationComponent_ChannelNavigationComponent$_activateElement$1(liElement) {
        this._activeElement$1 = liElement;
        this._activeElement$1.className = 'cur';
    },
    
    _deactivateElement$1: function ChannelNavigationComponent_ChannelNavigationComponent$_deactivateElement$1() {
        if (this._activeElement$1) {
            this._activeElement$1.className = String.Empty;
            this._activeElement$1 = null;
        }
    },
    
    togglePart: function ChannelNavigationComponent_ChannelNavigationComponent$togglePart(parId, componentId) {
        var el = document.getElementById(componentId);
        if (el.style.display === 'block') {
            el.style.display = 'none';
            (parId).innerText = (parId).innerText.replace('Close', 'Open');
        }
        else {
            el.style.display = 'block';
            (parId).innerText = (parId).innerText.replace('Open', 'Close');
        }
    }
}


ChannelNavigationComponent.ChannelNavigationComponent.createClass('ChannelNavigationComponent.ChannelNavigationComponent', Framework.AbstractComponent, UserService.IUserChangedListener, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BFAreaImageComponent');

////////////////////////////////////////////////////////////////////////////////
// BFAreaImageComponent.BFAreaImageComponent

BFAreaImageComponent.BFAreaImageComponent = function BFAreaImageComponent_BFAreaImageComponent() {
    BFAreaImageComponent.BFAreaImageComponent.constructBase(this);
}
BFAreaImageComponent.BFAreaImageComponent.prototype = {
    _imagefilename$1: null,
    
    init: function BFAreaImageComponent_BFAreaImageComponent$init(environment, componentInstanceName, domElementId, parameters) {
        BFAreaImageComponent.BFAreaImageComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._imagefilename$1 = parameters['image-filename'];
    },
    
    repaint: function BFAreaImageComponent_BFAreaImageComponent$repaint() {
        this._log.debug('Repaint');
        var imageElement = document.createElement('img');
        imageElement.src = String.format('images/areaimage/{0}', this._imagefilename$1);
        imageElement.alt = '';
        document.getElementById(this._domElementId).appendChild(imageElement);
    }
}


BFAreaImageComponent.BFAreaImageComponent.createClass('BFAreaImageComponent.BFAreaImageComponent', Framework.AbstractComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BFNavigationComponent');

////////////////////////////////////////////////////////////////////////////////
// BFNavigationComponent.BFNavigationComponent

BFNavigationComponent.BFNavigationComponent = function BFNavigationComponent_BFNavigationComponent() {
    BFNavigationComponent.BFNavigationComponent.constructBase(this);
}
BFNavigationComponent.BFNavigationComponent.prototype = {
    _promotionsSection$3: '',
    
    getXsltParameters: function BFNavigationComponent_BFNavigationComponent$getXsltParameters(contextObject) {
        var useService = (!contextObject) ? true : contextObject;
        var xsltParameters = {};
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        xsltParameters['component-dom-element-id'] = this._domElementId;
        xsltParameters['username'] = (useService && this._userService.isLoggedIn()) ? this._userService.get_username() : null;
        xsltParameters['navigation-section'] = this._navigationSection;
        xsltParameters['top-level-css-class'] = this._topLevelCssClass;
        xsltParameters['current-item'] = this._currentItem;
        xsltParameters['promotions-section'] = this._promotionsSection$3;
        return xsltParameters;
    },
    
    init: function BFNavigationComponent_BFNavigationComponent$init(environment, componentInstanceName, domElementId, parameters) {
        BFNavigationComponent.BFNavigationComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        if ((parameters['promotions-section']) !== '') {
            this._promotionsSection$3 = parameters['promotions-section'];
        }
    },
    
    logoutEventHandler: function BFNavigationComponent_BFNavigationComponent$logoutEventHandler(sender, eventArgs) {
        this.logout();
        window.event.returnValue = false;
    },
    
    popupEventHandler: function BFNavigationComponent_BFNavigationComponent$popupEventHandler(sender, eventArgs) {
        this.popup(eventArgs.domElement, eventArgs.parameters.getAsString('area'), eventArgs.parameters.getAsString('popupparams'));
        window.event.returnValue = false;
    },
    
    setPageFilter: function BFNavigationComponent_BFNavigationComponent$setPageFilter(liElement, area) {
        if (liElement.tagName !== 'LI') {
            throw new Error('Expected an LI element');
        }
        this.deactivateElement();
        this.activateElement(liElement);
        var pageFilter = {};
        pageFilter['action'] = liElement.attributes.getNamedItem('action').value;
        if (this._promotionsSection$3 !== '' && pageFilter['action'] === 'promotions') {
            pageFilter['action'] += '&progress=' + this._promotionsSection$3;
        }
        this._log.debug('SetPageFilter');
        this._navigationService.goTo(area, pageFilter);
        return false;
    },
    
    logout: function BFNavigationComponent_BFNavigationComponent$logout() {
        this._log.debug('BFNavigationComponent:Logout');
        this.disable();
        this._userService.logout(Delegate.create(this, function(result) {
            this.enable();
            var pageFilter = {};
            pageFilter['action'] = 'homepage';
            this._navigationService.goTo('homepage', pageFilter);
        }), Delegate.create(this, function(exception) {
            this.enable();
        }));
    },
    
    popup: function BFNavigationComponent_BFNavigationComponent$popup(aElement, area, popupParams) {
        this._log.debug('BFNavigationComponent:Popup');
        var action = aElement.parentNode.attributes.getNamedItem('action').value;
        if ((area === 'HelpCentre2' || area === 'HelpCentre') && action === 'default') {
            action += '&selected-menu-id=_MenuItem_Default';
        }
        var pageFilter = {};
        pageFilter['action'] = action;
        window.open(this._environment.buildUrl(area, pageFilter, this._protocol), 'BFWRPhelp', popupParams);
    }
}


BFNavigationComponent.BFNavigationComponent.createClass('BFNavigationComponent.BFNavigationComponent', AbstractWarpComponents.AbstractNavigationComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('ClockComponent');

////////////////////////////////////////////////////////////////////////////////
// ClockComponent.ClockComponent

ClockComponent.ClockComponent = function ClockComponent_ClockComponent() {
    ClockComponent.ClockComponent.constructBase(this);
}
ClockComponent.ClockComponent.prototype = {
    _parameters$1: null,
    _clockDomElement$1: null,
    _useCustomDigits$1: false,
    _timeDateFormat$1: null,
    _clockSpan$1: null,
    _businessUnitService$1: null,
    
    setBusinessUnitService: function ClockComponent_ClockComponent$setBusinessUnitService(businessUnitService) {
        this._log.debug('SetBusinessUnitService');
        this._businessUnitService$1 = businessUnitService;
    },
    
    init: function ClockComponent_ClockComponent$init(environment, componentInstanceName, domElementId, parameters) {
        ClockComponent.ClockComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._timeDateFormat$1 = parameters['time-date-format'];
        this._useCustomDigits$1 = parameters['use-custom-digits'];
        this._clockDomElement$1 = document.createElement('p');
        this._clockDomElement$1.className = 'lb_clock';
        this._clockDomElement$1.id = this._domElementId + '-lb_clock';
        this._environment.getDomElement(this._domElementId).appendChild(this._clockDomElement$1);
        this._clockSpan$1 = '';
        if (parameters['clock-label'] !== '') {
            this._clockSpan$1 = parameters['clock-label'];
            if (this._useCustomDigits$1) {
                var tempClockSpan = '';
                var curChar = '';
                for (var i = 0; i < this._clockSpan$1.length; i++) {
                    curChar = this._clockSpan$1.charAt(i).toString();
                    tempClockSpan += String.format('<span class=\"digit digit{0}\">{1}</span>', curChar, this._clockSpan$1.charAt(i));
                }
                this._clockSpan$1 = tempClockSpan;
            }
            this._clockSpan$1 = ' <span class=\"clocklabel\" >' + this._clockSpan$1 + '</span> ';
        }
    },
    
    repaint: function ClockComponent_ClockComponent$repaint() {
        this._log.debug('Repaint');
        window.setInterval(Delegate.create(this, function() {
            var currentTime = new Date(Date.get_now().getTime() + this._businessUnitService$1.getDateTimeOffset()).format(this._timeDateFormat$1);
            if (this._useCustomDigits$1) {
                var customCurrentTime = '';
                var curChar = '';
                for (var i = 0; i < currentTime.length; i++) {
                    curChar = currentTime.charAt(i).toString();
                    switch (curChar) {
                        case ':':
                            curChar = 'Colon';
                            break;
                        case '.':
                            curChar = 'Dot';
                            break;
                        case '-':
                            curChar = 'Dash';
                            break;
                    }
                    customCurrentTime += String.format('<span class=\"digit digit{0}\">{1}</span>', curChar, currentTime.charAt(i));
                }
                currentTime = customCurrentTime;
            }
            this._environment.updateDomElementDirect(this._clockDomElement$1, currentTime + this._clockSpan$1);
        }), 1000);
    }
}


ClockComponent.ClockComponent.createClass('ClockComponent.ClockComponent', Framework.AbstractComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('DashboardComponent');

////////////////////////////////////////////////////////////////////////////////
// DashboardComponent.DashboardComponent

DashboardComponent.DashboardComponent = function DashboardComponent_DashboardComponent() {
    DashboardComponent.DashboardComponent.constructBase(this);
}
DashboardComponent.DashboardComponent.prototype = {
    _parameters$1: null,
    _accountService$1: null,
    
    setAccountService: function DashboardComponent_DashboardComponent$setAccountService(accountService) {
        this._log.debug('SetAccountService');
        this._accountService$1 = accountService;
    },
    
    onBalanceChanged: function DashboardComponent_DashboardComponent$onBalanceChanged(eventSource) {
        this._log.debug('OnBalanceChanged');
        this.repaint();
    },
    
    onAccountPreferencesChanged: function DashboardComponent_DashboardComponent$onAccountPreferencesChanged(eventSource) {
        this._log.debug('OnAccountPreferencesChanged');
        var dbStyle = (this._accountService$1.get_preferences().IsCallCentreAccountNumberConstantlyDisplayed) ? 'block' : 'none';
        Framework.CookieUtil.setCookie('plchdash', dbStyle);
        this.repaint();
    },
    
    _navigationService$1: null,
    
    setNavigationService: function DashboardComponent_DashboardComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
    },
    
    _playtechService$1: null,
    
    setPlaytechService: function DashboardComponent_DashboardComponent$setPlaytechService(playtechService) {
        this._log.debug('SetPlaytechService');
        this._playtechService$1 = playtechService;
    },
    
    onPlayerInfoChanged: function DashboardComponent_DashboardComponent$onPlayerInfoChanged(eventSource) {
        this._log.debug('OnPlayerInfoChanged');
        this.repaint();
    },
    
    _userService$1: null,
    
    setUserService: function DashboardComponent_DashboardComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function DashboardComponent_DashboardComponent$onUserChanged(userService) {
        this._log.debug('OnUserChanged');
        this.repaint();
    },
    
    init: function DashboardComponent_DashboardComponent$init(environment, componentInstanceName, domElementId, parameters) {
        DashboardComponent.DashboardComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
    },
    
    start: function DashboardComponent_DashboardComponent$start() {
        this._log.debug('Start');
        this.repaint();
    },
    
    repaint: function DashboardComponent_DashboardComponent$repaint() {
        this._log.debug('Repaint');
        var dbStyle = Framework.CookieUtil.getCookie('plchdash');
        if (this.isVisible(this._parameters$1.get_visibleOn(), this._parameters$1.get_notVisibleOn(), this._navigationService$1.getAction()) && this._userService$1.isLoggedIn()) {
            if (this._accountService$1.get_accountsDetails()) {
                var xsltParameters = {};
                xsltParameters['component-instance-name'] = this._componentInstanceName;
                xsltParameters['component-dom-element-id'] = this._domElementId;
                if (this._userService$1.get_personalDetails()) {
                    xsltParameters['name'] = this._userService$1.get_personalDetails().FullName;
                }
                xsltParameters['playtech-balance'] = (!this._playtechService$1.get_playerInfo()) ? 'N/A' : this._playtechService$1.get_playerInfo().Balance.toFixed(2);
                xsltParameters['currency-symbol'] = this._accountService$1.getCurrencySimbol();
                xsltParameters['cash-balance'] = this._accountService$1.get_accountsDetails()[0].WithdrawalBalance.toFixed(2);
                xsltParameters['free-balance'] = this._accountService$1.get_accountsDetails()[1].WithdrawalBalance.toFixed(2);
                xsltParameters['acct-number'] = this._accountService$1.get_accountsDetails()[0].AccountNumber;
                this._environment.transformAndUpdate(this._domElementId, null, this._parameters$1.get_xsltUrl(), xsltParameters, Delegate.create(this, function() {
                    if (dbStyle) {
                        document.getElementById('plchdash').style.display = dbStyle;
                        var parId = document.getElementById('dashboardlink');
                        if (parId) {
                            if (dbStyle === 'none') {
                                (parId).innerText = 'Open Dashboard';
                            }
                            else {
                                (parId).innerText = 'Close Dashboard';
                            }
                        }
                    }
                }));
            }
            else {
                this._environment.updateDomElement(this._domElementId, '');
            }
            this.show();
        }
        else {
            this.hide();
        }
    },
    
    logout: function DashboardComponent_DashboardComponent$logout() {
        this._log.debug('Logout');
        this.disable();
        this._userService$1.logout(Delegate.create(this, function(result) {
            this.enable();
        }), Delegate.create(this, function(exception) {
            this.enable();
        }));
    },
    
    refreshBalance: function DashboardComponent_DashboardComponent$refreshBalance() {
        this._log.debug('RefreshBalance');
        this._accountService$1.fetchAccountsDetails();
        this._playtechService$1.fetchPlayerInfo();
        this.repaint();
        return false;
    },
    
    setPageFilter: function DashboardComponent_DashboardComponent$setPageFilter(action, area) {
        this._log.debug('SetPageFilter');
        this._navigationService$1.goTo(area, { action: action });
        return false;
    }
}


DashboardComponent.DashboardComponent.createClass('DashboardComponent.DashboardComponent', Framework.AbstractComponent, AccountService.IBalanceChangedListener, AccountService.IAccountPreferencesChangedListener, PlaytechService.IPlayerInfoChangedListener, UserService.IUserChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('LoginComponent');

////////////////////////////////////////////////////////////////////////////////
// LoginComponent.LoginComponent

LoginComponent.LoginComponent = function LoginComponent_LoginComponent() {
    LoginComponent.LoginComponent.constructBase(this);
}


LoginComponent.LoginComponent.createClass('LoginComponent.LoginComponent', AbstractMMCoreComponents.AbstractLoginComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('GamesLoginComponent');

////////////////////////////////////////////////////////////////////////////////
// GamesLoginComponent.GamesLoginComponent

GamesLoginComponent.GamesLoginComponent = function GamesLoginComponent_GamesLoginComponent() {
    GamesLoginComponent.GamesLoginComponent.constructBase(this);
}
GamesLoginComponent.GamesLoginComponent.prototype = {
    _gamesHostService$1: null,
    _autoLogin$1: null,
    _autoLogout$1: null,
    
    setGamesHostService: function GamesLoginComponent_GamesLoginComponent$setGamesHostService(gamesHostService) {
        this._log.debug('SetGamesHostService');
        this._gamesHostService$1 = gamesHostService;
    },
    
    _userService$1: null,
    
    setUserService: function GamesLoginComponent_GamesLoginComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function GamesLoginComponent_GamesLoginComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        if (this._gamesHostService$1 && this._gamesHostService$1.isLoggedIn() && this._autoLogout$1 === 'true') {
            this._gamesHostService$1.logout(Delegate.create(this, this._logoutSuccess$1), Delegate.create(this, this._logoutFailure$1));
        }
        this.repaint();
        this._refreshOpener$1();
    },
    
    init: function GamesLoginComponent_GamesLoginComponent$init(environment, componentInstanceName, domElementId, parameters) {
        GamesLoginComponent.GamesLoginComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._autoLogin$1 = (parameters['auto-login']).toLowerCase();
        this._autoLogout$1 = (parameters['auto-logout']).toLowerCase();
    },
    
    repaint: function GamesLoginComponent_GamesLoginComponent$repaint() {
        this._log.debug('Repaint');
        if (this._userService$1 && this._gamesHostService$1) {
            if (this._userService$1.isLoggedIn()) {
                if (!this._gamesHostService$1.isLoggedIn() && this._autoLogin$1 === 'true') {
                    this._gamesHostService$1.login(Delegate.create(this, this._loginSuccess$1), Delegate.create(this, this._loginFailure$1));
                }
            }
            else {
                if (this._gamesHostService$1.isLoggedIn() && this._autoLogout$1 === 'true') {
                    this._gamesHostService$1.logout(Delegate.create(this, this._logoutSuccess$1), Delegate.create(this, this._logoutFailure$1));
                }
            }
        }
    },
    
    _refreshOpener$1: function GamesLoginComponent_GamesLoginComponent$_refreshOpener$1() {
        var opener = window.self;
        while (opener.opener) {
            opener = opener.opener;
            ((opener.location)).reload();
            if (opener) {
                if (opener.parent) {
                    ((opener.parent.location)).reload();
                }
            }
        }
    },
    
    _logoutSuccess$1: function GamesLoginComponent_GamesLoginComponent$_logoutSuccess$1(result) {
        this._log.debug('logoutSuccess');
    },
    
    _logoutFailure$1: function GamesLoginComponent_GamesLoginComponent$_logoutFailure$1(e) {
        this._log.debug('logoutFailure: ' + e.message);
    },
    
    _loginSuccess$1: function GamesLoginComponent_GamesLoginComponent$_loginSuccess$1(result) {
        this._log.debug('loginSuccess');
    },
    
    _loginFailure$1: function GamesLoginComponent_GamesLoginComponent$_loginFailure$1(e) {
        this._log.debug('loginFailure: ' + e.message);
    },
    
    repaintForAdmin: function GamesLoginComponent_GamesLoginComponent$repaintForAdmin() {
        GamesLoginComponent.GamesLoginComponent.callBase(this, 'disableForAdmin');
    }
}


GamesLoginComponent.GamesLoginComponent.createClass('GamesLoginComponent.GamesLoginComponent', Framework.AbstractComponent, UserService.IUserChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
// Betfred.Warp.Components.LeftHandNavComponent.js
//


Type.createNamespace('Betfred.Warp.Components.LeftHandNavComponent');

////////////////////////////////////////////////////////////////////////////////
// Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent

Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent = function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent() {
    this._arLILevelClass$1 = [ 'Level1CollapsedLI', 'Level2CollapsedLI', 'Level3CollapsedLI' ];
    this._arLILevelExpandedClass$1 = [ 'Level1ExpandedLI', 'Level2ExpandedLI', 'Level3ExpandedLI' ];
    this._arLILevelSelectedClass$1 = [ 'Level1SelectedLI', 'Level2SelectedLI', 'Level3SelectedLI' ];
    Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent.constructBase(this);
}
Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent.prototype = {
    _parameters$1: null,
    _navigationService$1: null,
    _selectedDOMElement$1: null,
    _protocol: null,
    
    _displaySelectedNode$1: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$_displaySelectedNode$1(oPassedElement) {
        var oClickedElement = oPassedElement;
        this._selectedDOMElement$1 = oClickedElement;
        var oControlContainerDiv = document.getElementById(this._domElementId);
        var oDivs = oControlContainerDiv.getElementsByTagName('div');
        if (oDivs.length > 0) {
            this._unSelectAllChildItems$1(oDivs[0], 0, this._arLILevelClass$1, this._arLILevelSelectedClass$1);
        }
        var oLIParent = oClickedElement;
        var iDepthOfCurrentElement = this._getLIDepth$1(oLIParent);
        oClickedElement.className = this._arLILevelSelectedClass$1[iDepthOfCurrentElement - 1];
        var oElement = oClickedElement;
        while (oElement.id !== this._domElementId) {
            if (oElement.tagName.toUpperCase() === 'DIV') {
                var oParentLITemp = oElement.parentNode;
                var iTempDepth = this._getLIDepth$1(oElement);
                if (iTempDepth > 0) {
                    oParentLITemp.className = this._arLILevelExpandedClass$1[iTempDepth - 1];
                }
            }
            oElement = oElement.parentNode;
        }
        this._collapseAllUnselectedNodes$1(oClickedElement, this._arLILevelClass$1);
    },
    
    selectNode: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$selectNode(oPassedElement, sPageArea, sPageFilter, iLevel) {
        this._displaySelectedNode$1(oPassedElement);
        this._log.debug('selectNode');
        var arPageFilters = sPageFilter.split('|');
        var oPageFilter = {};
        var $enum1 = arPageFilters.getEnumerator();
        while ($enum1.moveNext()) {
            var sNameValuePair = $enum1.get_current();
            var arNameValue = sNameValuePair.split('=');
            var sName = '';
            var sValue = '';
            if (arNameValue.length > 0) {
                sName = arNameValue[0];
                if (arNameValue.length > 1) {
                    sValue = arNameValue[1];
                }
            }
            oPageFilter[sName] = sValue;
        }
        this._navigationService$1.goTo(sPageArea, oPageFilter);
    },
    
    toggleNode: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$toggleNode(oPassedElement, iCurrentLevel) {
        var oElement = oPassedElement;
        var oDivs = oElement.getElementsByTagName('div');
        if (oElement.className === this._arLILevelClass$1[iCurrentLevel]) {
            this._collapseAllUnselectedNodes$1(oElement, this._arLILevelClass$1);
            oElement.className = this._arLILevelExpandedClass$1[iCurrentLevel];
        }
        else {
            oElement.className = this._arLILevelClass$1[iCurrentLevel];
        }
    },
    
    _unSelectAllChildItems$1: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$_unSelectAllChildItems$1(oDiv, iCurrentLevel, arLILevelClass, arLevelLISelectedClass) {
        var oULs = oDiv.getElementsByTagName('ul');
        if (oULs.length > 0) {
            var oLIs = oULs[0].getElementsByTagName('li');
            for (var i = 0; i < oLIs.length; i++) {
                var oLI = oLIs[i];
                if (oLI.className === arLevelLISelectedClass[iCurrentLevel]) {
                    oLI.className = arLILevelClass[iCurrentLevel];
                }
                var oDivs = oLI.getElementsByTagName('div');
                if (oDivs.length > 0) {
                    this._unSelectAllChildItems$1(oDivs[0], iCurrentLevel + 1, arLILevelClass, arLevelLISelectedClass);
                }
            }
        }
    },
    
    _collapseAllUnselectedNodes$1: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$_collapseAllUnselectedNodes$1(oSelectedElement, arLevelClass) {
        var oLIs = document.getElementById(this._domElementId).getElementsByTagName('li');
        for (var i = 0; i < oLIs.length; i++) {
            if (this._shouldListItemBeClosed$1(oSelectedElement, oLIs[i])) {
                var iDepth = this._getLIDepth$1(oLIs[i]);
                if (iDepth > 0) {
                    oLIs[i].className = arLevelClass[iDepth - 1];
                }
            }
        }
    },
    
    _getLIDepth$1: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$_getLIDepth$1(oSelectedElement) {
        var iCount = 0;
        var oElement = oSelectedElement;
        while (oElement.id !== this._domElementId) {
            if (oElement.tagName.toUpperCase() === 'LI') {
                iCount++;
            }
            oElement = oElement.parentNode;
        }
        return iCount;
    },
    
    _shouldListItemBeClosed$1: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$_shouldListItemBeClosed$1(oSelectedElement, oLIToCheck) {
        if (!oSelectedElement) {
            return true;
        }
        var oParent;
        if (oSelectedElement.tagName.toUpperCase() === 'LI') {
            oParent = oSelectedElement;
        }
        else {
            oParent = oSelectedElement.parentNode;
        }
        if (oLIToCheck === oParent) {
            return false;
        }
        else {
            while (oParent.id !== this._domElementId) {
                if (oParent.tagName.toUpperCase() === 'LI') {
                    if (oLIToCheck === oParent) {
                        return false;
                    }
                }
                oParent = oParent.parentNode;
            }
        }
        return true;
    },
    
    init: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$init(environment, componentInstanceName, domElementId, parameters) {
        Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = parameters;
        this._protocol = parameters['protocol'];
    },
    
    start: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$start() {
        this._log.debug('Start');
        this._navigationService$1.registerPageFilterChangedListener(this);
        this.repaint();
    },
    
    repaint: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$repaint() {
        this._log.debug('Repaint');
        var xsltParameters = {};
        xsltParameters['region'] = this._environment.getRegion();
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        this._environment.transformAndUpdate(this._domElementId, this._parameters$1['content-url'], this._parameters$1['xslt-url'], xsltParameters, Delegate.create(this, function() {
            this.onPageFilterChanged(null);
        }));
    },
    
    setNavigationService: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
    },
    
    onPageFilterChanged: function Betfred_Warp_Components_LeftHandNavComponent_LeftHandNavComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        var progress = this._navigationService$1.getPageFilter()['selected-menu-id'];
        if (progress) {
            if (progress.length > 0) {
                var oSelectedMenuItem = document.getElementById(progress);
                this._displaySelectedNode$1(oSelectedMenuItem);
            }
        }
    }
}


Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent.createClass('Betfred.Warp.Components.LeftHandNavComponent.LeftHandNavComponent', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('IncludeComponent');

////////////////////////////////////////////////////////////////////////////////
// IncludeComponent.IncludeComponent

IncludeComponent.IncludeComponent = function IncludeComponent_IncludeComponent() {
    IncludeComponent.IncludeComponent.constructBase(this);
}
IncludeComponent.IncludeComponent.prototype = {
    _parameters$1: null,
    _navigationService$1: null,
    
    setNavigationService: function IncludeComponent_IncludeComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
        this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.action);
        this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.page);
    },
    
    onPageFilterChanged: function IncludeComponent_IncludeComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        this.repaint();
    },
    
    init: function IncludeComponent_IncludeComponent$init(environment, componentInstanceName, domElementId, parameters) {
        IncludeComponent.IncludeComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
    },
    
    repaint: function IncludeComponent_IncludeComponent$repaint() {
        this._log.debug('Repaint');
        if (this.isVisible(this._parameters$1.get_visibleOn(), this._parameters$1.get_notVisibleOn(), this._navigationService$1.getAction())) {
            this.show();
            var contentUrl = this._parameters$1.get_contentUrl().replace('${region}', this._environment.getRegion()).replace('${language}', this._environment.getLanguage());
            var page = this._navigationService$1.getPageFilter()[NavigationService.NavigationService.page];
            if (!String.isNullOrEmpty(page)) {
                contentUrl = contentUrl.replace('${page}', page);
            }
            var ajaxUpdater = new Framework.AjaxUpdater(this._domElementId, contentUrl, null, null);
            ajaxUpdater.update();
        }
        else {
            this.hide();
        }
    }
}


IncludeComponent.IncludeComponent.createClass('IncludeComponent.IncludeComponent', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('PlaytechCasinoComponent');

////////////////////////////////////////////////////////////////////////////////
// PlaytechCasinoComponent.PlaytechCasinoComponent

PlaytechCasinoComponent.PlaytechCasinoComponent = function PlaytechCasinoComponent_PlaytechCasinoComponent() {
    PlaytechCasinoComponent.PlaytechCasinoComponent.constructBase(this);
}
PlaytechCasinoComponent.PlaytechCasinoComponent.prototype = {
    _parameters$1: null,
    _imageBaseUrl$1: null,
    _lastTabContent$1: null,
    _lastTabHeader$1: null,
    _navigationService$1: null,
    
    setNavigationService: function PlaytechCasinoComponent_PlaytechCasinoComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
        this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.action);
    },
    
    onPageFilterChanged: function PlaytechCasinoComponent_PlaytechCasinoComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        this.repaint();
    },
    
    _userService$1: null,
    
    setUserService: function PlaytechCasinoComponent_PlaytechCasinoComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
        this._userService$1.registerUserChangedListener(this);
    },
    
    onUserChanged: function PlaytechCasinoComponent_PlaytechCasinoComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        if (!this._userService$1.isLoggedIn()) {
            this.repaint();
        }
    },
    
    init: function PlaytechCasinoComponent_PlaytechCasinoComponent$init(environment, componentInstanceName, domElementId, parameters) {
        PlaytechCasinoComponent.PlaytechCasinoComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._imageBaseUrl$1 = parameters['images-base-url'];
    },
    
    repaint: function PlaytechCasinoComponent_PlaytechCasinoComponent$repaint() {
        this._log.debug('Repaint');
        if (this.isVisible(this._parameters$1.get_visibleOn(), this._parameters$1.get_notVisibleOn(), this._navigationService$1.getAction())) {
            this.show();
            var xsltParameters = {};
            xsltParameters['component-instance-name'] = this._componentInstanceName;
            xsltParameters['component-dom-element-id'] = this._domElementId;
            xsltParameters['images-base-url'] = this._imageBaseUrl$1;
            this._environment.transformAndUpdate(this._domElementId, this._parameters$1.get_contentUrl(), this._parameters$1.get_xsltUrl(), xsltParameters, null);
        }
        else {
            this.hide();
        }
    },
    
    launchGame: function PlaytechCasinoComponent_PlaytechCasinoComponent$launchGame(gameType, gameCode) {
        this._log.debug('LaunchGame');
        var isOffline = ((this._userService$1.isLoggedIn()) ? 'N' : 'Y');
        if (gameType === 'bingo' && isOffline === 'Y') {
            alert('You are not logged in.');
        }
        else {
            window.open(String.format('/Playtech.ashx?gameType={0}&gameCode={1}&isOffline={2}', gameType, gameCode, isOffline), 'betfredsat', 'width=800,height=600,toolbar=no,menubar=no,scrollbars=no,resizable=yes,top=' + ((window.screen.height / 2) - (300)) + ',left=' + ((window.screen.width / 2) - (400)));
        }
        return true;
    },
    
    toggleTab: function PlaytechCasinoComponent_PlaytechCasinoComponent$toggleTab(tab) {
        this._log.debug('ToggleTab');
        if (!this._lastTabContent$1 && !this._lastTabHeader$1) {
            this._lastTabContent$1 = document.getElementById('Favourite Games');
            this._lastTabHeader$1 = document.getElementById('Favourite Games-tab');
        }
        var tabContent = document.getElementById(tab);
        var tabHeader = document.getElementById(tab + '-tab');
        if (tabContent && tabContent.id !== this._lastTabContent$1.id) {
            tabContent.style.display = 'block';
            this._lastTabContent$1.style.display = 'none';
            tabHeader.className = 'cur-tab';
            this._lastTabHeader$1.className = 'tab';
            this._lastTabContent$1 = tabContent;
            this._lastTabHeader$1 = tabHeader;
        }
    }
}


PlaytechCasinoComponent.PlaytechCasinoComponent.createClass('PlaytechCasinoComponent.PlaytechCasinoComponent', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener, UserService.IUserChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
// Betfred.Warp.Components.IncludeXMLWithNavComponent.js
//


Type.createNamespace('Betfred.Warp.Components.IncludeXMLWithNavComponent');

////////////////////////////////////////////////////////////////////////////////
// Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent

Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent = function Betfred_Warp_Components_IncludeXMLWithNavComponent_IncludeXMLWithNavComponent() {
    Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent.constructBase(this);
}
Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent.prototype = {
    _parameters$1: null,
    _navigationService$1: null,
    
    setNavigationService: function Betfred_Warp_Components_IncludeXMLWithNavComponent_IncludeXMLWithNavComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
        this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.action);
    },
    
    onPageFilterChanged: function Betfred_Warp_Components_IncludeXMLWithNavComponent_IncludeXMLWithNavComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        this.repaint();
    },
    
    init: function Betfred_Warp_Components_IncludeXMLWithNavComponent_IncludeXMLWithNavComponent$init(environment, componentInstanceName, domElementId, parameters) {
        Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
    },
    
    repaint: function Betfred_Warp_Components_IncludeXMLWithNavComponent_IncludeXMLWithNavComponent$repaint() {
        this._log.debug('Repaint');
        if (this.isVisible(this._parameters$1.get_visibleOn(), this._parameters$1.get_notVisibleOn(), this._navigationService$1.getAction())) {
            this.show();
            var xsltParameters = {};
            xsltParameters['component-instance-name'] = this._componentInstanceName;
            this._environment.transformAndUpdate(this._domElementId, this._parameters$1.get_contentUrl(), this._parameters$1.get_xsltUrl(), xsltParameters, null);
        }
        else {
            this.hide();
        }
    }
}


Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent.createClass('Betfred.Warp.Components.IncludeXMLWithNavComponent.IncludeXMLWithNavComponent', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
// Betfred.Warp.Components.CasinoPromoComponent.js
//


Type.createNamespace('Betfred.Warp.Components.PromoComponent');

////////////////////////////////////////////////////////////////////////////////
// Betfred.Warp.Components.PromoComponent.PromoComponent

Betfred.Warp.Components.PromoComponent.PromoComponent = function Betfred_Warp_Components_PromoComponent_PromoComponent() {
    Betfred.Warp.Components.PromoComponent.PromoComponent.constructBase(this);
}
Betfred.Warp.Components.PromoComponent.PromoComponent.prototype = {
    _parameters$1: null,
    _navigationService$1: null,
    
    navToPage: function Betfred_Warp_Components_PromoComponent_PromoComponent$navToPage(sPageArea, sPageFilter) {
        var arPageFilters = sPageFilter.split('|');
        var oPageFilter = {};
        var $enum1 = arPageFilters.getEnumerator();
        while ($enum1.moveNext()) {
            var sNameValuePair = $enum1.get_current();
            var arNameValue = sNameValuePair.split('=');
            var sName = '';
            var sValue = '';
            if (arNameValue.length > 0) {
                sName = arNameValue[0];
                if (arNameValue.length > 1) {
                    sValue = arNameValue[1];
                }
            }
            oPageFilter[sName] = sValue;
        }
        this._navigationService$1.goTo(sPageArea, oPageFilter);
    },
    
    init: function Betfred_Warp_Components_PromoComponent_PromoComponent$init(environment, componentInstanceName, domElementId, parameters) {
        Betfred.Warp.Components.PromoComponent.PromoComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = parameters;
    },
    
    start: function Betfred_Warp_Components_PromoComponent_PromoComponent$start() {
        this._log.debug('Start');
        this._navigationService$1.registerPageFilterChangedListener(this);
        this.repaint();
    },
    
    repaint: function Betfred_Warp_Components_PromoComponent_PromoComponent$repaint() {
        this._log.debug('Repaint');
        var xsltParameters = {};
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        xsltParameters['imageName'] = this._parameters$1['imageName'];
        xsltParameters['altText'] = this._parameters$1['altText'];
        xsltParameters['linkText'] = this._parameters$1['linkText'];
        xsltParameters['PageArea'] = this._parameters$1['PageArea'];
        xsltParameters['PageFilter'] = this._parameters$1['PageFilter'];
        xsltParameters['arrowImage'] = this._parameters$1['arrowImage'];
        xsltParameters['textColour'] = this._parameters$1['textColour'];
        xsltParameters['bkgndColour'] = this._parameters$1['bkgndColour'];
        this._environment.transformAndUpdate(this._domElementId, null, this._parameters$1['xslt-url'], xsltParameters, null);
    },
    
    setNavigationService: function Betfred_Warp_Components_PromoComponent_PromoComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
    },
    
    onPageFilterChanged: function Betfred_Warp_Components_PromoComponent_PromoComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
    }
}


Betfred.Warp.Components.PromoComponent.PromoComponent.createClass('Betfred.Warp.Components.PromoComponent.PromoComponent', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
