Type.createNamespace('BodyClassOverrideComponent');

////////////////////////////////////////////////////////////////////////////////
// BodyClassOverrideComponent.BodyClassOverrideComponent

BodyClassOverrideComponent.BodyClassOverrideComponent = function BodyClassOverrideComponent_BodyClassOverrideComponent() {
    this._bodycssclass = String.Empty;
    BodyClassOverrideComponent.BodyClassOverrideComponent.constructBase(this);
}
BodyClassOverrideComponent.BodyClassOverrideComponent.prototype = {
    _parameters$1: null,
    
    init: function BodyClassOverrideComponent_BodyClassOverrideComponent$init(environment, componentInstanceName, domElementId, parameters) {
        BodyClassOverrideComponent.BodyClassOverrideComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._bodycssclass = parameters['body-css-class'];
        if (this._bodycssclass !== String.Empty) {
            document.body.className += ' ' + this._bodycssclass;
        }
    }
}


BodyClassOverrideComponent.BodyClassOverrideComponent.createClass('BodyClassOverrideComponent.BodyClassOverrideComponent', Framework.Component.AbstractComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('HTMLHeadConfigurationComponent');

////////////////////////////////////////////////////////////////////////////////
// HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent

HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent = function HTMLHeadConfigurationComponent_HTMLHeadConfigurationComponent() {
    this._titleText = String.Empty;
    this._metaKeywords = String.Empty;
    this._metaDescription = String.Empty;
    HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent.constructBase(this);
}
HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent.prototype = {
    _parameters$1: null,
    
    init: function HTMLHeadConfigurationComponent_HTMLHeadConfigurationComponent$init(environment, componentInstanceName, domElementId, parameters) {
        HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._titleText = parameters['title-text'];
        this._metaDescription = parameters['meta-description'];
        this._metaKeywords = parameters['meta-keywords'];
        if (this._titleText !== String.Empty) {
            document.title = this._titleText;
        }
        var metaTags = document.getElementsByTagName('meta');
        for (var i = 0; i < metaTags.length; i++) {
            if (metaTags[i].getAttribute('name').toString() === 'keywords') {
                metaTags[i].setAttribute('content', this._metaKeywords);
            }
            if (metaTags[i].getAttribute('name').toString() === 'description') {
                metaTags[i].setAttribute('content', this._metaDescription);
            }
        }
    }
}


HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent.createClass('HTMLHeadConfigurationComponent.HTMLHeadConfigurationComponent', Framework.Component.AbstractComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('NavigationComponent');

////////////////////////////////////////////////////////////////////////////////
// NavigationComponent.NavigationComponent

NavigationComponent.NavigationComponent = function NavigationComponent_NavigationComponent() {
    NavigationComponent.NavigationComponent.constructBase(this);
}


NavigationComponent.NavigationComponent.createClass('NavigationComponent.NavigationComponent', AbstractWarpComponents.AbstractNavigationComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsHeaderComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsHeaderComponent.BoyleSportsHeaderComponent

BoyleSportsHeaderComponent.BoyleSportsHeaderComponent = function BoyleSportsHeaderComponent_BoyleSportsHeaderComponent() {
    BoyleSportsHeaderComponent.BoyleSportsHeaderComponent.constructBase(this);
}


BoyleSportsHeaderComponent.BoyleSportsHeaderComponent.createClass('BoyleSportsHeaderComponent.BoyleSportsHeaderComponent', BoyleSportsAbstractComponents.BoyleSportsHeaderComponent.BoyleSportsAbstractHeaderComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('AccountsDetailsComponent');

////////////////////////////////////////////////////////////////////////////////
// AccountsDetailsComponent.AccountsDetailsComponent

AccountsDetailsComponent.AccountsDetailsComponent = function AccountsDetailsComponent_AccountsDetailsComponent() {
    AccountsDetailsComponent.AccountsDetailsComponent.constructBase(this);
}
AccountsDetailsComponent.AccountsDetailsComponent.prototype = {
    _changeActionOnLogout$2: null,
    _changePageAreaOnLogout$2: null,
    _changePageFilterOnLogout$2: null,
    _webSection$2: 'SPORTSBOOK',
    
    refreshBalanceOnClickEventHandler: function AccountsDetailsComponent_AccountsDetailsComponent$refreshBalanceOnClickEventHandler(sender, eventArgs) {
        this.refreshBalance();
        window.event.returnValue = false;
    },
    
    goToEventHandler: function AccountsDetailsComponent_AccountsDetailsComponent$goToEventHandler(sender, eventArgs) {
        new NavigationService.GoToBehavior(eventArgs.domElement, null, this._navigationService$2);
    },
    
    logoutOnClickEventHandler: function AccountsDetailsComponent_AccountsDetailsComponent$logoutOnClickEventHandler(sender, eventArgs) {
        this.logout();
    },
    
    logOutAndGotoPageEventHandler: function AccountsDetailsComponent_AccountsDetailsComponent$logOutAndGotoPageEventHandler(sender, eventArgs) {
        this.logout();
        this.removeBSselections();
        this.goToPageArea(eventArgs.parameters.getAsString('pagename'));
    },
    
    logoutAndRemoveSelectionsEventHandler: function AccountsDetailsComponent_AccountsDetailsComponent$logoutAndRemoveSelectionsEventHandler(sender, eventArgs) {
        this.logout();
        this.removeBSselections();
    },
    
    _accountService$2: null,
    
    setAccountService: function AccountsDetailsComponent_AccountsDetailsComponent$setAccountService(accountService) {
        this._log.debug('SetAccountService');
        this._accountService$2 = accountService;
    },
    
    onBalanceChanged: function AccountsDetailsComponent_AccountsDetailsComponent$onBalanceChanged(eventSource) {
        this._log.debug('OnBalanceChanged');
        this.update();
    },
    
    onAccountPreferencesChanged: function AccountsDetailsComponent_AccountsDetailsComponent$onAccountPreferencesChanged(eventSource) {
        this._log.debug('OnAccountPreferencesChanged');
        this.update();
    },
    
    _navigationService$2: null,
    
    setNavigationService: function AccountsDetailsComponent_AccountsDetailsComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$2 = navigationService;
        this._navigationService$2.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.action);
    },
    
    onPageFilterChanged: function AccountsDetailsComponent_AccountsDetailsComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        this.update();
    },
    
    _userService$2: null,
    
    setUserService: function AccountsDetailsComponent_AccountsDetailsComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$2 = userService;
    },
    
    _betSlipService$2: null,
    
    setBetSlipService: function AccountsDetailsComponent_AccountsDetailsComponent$setBetSlipService(betSlipService) {
        this._log.debug('SetBetSlipService');
        this._betSlipService$2 = betSlipService;
    },
    
    init: function AccountsDetailsComponent_AccountsDetailsComponent$init(environment, componentInstanceName, domElementId, parameters) {
        this._changeActionOnLogout$2 = parameters['change-action-on-logout'];
        this._changePageAreaOnLogout$2 = parameters['change-page-area-on-logout'];
        this._changePageFilterOnLogout$2 = parameters['page-filter-on-logout'];
        this._webSection$2 = parameters['web-section'];
    },
    
    preTransformation: function AccountsDetailsComponent_AccountsDetailsComponent$preTransformation(eventArgs) {
        if (!this._accountService$2.get_accountsDetails() && this._userService$2.isLoggedIn()) {
            this._accountService$2.onUserChanged(null);
        }
    },
    
    renderComplete: function AccountsDetailsComponent_AccountsDetailsComponent$renderComplete(eventArgs) {
        this.refreshBalance();
    },
    
    get_isComponentVisible: function AccountsDetailsComponent_AccountsDetailsComponent$get_isComponentVisible() {
        return (this.isVisible(this._parameters.get_visibleOn(), this._parameters.get_notVisibleOn(), this._navigationService$2.getAction()) && this._userService$2.isLoggedIn());
    },
    
    getXsltParameters: function AccountsDetailsComponent_AccountsDetailsComponent$getXsltParameters(contextObject) {
        var xsltParameters = {};
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        xsltParameters['web-section'] = this._webSection$2;
        if (this._userService$2.get_personalDetails()) {
            xsltParameters['name'] = this._userService$2.get_personalDetails().FullName;
        }
        if (this._accountService$2.get_accountsDetails()) {
            xsltParameters['trading-cache-balance'] = this._accountService$2.get_creditAccountDetails().TradingBalance.format('N', true);
            xsltParameters['account-number'] = this._accountService$2.get_creditAccountDetails().AccountNumber;
            xsltParameters['currency-symbol'] = this._accountService$2.getCurrencySimbol();
            var cashBalance = this._accountService$2.get_creditAccountDetails().WithdrawalBalance;
            xsltParameters['cash-balance'] = ((cashBalance < 0) ? '-' : '') + cashBalance.format('N2', true);
            var creditLimit = this._accountService$2.get_creditAccountDetails().TradingBalance - this._accountService$2.get_creditAccountDetails().WithdrawalBalance;
            xsltParameters['credit-limit'] = ((creditLimit < 0) ? '-' : '') + creditLimit.format('N2', true);
            var freeBalance = this._accountService$2.get_freeAccountDetails().WithdrawalBalance;
            xsltParameters['free-balance'] = ((freeBalance < 0) ? '-' : '') + freeBalance.format('N2', true);
            var availableFunds = this._accountService$2.get_creditAccountDetails().TradingBalance + this._accountService$2.get_freeAccountDetails().TradingBalance;
            xsltParameters['available-funds'] = ((availableFunds < 0) ? '-' : '') + availableFunds.format('N2', true);
            if (this._accountService$2.get_preferences()) {
                xsltParameters['is-account-balance-constantly-displayed'] = this._accountService$2.get_preferences().IsAccountBalanceConstantlyDisplayed;
                xsltParameters['is-call-centre-account-number-constantly-displayed'] = this._accountService$2.get_preferences().IsCallCentreAccountNumberConstantlyDisplayed;
            }
        }
        return xsltParameters;
    },
    
    refreshBalance: function AccountsDetailsComponent_AccountsDetailsComponent$refreshBalance() {
        this._log.debug('RefreshBalance');
        this._accountService$2.fetchAccountsDetails();
    },
    
    logout: function AccountsDetailsComponent_AccountsDetailsComponent$logout() {
        this._log.debug('Logout');
        this.disable();
        this._userService$2.logout(Delegate.create(this, function(result) {
            this.enable();
            this.changeActionOnLogout();
            this.changePageAreaOnLogout();
        }), Delegate.create(this, function(exception) {
            this.enable();
        }));
    },
    
    changeActionOnLogout: function AccountsDetailsComponent_AccountsDetailsComponent$changeActionOnLogout() {
        if (!String.isNullOrEmpty(this._changeActionOnLogout$2)) {
            var pageFilter = this._navigationService$2.getPageFilter();
            pageFilter['action'] = this._changeActionOnLogout$2;
            this._navigationService$2.setPageFilter(pageFilter);
        }
    },
    
    changePageAreaOnLogout: function AccountsDetailsComponent_AccountsDetailsComponent$changePageAreaOnLogout() {
        if (!String.isNullOrEmpty(this._changePageAreaOnLogout$2)) {
            if (!String.isNullOrEmpty(this._changePageFilterOnLogout$2)) {
                var pageFilter = {};
                var key = String.Empty;
                var value = String.Empty;
                var pageFilterConfig = this._changePageFilterOnLogout$2.split('|');
                for (var i = 0; i < pageFilterConfig.length; i++) {
                    if (i % 2 === 1) {
                        value = pageFilterConfig[i].toString();
                    }
                    else {
                        key = pageFilterConfig[i].toString();
                    }
                    pageFilter[key] = value;
                }
                this.goTo(this._changePageAreaOnLogout$2, pageFilter);
            }
            else {
                this.goTo(this._changePageAreaOnLogout$2, {});
            }
        }
    },
    
    goTo: function AccountsDetailsComponent_AccountsDetailsComponent$goTo(pageArea, pageFilter) {
        this._navigationService$2.goTo(pageArea, pageFilter);
        return false;
    },
    
    goToPageArea: function AccountsDetailsComponent_AccountsDetailsComponent$goToPageArea(pageArea) {
        var pageFilter = this._navigationService$2.getPageFilter();
        return this.goTo(pageArea, pageFilter);
    },
    
    removeBSselections: function AccountsDetailsComponent_AccountsDetailsComponent$removeBSselections() {
        this._betSlipService$2.removeAllSelections();
    }
}


AccountsDetailsComponent.AccountsDetailsComponent.createClass('AccountsDetailsComponent.AccountsDetailsComponent', Framework.Component.AbstractXsltBasedComponent, NavigationService.IPageFilterChangedListener, AccountService.IBalanceChangedListener, AccountService.IAccountPreferencesChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsLoginComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsLoginComponent.BoyleSportsLoginComponent

BoyleSportsLoginComponent.BoyleSportsLoginComponent = function BoyleSportsLoginComponent_BoyleSportsLoginComponent() {
    BoyleSportsLoginComponent.BoyleSportsLoginComponent.constructBase(this);
}


BoyleSportsLoginComponent.BoyleSportsLoginComponent.createClass('BoyleSportsLoginComponent.BoyleSportsLoginComponent', BoyleSportsAbstractComponents.BoyleSportsLoginComponent.BoyleSportsAbstractLoginComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('GamesHostLoginComponent');

////////////////////////////////////////////////////////////////////////////////
// GamesHostLoginComponent.GamesHostLoginComponent

GamesHostLoginComponent.GamesHostLoginComponent = function GamesHostLoginComponent_GamesHostLoginComponent() {
    GamesHostLoginComponent.GamesHostLoginComponent.constructBase(this);
}
GamesHostLoginComponent.GamesHostLoginComponent.prototype = {
    _gamesHostService$1: null,
    _autoLogin$1: null,
    _autoLogout$1: null,
    
    setGamesHostService: function GamesHostLoginComponent_GamesHostLoginComponent$setGamesHostService(gamesHostService) {
        this._log.debug('SetGamesHostService');
        this._gamesHostService$1 = gamesHostService;
    },
    
    _userService$1: null,
    
    setUserService: function GamesHostLoginComponent_GamesHostLoginComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function GamesHostLoginComponent_GamesHostLoginComponent$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 GamesHostLoginComponent_GamesHostLoginComponent$init(environment, componentInstanceName, domElementId, parameters) {
        GamesHostLoginComponent.GamesHostLoginComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._autoLogin$1 = (parameters['auto-login']).toLowerCase();
        this._autoLogout$1 = (parameters['auto-logout']).toLowerCase();
    },
    
    start: function GamesHostLoginComponent_GamesHostLoginComponent$start() {
        this.repaint();
    },
    
    repaint: function GamesHostLoginComponent_GamesHostLoginComponent$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 GamesHostLoginComponent_GamesHostLoginComponent$_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 GamesHostLoginComponent_GamesHostLoginComponent$_logoutSuccess$1(result) {
        this._log.debug('logoutSuccess');
    },
    
    _logoutFailure$1: function GamesHostLoginComponent_GamesHostLoginComponent$_logoutFailure$1(e) {
        this._log.debug('logoutFailure: ' + e.message);
    },
    
    _loginSuccess$1: function GamesHostLoginComponent_GamesHostLoginComponent$_loginSuccess$1(result) {
        this._log.debug('loginSuccess');
    },
    
    _loginFailure$1: function GamesHostLoginComponent_GamesHostLoginComponent$_loginFailure$1(e) {
        this._log.debug('loginFailure: ' + e.message);
    },
    
    repaintForAdmin: function GamesHostLoginComponent_GamesHostLoginComponent$repaintForAdmin() {
        GamesHostLoginComponent.GamesHostLoginComponent.callBase(this, 'disableForAdmin');
    }
}


GamesHostLoginComponent.GamesHostLoginComponent.createClass('GamesHostLoginComponent.GamesHostLoginComponent', Framework.Component.AbstractComponent, UserService.IUserChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsTreeNavigationComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsTreeNavigationComponent.BoyleSportsTreeNavigationComponent

BoyleSportsTreeNavigationComponent.BoyleSportsTreeNavigationComponent = function BoyleSportsTreeNavigationComponent_BoyleSportsTreeNavigationComponent() {
    BoyleSportsTreeNavigationComponent.BoyleSportsTreeNavigationComponent.constructBase(this);
}


BoyleSportsTreeNavigationComponent.BoyleSportsTreeNavigationComponent.createClass('BoyleSportsTreeNavigationComponent.BoyleSportsTreeNavigationComponent', BoyleSportsAbstractComponents.BoyleSportsTreeNavigationComponent.BoyleSportsAbstractTreeNavigationComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('OddsTypeSelectorComponent');

////////////////////////////////////////////////////////////////////////////////
// OddsTypeSelectorComponent.OddsTypeSelectorComponent

OddsTypeSelectorComponent.OddsTypeSelectorComponent = function OddsTypeSelectorComponent_OddsTypeSelectorComponent() {
    OddsTypeSelectorComponent.OddsTypeSelectorComponent.constructBase(this);
}
OddsTypeSelectorComponent.OddsTypeSelectorComponent.prototype = {
    _parameters$1: null,
    _userOddsFormat$1: null,
    _defaultOddsFormat$1: 'FRACTIONS',
    _fixedOddsBettingService$1: null,
    
    setFixedOddsBettingService: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$setFixedOddsBettingService(fixedOddsBettingService) {
        this._log.debug('SetFixedOddsBettingService');
        this._fixedOddsBettingService$1 = fixedOddsBettingService;
    },
    
    onOddsTypeChanged: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$onOddsTypeChanged(fixedOddsBettingService) {
        this._log.debug('OnOddsTypeChanged');
        this.repaint();
    },
    
    _userService$1: null,
    
    setUserService: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        this.repaint();
    },
    
    init: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$init(environment, componentInstanceName, domElementId, parameters) {
        OddsTypeSelectorComponent.OddsTypeSelectorComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = parameters;
        this._userOddsFormat$1 = parameters['default-odds-format'];
    },
    
    start: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$start() {
        this.repaint();
    },
    
    repaint: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$repaint() {
        this._log.debug('Repaint');
        var xsltParameters = {};
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        xsltParameters['component-dom-element-id'] = this._domElementId;
        if (this._fixedOddsBettingService$1.getPreferences()) {
            xsltParameters['odds-type'] = this._fixedOddsBettingService$1.getPreferences().OddsType.toUpperCase();
        }
        else {
            if (this._fixedOddsBettingService$1.isOddsTypeValid(this._userOddsFormat$1)) {
                xsltParameters['odds-type'] = this._userOddsFormat$1.toUpperCase();
                this._fixedOddsBettingService$1.setOddsType(this._userOddsFormat$1.toUpperCase());
            }
            else {
                xsltParameters['odds-type'] = this._defaultOddsFormat$1;
            }
        }
        this._environment.transformAndUpdate(this._domElementId, null, this._parameters$1['xslt-url'], xsltParameters, Delegate.create(this, function() {
            Framework.Behavior.Binding.BehaviorBinder.autoBind(this._environment.getDomElement(this._domElementId), (this));
        }));
    },
    
    setOddsTypeEventHandler: function OddsTypeSelectorComponent_OddsTypeSelectorComponent$setOddsTypeEventHandler(sender, eventArgs) {
        var oddsType = (eventArgs.domElement).value;
        this._log.debug('SetOddsType oddsType = [' + oddsType + ']');
        this._userOddsFormat$1 = oddsType;
        this._fixedOddsBettingService$1.setOddsType(oddsType);
    }
}


OddsTypeSelectorComponent.OddsTypeSelectorComponent.createClass('OddsTypeSelectorComponent.OddsTypeSelectorComponent', Framework.Component.AbstractComponent, FixedOddsBettingService.IOddsTypeChangedListener, UserService.IUserChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BannerContainerComponent');

////////////////////////////////////////////////////////////////////////////////
// BannerContainerComponent.BannerContainerComponent

BannerContainerComponent.BannerContainerComponent = function BannerContainerComponent_BannerContainerComponent() {
    this._nagivationSection$2 = String.Empty;
    this._bannerImagesBaseURL$2 = String.Empty;
    this._bannerCategory$2 = String.Empty;
    this._absoluteImagePrefix$2 = String.Empty;
    this._currentTimeout$2 = -1;
    BannerContainerComponent.BannerContainerComponent.constructBase(this);
}
BannerContainerComponent.BannerContainerComponent.prototype = {
    _repaintOnUserChanged$2: false,
    _repaintOnPageFilterChanged$2: false,
    _isBannerRolling$2: false,
    _IsInRunningState$2: true,
    _bannerItemCount$2: 0,
    _autoRefreshPeriod$2: null,
    _currentFrame$2: null,
    _hasRendered$2: false,
    
    setPageFilterEventHandler: function BannerContainerComponent_BannerContainerComponent$setPageFilterEventHandler(sender, eventArgs) {
        this.setPageFilter(eventArgs.parameters.getAsString('parameters').split(','));
        window.event.returnValue = false;
    },
    
    setMarketEventHandler: function BannerContainerComponent_BannerContainerComponent$setMarketEventHandler(sender, eventArgs) {
        this.setMarket(eventArgs.parameters.getAsString('idfomarket'));
        window.event.returnValue = false;
    },
    
    setBONavigationEventHandler: function BannerContainerComponent_BannerContainerComponent$setBONavigationEventHandler(sender, eventArgs) {
        this.setBONavigation(eventArgs.parameters.getAsString('idfwbonavigation'));
        window.event.returnValue = false;
    },
    
    setMarketGroupEventHandler: function BannerContainerComponent_BannerContainerComponent$setMarketGroupEventHandler(sender, eventArgs) {
        this.setMarketGroup(eventArgs.parameters.getAsString('idfwmarketgroup'));
        window.event.returnValue = false;
    },
    
    setRollingBannerParametersEventHandler: function BannerContainerComponent_BannerContainerComponent$setRollingBannerParametersEventHandler(sender, eventArgs) {
        this.setRollingBannerParameters(eventArgs.parameters.getAsNumber('banneritemcount'), eventArgs.parameters.getAsNumber('rollinginterval'));
        window.event.returnValue = false;
    },
    
    executeScriptEventHandler: function BannerContainerComponent_BannerContainerComponent$executeScriptEventHandler(sender, eventArgs) {
        try {
            eval(eventArgs.parameters.getAsString('script'));
        }
        catch (e) {
        }
        window.event.returnValue = false;
    },
    
    _userService$2: null,
    _navigationService$2: null,
    _bettingNavigationService$2: null,
    
    setNavigationService: function BannerContainerComponent_BannerContainerComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$2 = navigationService;
        this._navigationService$2.registerTopicalizedPageFilterChangedListener(this, BettingNavigationService.BettingNavigationService.navigationTypes);
        this._navigationService$2.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.action);
    },
    
    onPageFilterChanged: function BannerContainerComponent_BannerContainerComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        if (this._repaintOnPageFilterChanged$2) {
            this.updateOnlyIfFirstRender();
        }
    },
    
    setUserService: function BannerContainerComponent_BannerContainerComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$2 = userService;
    },
    
    onUserChanged: function BannerContainerComponent_BannerContainerComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        this.update();
    },
    
    setBettingNavigationService: function BannerContainerComponent_BannerContainerComponent$setBettingNavigationService(bettingNavigationService) {
        this._log.debug('SetBettingNavigationService');
        this._bettingNavigationService$2 = bettingNavigationService;
    },
    
    init: function BannerContainerComponent_BannerContainerComponent$init(environment, componentInstanceName, domElementId, parameters) {
        this._repaintOnUserChanged$2 = Boolean.parse(parameters['repaint-onuserchanged']);
        this._repaintOnPageFilterChanged$2 = Boolean.parse(parameters['repaint-onpagefilterchanged']);
        this._bannerImagesBaseURL$2 = parameters['banner-images-base-url'];
        this._bannerCategory$2 = parameters['category'];
        this._absoluteImagePrefix$2 = parameters['absolute-image-prefix'];
        this._currentFrame$2 = -1;
    },
    
    renderComplete: function BannerContainerComponent_BannerContainerComponent$renderComplete(eventArgs) {
        if (this.get_isComponentVisible()) {
            if (this._isBannerRolling$2 && this._bannerItemCount$2 > 0) {
                this.runSlideShow(this._bannerItemCount$2, '');
            }
        }
        this._hasRendered$2 = true;
    },
    
    getXsltParameters: function BannerContainerComponent_BannerContainerComponent$getXsltParameters(contextObject) {
        var xsltParameters = {};
        xsltParameters['component-instance-name'] = this._componentInstanceName;
        xsltParameters['component-dom-element-id'] = this._domElementId;
        xsltParameters['banner-images-base-url'] = this._bannerImagesBaseURL$2;
        xsltParameters['category'] = this._bannerCategory$2;
        xsltParameters['absolute-image-prefix'] = this._absoluteImagePrefix$2;
        xsltParameters['is-user-logged'] = this._userService$2.isLoggedIn();
        return xsltParameters;
    },
    
    get_isComponentVisible: function BannerContainerComponent_BannerContainerComponent$get_isComponentVisible() {
        var navtypes = null;
        if (this._bettingNavigationService$2.getNavigationTypes()) {
            navtypes = this._bettingNavigationService$2.getNavigationTypes().split(',');
        }
        return ((this.isVisible(this._parameters.get_visibleOn(), this._parameters.get_notVisibleOn(), this._navigationService$2.getAction())) && this.isNavigationTypesInAValidCombination(navtypes));
    },
    
    setPageFilter: function BannerContainerComponent_BannerContainerComponent$setPageFilter(internalParams) {
        if (internalParams.length > 1) {
            var action = internalParams[0].toString();
            var area = internalParams[1].toString();
            var pageFilter = {};
            pageFilter['action'] = action;
            this._log.debug('SetPageFilter');
            this._navigationService$2.goTo(area, pageFilter);
            return false;
        }
        return false;
    },
    
    setMarket: function BannerContainerComponent_BannerContainerComponent$setMarket(IDFOMarket) {
        this._log.debug(String.format('SetMarketEntry=[{0}]', IDFOMarket));
        this._bettingNavigationService$2.setMarketFromEvent(IDFOMarket);
    },
    
    setBONavigation: function BannerContainerComponent_BannerContainerComponent$setBONavigation(IDFWBONavigation) {
        this._log.debug(String.format('SetBONavigation=[{0}]', IDFWBONavigation));
        this._bettingNavigationService$2.setBONavigation(0, IDFWBONavigation);
    },
    
    setMarketGroup: function BannerContainerComponent_BannerContainerComponent$setMarketGroup(IDFWMarketGroup) {
        this._log.debug(String.format('SetMarketGroup IDFWMarketGroup=[{0}]', IDFWMarketGroup));
        this._bettingNavigationService$2.setMarketGroup(0, IDFWMarketGroup);
    },
    
    setRollingBannerParameters: function BannerContainerComponent_BannerContainerComponent$setRollingBannerParameters(banneritemcount, rollinginterval) {
        this._isBannerRolling$2 = true;
        this._bannerItemCount$2 = banneritemcount;
        this._autoRefreshPeriod$2 = rollinginterval * 1000;
    },
    
    runSlideShow: function BannerContainerComponent_BannerContainerComponent$runSlideShow(banners, action) {
        if (this.get_isComponentVisible()) {
            this._clearTimeout$2();
            this._calculateNextFrame$2(banners);
            this._renderUI$2(banners, this._currentFrame$2);
            if (this._IsInRunningState$2) {
                this._currentTimeout$2 = window.setTimeout(Delegate.create(this, function() {
                    this.runSlideShow(banners, '');
                }), this._autoRefreshPeriod$2);
            }
        }
    },
    
    _calculateNextFrame$2: function BannerContainerComponent_BannerContainerComponent$_calculateNextFrame$2(banners) {
        this._currentFrame$2++;
        if (this._currentFrame$2 >= banners) {
            this._currentFrame$2 = 0;
        }
    },
    
    _clearTimeout$2: function BannerContainerComponent_BannerContainerComponent$_clearTimeout$2() {
        if (this._currentTimeout$2 !== -1) {
            window.clearTimeout(this._currentTimeout$2);
        }
    },
    
    _renderUI$2: function BannerContainerComponent_BannerContainerComponent$_renderUI$2(banners, active) {
        for (var i = 0; i < banners; i++) {
            this.getPrivateDomElement(i.toString()).style.display = ((i === active) ? 'block' : 'none');
        }
    },
    
    updateOnlyIfFirstRender: function BannerContainerComponent_BannerContainerComponent$updateOnlyIfFirstRender() {
        if (!this._hasRendered$2) {
            this.update();
        }
        else {
            if (this.get_isComponentVisible()) {
                this.show();
            }
            else {
                this.hide();
            }
        }
    }
}


BannerContainerComponent.BannerContainerComponent.createClass('BannerContainerComponent.BannerContainerComponent', Framework.Component.AbstractXsltBasedComponent, UserService.IUserChangedListener, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsBetSlipComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsBetSlipComponent.BoyleSportsBetSlipComponent

BoyleSportsBetSlipComponent.BoyleSportsBetSlipComponent = function BoyleSportsBetSlipComponent_BoyleSportsBetSlipComponent() {
    BoyleSportsBetSlipComponent.BoyleSportsBetSlipComponent.constructBase(this);
}


BoyleSportsBetSlipComponent.BoyleSportsBetSlipComponent.createClass('BoyleSportsBetSlipComponent.BoyleSportsBetSlipComponent', BoyleSportsAbstractComponents.BoyleSportsBetSlipComponent.BoyleSportsAbstractBetSlipComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('ScoreboardNavigationComponent');

////////////////////////////////////////////////////////////////////////////////
// ScoreboardNavigationComponent.ScoreboardNavigationComponent

ScoreboardNavigationComponent.ScoreboardNavigationComponent = function ScoreboardNavigationComponent_ScoreboardNavigationComponent() {
    ScoreboardNavigationComponent.ScoreboardNavigationComponent.constructBase(this);
}
ScoreboardNavigationComponent.ScoreboardNavigationComponent.prototype = {
    
    navigateToLiveEvent: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$navigateToLiveEvent(sb_id, type, live_id, ap_id) {
        var isInLiveBettingPageArea = (ScoreboardAbstractComponents.Scoreboard.CommonScoreboardAbstractComponent.liveBettingPageArea.toLowerCase() === this._environment.getPageArea());
        var filter = this._navigationService.getPageFilter();
        filter['sb_id'] = sb_id;
        filter['sb_eventid'] = live_id;
        filter['sb_apid'] = ap_id;
        filter['sb_type'] = type;
        filter['is_live'] = 'true';
        this._navigationService.goTo(ScoreboardAbstractComponents.Scoreboard.CommonScoreboardAbstractComponent.liveBettingPageArea, filter);
    },
    
    navigateToUpcomingEvent: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$navigateToUpcomingEvent(type, live_id) {
        var filter = {};
        filter['navigationtypes'] = type;
        filter['event'] = live_id;
        filter['is_live'] = 'false';
        this._navigationService.goTo(ScoreboardAbstractComponents.Scoreboard.CommonScoreboardAbstractComponent.sportsHomePageArea, filter);
    },
    
    navigateToAntePostEvent: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$navigateToAntePostEvent(id) {
    },
    
    resize: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$resize(height) {
        this._environment.getDomElement(this.get_domElementId()).style.height = height + 'px';
    },
    
    onPageFilterChanged: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
    },
    
    onOddsTypeChanged: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$onOddsTypeChanged(eventSource) {
    },
    
    onSelectionsAdded: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$onSelectionsAdded(eventSource, selection) {
    },
    
    onSelectionsRemoved: function ScoreboardNavigationComponent_ScoreboardNavigationComponent$onSelectionsRemoved(eventSource, selection) {
    }
}


ScoreboardNavigationComponent.ScoreboardNavigationComponent.createClass('ScoreboardNavigationComponent.ScoreboardNavigationComponent', ScoreboardAbstractComponents.Scoreboard.CommonScoreboardAbstractComponent, BetSlipService.ISelectionsAddedListener, BetSlipService.ISelectionsRemovedListener, FixedOddsBettingService.IOddsTypeChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
// BoyleSportsTabbedHeadlineComponent.js
//


Type.createNamespace('BoyleSportsTabbedHeadlineComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent

BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent = function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent() {
    BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent.constructBase(this);
}
BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent.prototype = {
    _parameters$1: null,
    _repaintOnUserChanged$1: false,
    _displayDependingUserLoggedin$1: '',
    _xslt_url$1: null,
    _xml_url$1: null,
    _header_text$1: null,
    _category$1: null,
    _headline_limit$1: null,
    _headline_word_limit$1: 0,
    _headline_images_base_url$1: null,
    _child_titles$1: null,
    _headlines_first$1: 0,
    _userService$1: null,
    
    setUserService: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        if (this._repaintOnUserChanged$1) {
            this.repaint();
        }
    },
    
    init: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$init(environment, componentInstanceName, domElementId, parameters) {
        BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._repaintOnUserChanged$1 = Boolean.parse(parameters['repaint-onuserchanged']);
        this._displayDependingUserLoggedin$1 = parameters['display-depending-user-loggedin'];
        this._xslt_url$1 = parameters['xslt-url'];
        this._xml_url$1 = parameters['xml-url'];
        this._header_text$1 = parameters['header-text'];
        this._category$1 = parameters['category'];
        this._headline_limit$1 = parameters['headline-limit'];
        this._headline_word_limit$1 = parameters['headline-word-limit'];
        this._headline_images_base_url$1 = parameters['headline-images-base-url'];
        this._child_titles$1 = (parameters['child-titles']).split(',');
        this._headlines_first$1 = parameters['headlines-first'];
    },
    
    repaint: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$repaint() {
        this._log.debug('Repaint');
        var showComponent = true;
        if (this._displayDependingUserLoggedin$1 === 'loggedin') {
            showComponent = showComponent && (this._userService$1.isLoggedIn());
        }
        else if (this._displayDependingUserLoggedin$1 === 'notloggedin') {
            showComponent = showComponent && (!this._userService$1.isLoggedIn());
        }
        if (!showComponent) {
            this.hide();
            return;
        }
        else {
            this.show();
        }
        var xsltParams = {};
        xsltParams['component-instance-name'] = this._componentInstanceName;
        xsltParams['compElementId'] = this._domElementId;
        xsltParams['header-text'] = this._header_text$1;
        xsltParams['headline-limit'] = this._headline_limit$1;
        xsltParams['headline-images-base-url'] = this._headline_images_base_url$1;
        xsltParams['child-titles'] = this._child_titles$1.join(',');
        xsltParams['child-titles-count'] = ((xsltParams['child-titles'] !== '') ? this._child_titles$1.length : 0);
        xsltParams['headlines-first'] = this._headlines_first$1;
        var xml_url = this._xml_url$1.replace('${limit}', this._headline_limit$1).replace('${category}', this._category$1);
        xsltParams['xml-url'] = xml_url;
        this._environment.transformAndUpdate(this._domElementId, xml_url, this._xslt_url$1, xsltParams, Delegate.create(this, function() {
            var headerContainer = this.getPrivateDomElement('header');
            if (!isNullOrUndefined(headerContainer)) {
                headerContainer.attachEvent('onclick', Delegate.create(this, function() {
                    this._toggleContent$1();
                }));
            }
            var tabPosition = 1;
            var tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
            while (!isNullOrUndefined(tabHeaderElement)) {
                tabHeaderElement.attachEvent('onclick', Delegate.create(this, function() {
                    window.event.returnValue = false;
                    var targetElement = window.event.srcElement;
                    while (!isNullOrUndefined(targetElement)) {
                        if (targetElement.tagName === 'LI') {
                            break;
                        }
                        targetElement = targetElement.parentNode;
                    }
                    if (isNullOrUndefined(targetElement)) {
                        return;
                    }
                    tabPosition = 1;
                    tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
                    while (!isNullOrUndefined(tabHeaderElement)) {
                        if (tabHeaderElement === targetElement) {
                            this._showTab$1(tabPosition);
                        }
                        else if (this._tabVisible$1(tabPosition)) {
                            this._hideTab$1(tabPosition);
                        }
                        tabPosition++;
                        tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
                    }
                }));
                if (!this._tabVisible$1(tabPosition)) {
                    this._hideTab$1(tabPosition);
                }
                else {
                    this._showTab$1(tabPosition);
                }
                var itemContent = this.getPrivateDomElement('tab' + tabPosition + '-content-body-content');
                if (!isNullOrUndefined(itemContent)) {
                    var content = itemContent.innerHTML;
                    content = this._trimTextUsingWords$1(content, this._headline_word_limit$1, '...');
                    itemContent.innerHTML = content;
                }
                tabPosition++;
                tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
            }
        }));
    },
    
    _toggleContent$1: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$_toggleContent$1() {
        var headerContainer = this.getPrivateDomElement('header');
        var contentContainer = this.getPrivateDomElement('content');
        var footerContainer = this.getPrivateDomElement('footer');
        if (contentContainer.style.display === 'none') {
            if (!isNullOrUndefined(headerContainer)) {
                this._environment.safelyRemoveCssClass(String.format('{0}-header', this._domElementId), 'tab-header-collapsed');
            }
            if (!isNullOrUndefined(contentContainer)) {
                contentContainer.style.display = '';
            }
            if (!isNullOrUndefined(footerContainer)) {
                footerContainer.style.display = '';
            }
        }
        else {
            if (!isNullOrUndefined(headerContainer)) {
                this._environment.safelySetCssClass(String.format('{0}-header', this._domElementId), 'tab-header-collapsed');
            }
            if (!isNullOrUndefined(contentContainer)) {
                contentContainer.style.display = 'none';
            }
            if (!isNullOrUndefined(footerContainer)) {
                footerContainer.style.display = 'none';
            }
        }
    },
    
    _trimTextUsingWords$1: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$_trimTextUsingWords$1(text, wordLimit, suffix) {
        var words = text.split(new RegExp('\\s+'));
        if (words.length > wordLimit) {
            return words.extract(0, wordLimit).join(' ') + suffix;
        }
        return text;
    },
    
    _showTab$1: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$_showTab$1(tabPosition) {
        var tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
        var tabiconsElement = this.getPrivateDomElement('tab' + tabPosition + '-tabicons');
        var contentElement = this.getPrivateDomElement('tab' + tabPosition + '-content');
        if (!isNullOrUndefined(tabHeaderElement)) {
            ScriptFX.UI.Element.addCSSClass(tabHeaderElement, 'current');
            if (ScriptFX.UI.Element.containsCSSClass(tabHeaderElement, 'tab-child')) {
                ScriptFX.UI.Element.addCSSClass(tabHeaderElement, 'tab-child-current');
            }
        }
        if (!isNullOrUndefined(tabiconsElement)) {
            tabiconsElement.style.display = '';
        }
        if (!isNullOrUndefined(contentElement)) {
            contentElement.style.display = '';
        }
        if (ScriptFX.UI.Element.containsCSSClass(tabHeaderElement, 'tab-child')) {
            this._loadTabChild$1(tabPosition);
        }
    },
    
    _hideTab$1: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$_hideTab$1(tabPosition) {
        var tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
        var tabiconsElement = this.getPrivateDomElement('tab' + tabPosition + '-tabicons');
        var contentElement = this.getPrivateDomElement('tab' + tabPosition + '-content');
        if (!isNullOrUndefined(tabHeaderElement)) {
            ScriptFX.UI.Element.removeCSSClass(tabHeaderElement, 'current');
            ScriptFX.UI.Element.removeCSSClass(tabHeaderElement, 'tab-child-current');
        }
        if (!isNullOrUndefined(tabiconsElement)) {
            tabiconsElement.style.display = 'none';
        }
        if (!isNullOrUndefined(contentElement)) {
            contentElement.style.display = 'none';
        }
    },
    
    _tabVisible$1: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$_tabVisible$1(tabPosition) {
        var tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
        if (!isNullOrUndefined(tabHeaderElement)) {
            if (ScriptFX.UI.Element.containsCSSClass(tabHeaderElement, 'current')) {
                return true;
            }
        }
        return false;
    },
    
    _loadTabChild$1: function BoyleSportsTabbedHeadlineComponent_BoyleSportsTabbedHeadlineComponent$_loadTabChild$1(tabPosition) {
        var tabHeaderElement = this.getPrivateDomElement('tab' + tabPosition);
        if (isNullOrUndefined(tabHeaderElement)) {
            return;
        }
        if (ScriptFX.UI.Element.containsCSSClass(tabHeaderElement, 'tab-child-loaded')) {
            return;
        }
        var childNumber = (tabHeaderElement.getAttribute('child-number')) - 1;
        var childComponent = this.get_children()[childNumber];
        var childElementId = childComponent.get_domElementId();
        var childElement = document.createElement('DIV');
        childElement.id = childElementId;
        childElement = this.getPrivateDomElement('tab' + tabPosition + '-content-child').appendChild(childElement);
        childComponent.set_domElementId(childElementId);
        if (!String.isNullOrEmpty(childComponent.get_cssClass())) {
            childElement.className = childComponent.get_cssClass();
        }
        childComponent.start();
        ScriptFX.UI.Element.addCSSClass(tabHeaderElement, 'tab-child-loaded');
    }
}


BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent.createClass('BoyleSportsTabbedHeadlineComponent.BoyleSportsTabbedHeadlineComponent', Framework.AbstractComponent, UserService.IUserChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsTabContainerGroupComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsTabContainerGroupComponent.BoyleSportsTabContainerGroupComponent

BoyleSportsTabContainerGroupComponent.BoyleSportsTabContainerGroupComponent = function BoyleSportsTabContainerGroupComponent_BoyleSportsTabContainerGroupComponent() {
    BoyleSportsTabContainerGroupComponent.BoyleSportsTabContainerGroupComponent.constructBase(this);
}
BoyleSportsTabContainerGroupComponent.BoyleSportsTabContainerGroupComponent.prototype = {
    
    createConcreteTabContainerInstance: function BoyleSportsTabContainerGroupComponent_BoyleSportsTabContainerGroupComponent$createConcreteTabContainerInstance(domElement, parameters) {
        return this.createDynamicComponent(BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent, domElement, true, parameters);
    }
}


BoyleSportsTabContainerGroupComponent.BoyleSportsTabContainerGroupComponent.createClass('BoyleSportsTabContainerGroupComponent.BoyleSportsTabContainerGroupComponent', BoyleSportsAbstractComponents.BoyleSportsTabContainerGroupComponent.BoyleSportsAbstractTabContainerGroupComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('TrackingComponent');

////////////////////////////////////////////////////////////////////////////////
// TrackingComponent.TrackingComponent

TrackingComponent.TrackingComponent = function TrackingComponent_TrackingComponent() {
    this._trackingEvents$2 = {};
    TrackingComponent.TrackingComponent.constructBase(this);
}
TrackingComponent.TrackingComponent.prototype = {
    _trackingEventsXmlFile$2: 'regularTracking.xml',
    _matchingFimsid$2: null,
    _iDMMCustomer$2: 0,
    _replaceTokenWithFimsID$2: false,
    _navigationService$2: null,
    
    setNavigationService: function TrackingComponent_TrackingComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$2 = navigationService;
    },
    
    onPageFilterChanged: function TrackingComponent_TrackingComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        this.update();
    },
    
    _accountService$2: null,
    
    setAccountService: function TrackingComponent_TrackingComponent$setAccountService(accountService) {
        this._log.debug('SetAccountService');
        this._accountService$2 = accountService;
    },
    
    onDepositExecuted: function TrackingComponent_TrackingComponent$onDepositExecuted(eventSource) {
        this._log.debug('OnDepositExecuted');
        this._raiseTrackingEvent$2('accountService.deposit');
    },
    
    _userService$2: null,
    
    setUserService: function TrackingComponent_TrackingComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$2 = userService;
    },
    
    onUserRegistered: function TrackingComponent_TrackingComponent$onUserRegistered() {
        this._log.debug('OnUserRegistered');
        this._userService$2.getIDMMCustomer(Delegate.create(this, function(result) {
            this._iDMMCustomer$2 = result;
            this._raiseTrackingEvent$2('userService.registration');
        }), Delegate.create(this, function(ex) {
        }));
    },
    
    init: function TrackingComponent_TrackingComponent$init(environment, componentInstanceName, domElementId, parameters) {
        if (Object.keyExists(parameters, 'replace-token-with-FimsID')) {
            this._replaceTokenWithFimsID$2 = Boolean.parse(parameters['replace-token-with-FimsID']);
        }
        if (Object.keyExists(parameters, 'matching-fimsid')) {
            this._matchingFimsid$2 = parameters['matching-fimsid'];
        }
        if (Object.keyExists(parameters, 'tracking-events-xml-file')) {
            this._trackingEventsXmlFile$2 = parameters['tracking-events-xml-file'];
        }
    },
    
    preTransformation: function TrackingComponent_TrackingComponent$preTransformation(eventArgs) {
        eventArgs.get_contextObject().contentUrl = String.format('/areas/{0}/template_{1}_{2}/components/TrackingComponent/{3}', this._environment.getPageArea(), this._environment.getRegion(), this._environment.getLanguage(), this._trackingEventsXmlFile$2);
    },
    
    xmlContentReceived: function TrackingComponent_TrackingComponent$xmlContentReceived(eventArgs) {
        if (eventArgs.get_contentXmlDocument().hasChildNodes()) {
            this._loadTrackingEventsFromXML$2(eventArgs.get_contentXmlDocument());
            this._raiseTrackingEvent$2('pagArea.' + this._navigationService$2.getPageArea() + '.repaint');
        }
    },
    
    get_isComponentVisible: function TrackingComponent_TrackingComponent$get_isComponentVisible() {
        return this.isVisible(this._parameters.get_visibleOn(), this._parameters.get_notVisibleOn(), this._navigationService$2.getAction());
    },
    
    show: function TrackingComponent_TrackingComponent$show() {
        TrackingComponent.TrackingComponent.callBase(this, 'hide');
    },
    
    _raiseTrackingEvent$2: function TrackingComponent_TrackingComponent$_raiseTrackingEvent$2(trackingEvent) {
        if (Object.keyExists(this._trackingEvents$2, trackingEvent)) {
            var trackingHTMLtoInsert = this._trackingEvents$2[trackingEvent];
            if (!String.isNullOrEmpty(this._matchingFimsid$2)) {
                if (Framework.CookieUtil.getCookie(this._userService$2.get_fimsIDCookieName()) !== this._matchingFimsid$2) {
                    return;
                }
            }
            if (this._replaceTokenWithFimsID$2) {
                trackingHTMLtoInsert = String.format(trackingHTMLtoInsert, Framework.CookieUtil.getCookie(this._userService$2.get_fimsIDCookieName()), Framework.CookieUtil.getCookie(this._userService$2.get_fimsAdvertIDCookieName()), this._iDMMCustomer$2);
            }
            this._environment.updateDomElement(this._domElementId, trackingHTMLtoInsert);
        }
    },
    
    _loadTrackingEventsFromXML$2: function TrackingComponent_TrackingComponent$_loadTrackingEventsFromXML$2(trackingXML) {
        var trackingEventNodes = trackingXML.getElementsByTagName('trackingEvent');
        for (var i = 0; i < trackingEventNodes.length; i++) {
            if (trackingEventNodes[i].firstChild) {
                this._trackingEvents$2[trackingEventNodes[i].attributes.getNamedItem('name').text] = trackingEventNodes[i].firstChild.xml;
            }
        }
    }
}


TrackingComponent.TrackingComponent.createClass('TrackingComponent.TrackingComponent', Framework.Component.AbstractXsltBasedComponent, NavigationService.IPageFilterChangedListener, AccountService.IDepositExecutedListener, UserService.IUserIsRegisteredListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
// BoyleSportsSlideshowHeadlineComponent2.js
//


Type.createNamespace('BoyleSportsSlideshowHeadlineComponent2');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2

BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2 = function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2() {
    BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2.constructBase(this);
}
BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2.prototype = {
    _parameters$1: null,
    _repaintOnPageFilterChanged$1: false,

    _xslt_url$1: null,
    _content_url$1: null,

	_category$1: null,
	_limit$1: null,
	_headline_images_base_url$1: null,

	_title_text$1: null,

	_auto_refresh_period$1: null,

    _navigationService$1: null,
	_bettingNavigationService$1: null,

	_currentPanel$1: 1,
	_slideshowRunning$1: false,
	_slideshowTimer$1: null,

    setNavigationService: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
		this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, BettingNavigationService.BettingNavigationService.navigationTypes);
		this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.action);
        this._navigationService$1.registerTopicalizedPageFilterChangedListener(this, NavigationService.NavigationService.page);
    },

    onPageFilterChanged: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        if (this._repaintOnPageFilterChanged$1) {
            this.repaint();
        }
    },

    setBettingNavigationService: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$setBettingNavigationService(bettingNavigationService) {
		this._log.debug('SetBettingNavigationService');
		this._bettingNavigationService$1 = bettingNavigationService;
    },

    init: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$init(environment, componentInstanceName, domElementId, parameters) {
        BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);

        this._parameters$1 = new Framework.CommonComponentParameters(parameters);
        this._repaintOnPageFilterChanged$1 = Boolean.parse(parameters['repaint-onpagefilterchanged']);

        this._xslt_url$1 = parameters['xslt-url'];
        this._content_url$1 = parameters['content-url'];

		this._category$1 = parameters['category'];
		this._limit$1 = parameters['limit'];
		this._headline_images_base_url$1 = parameters['headline-images-base-url'];

		this._title_text$1 = parameters['title'];

		this._auto_refresh_period$1 = parameters['auto-refresh-period'];
    },

    repaint: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$repaint() {
        this._log.debug('Repaint');

		var navtypes = null;
		if (this._bettingNavigationService$1.getNavigationTypes()) {
			navtypes = this._bettingNavigationService$1.getNavigationTypes().split(',');
		}
		if ((!this.isVisible(this._parameters$1.get_visibleOn(), this._parameters$1.get_notVisibleOn(), this._navigationService$1.getAction())) || (!this.isNavigationTypesInAValidCombination(navtypes))) {
            this.hide();
			this.stopSlideshow();
            return;
        } else {
			this.show();
		}

		var content_url = this._content_url$1.replace('${limit}', this._limit$1).replace('${category}', this._category$1);

		var xsltParams = {};
		xsltParams['component-instance-name'] = this._componentInstanceName;
        xsltParams['compElementId'] = this._domElementId;

		xsltParams['title-text'] = this._title_text$1;
		xsltParams['headline-images-base-url'] = this._headline_images_base_url$1;

		var that = this;
        this._environment.transformAndUpdate(this._domElementId, content_url, this._xslt_url$1, xsltParams, Delegate.create(this, function() {
            Framework.Behavior.Binding.BehaviorBinder.autoBind(that._environment.getDomElement(that._domElementId), that);

			var $j = jQuery;

			$j('#' + that._domElementId + ' .slideshow-thumbs li a').css('opacity', .8);

			$j('#' + that._domElementId + ' .slideshow-thumbs li a').hover(
				function() {
					$j(this)
						.stop()
						.fadeTo(250, 1);
				},
				function() {
					$j(this)
						.stop()
						.fadeTo(250, .8);
				}
			);

			$j('#' + that._domElementId + ' .slideshow-thumbs a').click(function(event) {
				var linkTarget;
				try {
					linkTarget = /#(.*)$/.exec(this.href)[1];
				} catch(ex) {
					linkTarget = this.href;
				}

				that._slideToPanel$1(linkTarget);

				event.preventDefault();
			});

			$j('#' + that._domElementId).hover(
				function() {
					that.stopSlideshow();
				},
				function() {
					that.startSlideshow();
				}
			);

			that.startSlideshow();
        }));
    },

	stopSlideshow: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$() {
		if (that === undefined) {
			var that = this;
		}
		that._slideshowTimer$1 = clearTimeout(that._slideshowTimer$1);
		that._slideshowRunning$1 = false;
	},

	startSlideshow: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$startSlideShow() {
		if (that === undefined) {
			var that = this;
		}
		if (!that._slideshowRunning$1) {
			that._slideshowRunning$1 = true;
			that._slideshowTimer$1 = setTimeout(function() {
				that._slideshowRunning$1 = false;
				that._slideToNextPanel$1();
				that.startSlideshow();
			}, that._auto_refresh_period$1 * 1000);
		}
	},

	/*stopSlideshowEventHandler: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$stopSlideshowEventHandler(sender, eventArgs) {
		console.log('stopSlideshow | ' + Date());
	},

	startSlideshowEventHandler: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$startSlideshowEventHandler(sender, eventArgs) {
		var $j = jQuery;
		if (!$j(sender).closest('.SlideshowHeadlineComponent').length) {
			console.log('startSlideshow | ' + Date());
			console.log(sender);
			console.log(eventArgs);
			console.log(window.event);
		}
	},*/

	jumpToMarketEventHandler: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$jumpToMarketEventHandler(sender, eventArgs) {
		window.event.returnValue = false;

		var idfoevent = eventArgs.parameters.getAsString('idfoevent');
		var idfomarket = eventArgs.parameters.getAsString('idfomarket');
		var idfomarketgroup = eventArgs.parameters.getAsString('idfomarketgroup');
		var navigationtype = eventArgs.parameters.getAsString('navigationtype');
		var idfwbonavigation = eventArgs.parameters.getAsString('idfwbonavigation');
		
		var pageFilter = this._navigationService$1.getPageFilter();

		pageFilter[BettingNavigationService.BettingNavigationService.showAllMarkets] = null;

		delete pageFilter[BettingNavigationService.BettingNavigationService.event];
		delete pageFilter[BettingNavigationService.BettingNavigationService.marketFromMarketGroup];
		delete pageFilter[BettingNavigationService.BettingNavigationService.marketGroup];
		
		if (navigationtype && idfwbonavigation) {
			// TODO: Set bonavigation!
			pageFilter[BettingNavigationService.BettingNavigationService.navigationTypes] = this._bettingNavigationService$1.removeInvalidNavigationTypes('OTHERSPORT');
			this._bettingNavigationService$1.setNavigationTypes(navigationtype);
			this._bettingNavigationService$1.setBONavigationLevels(idfwbonavigation.split(','));
			//this._bettingNavigationService$1.SetBONavigation(0, idfwbonavigation);
		} else if (idfoevent || idfomarketgroup) {
			if (idfoevent) {
				pageFilter[BettingNavigationService.BettingNavigationService.event] = idfoevent;
			} else {
				pageFilter[BettingNavigationService.BettingNavigationService.marketGroup] = idfomarketgroup;
			}
			pageFilter[BettingNavigationService.BettingNavigationService.marketFromMarketGroup] = idfomarket;
			pageFilter[BettingNavigationService.BettingNavigationService.navigationTypes] = this._bettingNavigationService$1.removeInvalidNavigationTypes('OTHERSPORT');
			this._navigationService$1.setPageFilter(pageFilter);
		}
	},

	_slideToNextPanel$1: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$slideToNextPanel$1() {
		var $j = jQuery;

		var panelElement = $j('#' + this._domElementId + ' .content-container > .content.visible + .content');
		if (!panelElement.length) {
			panelElement = $j('#' + this._domElementId + ' .content-container > .content:first');
		}

		if (panelElement.length) {
			try {
				var panelID = /content_([^\s]+)/.exec(panelElement[0].className)[1];
				this._slideToPanel$1(panelID);
			} catch(ex) {
				return;
			}
		}
	},

	_slideToPanel$1: function BoyleSportsSlideshowHeadlineComponent2_BoyleSportsSlideshowHeadlineComponent2$slideToPanel$1(panelID) {
		var $j = jQuery;

		var panelElement = $j('#' + this._domElementId + ' .content_' + panelID);
		var panelContainerElement = $j('#' + this._domElementId + ' .content-container');
		var visiblePanelElements = $j('#' + this._domElementId + ' .content.visible');

		if (panelElement.length) {
			// store current order of panel elements
			var panelElements = [];
			for (var i = 0; i < panelContainerElement.children().length; i++) {
				panelElements[panelElements.length] = panelContainerElement.children()[i];
			}

			// move panel element after currently visible panel element
			if (!panelElement.hasClass('visible')) {
				panelElement
					.addClass('visible')
					.insertAfter(
						visiblePanelElements
							.removeClass('visible')
					);
				panelContainerElement.css('margin-left', visiblePanelElements.position().left * -1);
			}

			panelContainerElement
				.stop(true, true)
				.animate({
					marginLeft: panelElement.position().left * -1
				}, 500, function() {
					// restore order of panel elements
					for (var i = 0; i < panelElements.length; i++) {
						panelContainerElement.append(panelElements[i]);
						panelContainerElement.css('margin-left', panelElement.position().left * -1);
					}
				});
		}
	}
}

BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2.createClass('BoyleSportsSlideshowHeadlineComponent2.BoyleSportsSlideshowHeadlineComponent2', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener, BettingNavigationService.INextOfMarketGroupLoadedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('QuickMarketLinksComponent');

////////////////////////////////////////////////////////////////////////////////
// QuickMarketLinksComponent.QuickMarketLinksComponent

QuickMarketLinksComponent.QuickMarketLinksComponent = function QuickMarketLinksComponent_QuickMarketLinksComponent() {
    QuickMarketLinksComponent.QuickMarketLinksComponent.constructBase(this);
}
QuickMarketLinksComponent.QuickMarketLinksComponent.prototype = {
    _bettingNavigationService$1: null,
    
    setBettingNavigationService: function QuickMarketLinksComponent_QuickMarketLinksComponent$setBettingNavigationService(bettingNavigationService) {
        this._log.debug('SetBettingNavigationService');
        this._bettingNavigationService$1 = bettingNavigationService;
    },
    
    _navigationService$1: null,
    
    setNavigationService: function QuickMarketLinksComponent_QuickMarketLinksComponent$setNavigationService(navigationService) {
        this._log.debug('SetNavigationService');
        this._navigationService$1 = navigationService;
    },
    
    onPageFilterChanged: function QuickMarketLinksComponent_QuickMarketLinksComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        this.repaint();
    },
    
    repaint: function QuickMarketLinksComponent_QuickMarketLinksComponent$repaint() {
    }
}


QuickMarketLinksComponent.QuickMarketLinksComponent.createClass('QuickMarketLinksComponent.QuickMarketLinksComponent', Framework.AbstractComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('FastSearchResultsComponent');

////////////////////////////////////////////////////////////////////////////////
// FastSearchResultsComponent.FastSearchResultsComponent

FastSearchResultsComponent.FastSearchResultsComponent = function FastSearchResultsComponent_FastSearchResultsComponent() {
    FastSearchResultsComponent.FastSearchResultsComponent.constructBase(this);
}
FastSearchResultsComponent.FastSearchResultsComponent.prototype = {
    _fastSearchUrl$2: null,
    
    init: function FastSearchResultsComponent_FastSearchResultsComponent$init(environment, componentInstanceName, domElementId, parameters) {
        FastSearchResultsComponent.FastSearchResultsComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
        this._fastSearchUrl$2 = parameters['fast-search-content-url'];
    },
    
    start: function FastSearchResultsComponent_FastSearchResultsComponent$start() {
        FastSearchResultsComponent.FastSearchResultsComponent.callBase(this, 'start');
        this._navigationService.registerTopicalizedPageFilterChangedListener(this, BettingNavigationService.BettingNavigationService.phrase);
    },
    
    repaint: function FastSearchResultsComponent_FastSearchResultsComponent$repaint() {
        this._log.debug('Repaint');
        if (this.isVisible(this._parameters.get_visibleOn(), this._parameters.get_notVisibleOn(), this._navigationService.getAction())) {
            this.show();
            var xsltParameters = {};
            xsltParameters['component-instance-name'] = this._componentInstanceName;
            xsltParameters['component-dom-element-id'] = this._domElementId;
            var phrase = escape(this._bettingNavigationService.getSearchPhrase());
            var contentUrl = this._fastSearchUrl$2.replace('${phrase}', phrase);
            this._environment.transformAndUpdate(this._domElementId, contentUrl, this._parameters.get_xsltUrl(), xsltParameters, Delegate.create(this, function() {
                this.bindBehaviors(this._domElementId);
            }));
        }
        else {
            this.hide();
        }
    }
}


FastSearchResultsComponent.FastSearchResultsComponent.createClass('FastSearchResultsComponent.FastSearchResultsComponent', AbstractWarpComponents.AbstractMarketGroupListComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsMarketGroupNavigationComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsMarketGroupNavigationComponent.BoyleSportsMarketGroupNavigationComponent

BoyleSportsMarketGroupNavigationComponent.BoyleSportsMarketGroupNavigationComponent = function BoyleSportsMarketGroupNavigationComponent_BoyleSportsMarketGroupNavigationComponent() {
    BoyleSportsMarketGroupNavigationComponent.BoyleSportsMarketGroupNavigationComponent.constructBase(this);
}


BoyleSportsMarketGroupNavigationComponent.BoyleSportsMarketGroupNavigationComponent.createClass('BoyleSportsMarketGroupNavigationComponent.BoyleSportsMarketGroupNavigationComponent', BoyleSportsAbstractComponents.BoyleSportsMarketGroupNavigationComponent.BoyleSportsAbstractMarketGroupNavigationComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsMarketGroupViewComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsMarketGroupViewComponent.BoyleSportsMarketGroupViewComponent

BoyleSportsMarketGroupViewComponent.BoyleSportsMarketGroupViewComponent = function BoyleSportsMarketGroupViewComponent_BoyleSportsMarketGroupViewComponent() {
    BoyleSportsMarketGroupViewComponent.BoyleSportsMarketGroupViewComponent.constructBase(this);
}
BoyleSportsMarketGroupViewComponent.BoyleSportsMarketGroupViewComponent.prototype = {
    
    createConcreteMarketInstance: function BoyleSportsMarketGroupViewComponent_BoyleSportsMarketGroupViewComponent$createConcreteMarketInstance(domElement, parameters) {
        return this.createDynamicComponent(BoyleSportsMarketComponent.BoyleSportsMarketComponent, domElement, true, parameters);
    }
}


BoyleSportsMarketGroupViewComponent.BoyleSportsMarketGroupViewComponent.createClass('BoyleSportsMarketGroupViewComponent.BoyleSportsMarketGroupViewComponent', BoyleSportsAbstractComponents.BoyleSportsMarketGroupViewComponent.BoyleSportsAbstractMarketGroupViewComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsRaceCardComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsRaceCardComponent.BoyleSportsRaceCardComponent

BoyleSportsRaceCardComponent.BoyleSportsRaceCardComponent = function BoyleSportsRaceCardComponent_BoyleSportsRaceCardComponent() {
    BoyleSportsRaceCardComponent.BoyleSportsRaceCardComponent.constructBase(this);
}


BoyleSportsRaceCardComponent.BoyleSportsRaceCardComponent.createClass('BoyleSportsRaceCardComponent.BoyleSportsRaceCardComponent', BoyleSportsAbstractComponents.BoyleSportsRaceCardComponent.BoyleSportsAbstractRaceCardComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('SimpleHTMLComponent');

////////////////////////////////////////////////////////////////////////////////
// SimpleHTMLComponent.SimpleHTMLComponent

SimpleHTMLComponent.SimpleHTMLComponent = function SimpleHTMLComponent_SimpleHTMLComponent() {
    SimpleHTMLComponent.SimpleHTMLComponent.constructBase(this);
}
SimpleHTMLComponent.SimpleHTMLComponent.prototype = {
    _parameters$1: null,
    _repaintOnUserChanged$1: false,
    _repaintOnPageFilterChanged$1: false,
    _content$1: null,
    _navigationService$1: null,
    
    setNavigationService: function SimpleHTMLComponent_SimpleHTMLComponent$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 SimpleHTMLComponent_SimpleHTMLComponent$onPageFilterChanged(eventSource) {
        this._log.debug('OnPageFilterChanged');
        if (this._repaintOnPageFilterChanged$1) {
            this.repaint();
        }
    },
    
    _userService$1: null,
    
    setUserService: function SimpleHTMLComponent_SimpleHTMLComponent$setUserService(userService) {
        this._log.debug('SetUserService');
        this._userService$1 = userService;
    },
    
    onUserChanged: function SimpleHTMLComponent_SimpleHTMLComponent$onUserChanged(eventSource) {
        this._log.debug('OnUserChanged');
        if (this._repaintOnUserChanged$1) {
            this.repaint();
        }
    },
    
    init: function SimpleHTMLComponent_SimpleHTMLComponent$init(environment, componentInstanceName, domElementId, parameters) {
        SimpleHTMLComponent.SimpleHTMLComponent.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._content$1 = parameters['content'];
    },
    
    start: function SimpleHTMLComponent_SimpleHTMLComponent$start() {
        this.repaint();
    },
    
    repaint: function SimpleHTMLComponent_SimpleHTMLComponent$repaint() {
        this._log.debug('Repaint');
        var _componentDOMElement = this._environment.getDomElement(this._domElementId);
        _componentDOMElement.className = _componentDOMElement.className + ' escapedHtml';
        if (this.isVisible(this._parameters$1.get_visibleOn(), this._parameters$1.get_notVisibleOn(), this._navigationService$1.getAction())) {
            this.show();
            this._environment.updateDomElementDirect(_componentDOMElement, this._content$1);
        }
        else {
            this.hide();
        }
    }
}


SimpleHTMLComponent.SimpleHTMLComponent.createClass('SimpleHTMLComponent.SimpleHTMLComponent', Framework.Component.AbstractComponent, UserService.IUserChangedListener, NavigationService.IPageFilterChangedListener);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
// BoyleSportsEffectsComponent.js
//


Type.createNamespace('BoyleSportsEffectsComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsEffectsComponent.BoyleSportsEffectsComponent

BoyleSportsEffectsComponent.BoyleSportsEffectsComponent = function BoyleSportsEffectsComponent_BoyleSportsEffectsComponent() {
	BoyleSportsEffectsComponent.BoyleSportsEffectsComponent.constructBase(this);
}
BoyleSportsEffectsComponent.BoyleSportsEffectsComponent.prototype = {
	_parameters$1: null,
	_repaintOnPageFilterChanged$1: true,
	_navigationService$1: null,
	_tooltipSelectors: '',
	_tooltipSelectorsIE7: '',
	_obstacleSelectors: '',
	_shadowSelectors: '',

	setNavigationService: function BoyleSportsEffectsComponent_BoyleSportsEffectsComponent$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 BoyleSportsEffectsComponent_BoyleSportsEffectsComponent$onPageFilterChanged(eventSource) {
		this._log.debug('OnPageFilterChanged');
		if (this._repaintOnPageFilterChanged$1) {
			this.repaint();
		}
	},

	init: function BoyleSportsEffectsComponent_BoyleSportsEffectsComponent$init(environment, componentInstanceName, domElementId, parameters) {
		var $j = jQuery;
		var that = this;

		BoyleSportsEffectsComponent.BoyleSportsEffectsComponent.callBase(this, 'init', [ environment, componentInstanceName, domElementId, parameters ]);
		this._parameters$1 = new Framework.CommonComponentParameters(parameters);
		this._repaintOnPageFilterChanged$1 = Boolean.parse(parameters['repaint-on-filter-changed']);
		this._tooltipSelectors = parameters['tooltip-selectors'];
		this._tooltipSelectorsIE7 = parameters['tooltip-selectors-ie7'];
		this._obstacleSelectors = parameters['obstacle-selectors'];
		this._shadowSelectors = parameters['shadow-selectors'];

		$j(document).ready(function() {
			/* Tooltips */
			BoyleSportsTooltips.addObstacle(that._obstacleSelectors);
			BoyleSportsTooltips.addSelector(that._tooltipSelectors);
			BoyleSportsTooltips.initialise(that);

			/* Shadows */
			//$j('.tabContainer,.BoyleSportsTabbedHeadlineComponent').jqShadows();
		});
	},

	repaint: function BoyleSportsEffectsComponent_BoyleSportsEffectsComponent$repaint() {

	}
}

BoyleSportsEffectsComponent.BoyleSportsEffectsComponent.createClass('BoyleSportsEffectsComponent.BoyleSportsEffectsComponent', Framework.AbstractComponent, NavigationService.IPageFilterChangedListener);

Framework.Component.AbstractXsltBasedComponent.prototype.showTooltipEventHandler = function(sender, eventArgs) {
	BoyleSportsTooltips.showTooltip(window.event, document.getElementById(eventArgs.parameters.getAsString('id')));
}

Framework.Component.AbstractXsltBasedComponent.prototype.hideTooltipEventHandler = function(sender, eventArgs) {
	BoyleSportsTooltips.hideTooltip(window.event);
}

var BoyleSportsTooltips = (function() {
	var $j = jQuery,
		_ready = false,
		_queue = {
			elements: [],
			selectors: []
		},
		_obstacles = [],
		_tooltipContainer = null,
		_componentInstance = null;

	/**
	 * Initialises the tooltips and empties the queue
	 */
	function initialise(componentInstance) {
		_componentInstance = componentInstance !== undefined ?
			 componentInstance :
			 _componentInstance;

		_tooltipContainer = $j('<div class="bs-tooltip" style="position:absolute;"></div>')
			.appendTo(document.body)
			.hide();

		_ready = true;
	}

	/**
	 * Getter to determine whether the module is ready
	 */
	function ready() {
		return _ready;
	}

	/**
	 * Adds tooltips to an element
	 * If the class has not been initialised, the element is added to the queue
	 */
	function addTooltip(element, options) {
		if (!_ready) {
			_queue.elements.push([element, options]);
			return;
		}

		_prepareTooltip(element, options);
	}

	/**
	 * Adds tooltips to all existing elements matching the current selector
	 * If the class has not been initialised, the selector is added to the queue
	 */
	function addSelector(selector) {
		if (!_ready) {
			_queue.selectors.push(selector);
			return;
		}
	}

	/**
	 * Adds the supplied selector to the list of obstacles
	 * If the class has not been initialised, the selector is added to the queue
	 */
	function addObstacle(obstacle) {
		_obstacles.push(obstacle);
	}

	/**
	 * Clears the queue
	 */
	function clearQueue() {
		_queue = {
			elements: [],
			selectors: []
		};
	}

	/**
	 * Processes the current queue
	 */
	function _processQueue() {
		if (!this.ready()) {
			return false;
		}

		for (var i = 0, il = _queue.elements.length; i < il; i++) {
			this.addTooltip(this._queue.elements[i][0], this._queue.elements[i][1]);
		}

		for (var i = 0, il = this._queue.selectors.length; i < il; i++) {
			this.addSelector(this._queue.selectors[i]);
		}

		return true;
	}

	/**
	 * Prepares an element for displaying a tooltip
	 */
	function _prepareTooltip(element, options) {
		var options = jQuery.extend({
				id: null,
				selector: '.tooltip'
			}, options),
			tooltipElement = options.id !== null ?
				$j('#' + options.id.replace(/(:|\.)/g, '\\$1')) :
				$j(element).find(options.selector);

		$j(element).hover(
			function(event) {
				showTooltip(event, tooltipElement);
			},
			hideTooltip
		);
	}

	function showTooltip(event, tooltipElement) {
		tooltipElement = $j(tooltipElement);
		if (event.pageX === undefined) {
			event.pageX = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			event.pageY = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		}
		_tooltipContainer
			.append(
				tooltipElement
					.css({
						position: 'absolute',
						top: -100000,
						left: -100000
					})
					.clone()
						.attr('id', '')
						.css({
							position: 'relative',
							top: 0,
							left: 0
						})
						.removeClass('invisible')
						.show()
			)
			.css({
				top: event.pageY + 10,
				left: _adjustCoords({
					left: event.pageX + 10,
					top: event.pageY + 10,
					width: tooltipElement.outerWidth(),
					height: tooltipElement.outerHeight()
				}).left
			})
			.show();
	}

	function hideTooltip(event) {
		_tooltipContainer
			.hide()
			.children()
				.remove();
	}

	/**
	 * Adjusts coordinates to avoid obstacles
	 * Only avoid obstacles on a horizontal axis
	 */
	function _adjustCoords(elementCoords) {
		$j(_obstacles.join(', ')).each(function() {
			var obstacleCoords = $j(this).offset();
			obstacleCoords.width = $j(this).outerWidth();
			obstacleCoords.height = $j(this).outerHeight();

			if (elementCoords.top < obstacleCoords.top + obstacleCoords.height && elementCoords.top + elementCoords.height > obstacleCoords.top) {
				if (elementCoords.left < obstacleCoords.left + obstacleCoords.width && elementCoords.left + elementCoords.width > obstacleCoords.left) {
					elementCoords.left = elementCoords.left < obstacleCoords.left ?
						obstacleCoords.left - elementCoords.width :
						obstacleCoords.left + obstacleCoords.width;
				}
			}
		});

		return elementCoords;
	}

	return {
		initialise: initialise,
		init: initialise, /* Alias */
		ready: ready,
		add: addTooltip, /* Alias */
		addTooltip: addTooltip,
		addSelector: addSelector,
		addObstacle: addObstacle,
		clearQueue: clearQueue,
		showTooltip: showTooltip,
		hideTooltip: hideTooltip
	};
})();

/**
 * Shadows
 * Adds shadows to an element
 */
jQuery.fn.jqShadows = function(options) {
	if (jQuery.isIE6() || this.data('hasShadows') == true) {
		return this;
	}
	this.data('hasShadows', true);

	var settings = {
		rounded: true,
		semitrans: true
	};

	if (typeof(options) != 'undefined') {
		settings = jQuery.extend(settings, options);
	}

	var shadows = [
		'<div class="jqshadow jqshadow-tl"></div>',
		'<div class="jqshadow jqshadow-tr"></div>',
		'<div class="jqshadow jqshadow-br"></div>',
		'<div class="jqshadow jqshadow-bl"></div>',
		'<div class="jqshadow jqshadow-t"></div>',
		'<div class="jqshadow jqshadow-r"></div>',
		'<div class="jqshadow jqshadow-b"></div>',
		'<div class="jqshadow jqshadow-l"></div>'
	];

	this.wrap('<div class="' +
		'jqshadows' +
		(settings.semitrans ? ' jqshadows-semitrans' : '') +
		(!settings.rounded ? ' jqshadows-hard' : '') +
		'"></div>');
	var shadowWrapper = this.parent();

	shadowWrapper
		.append(shadows.join(''))
		.css({
			marginTop: this.css('margin-top'),
			marginRight: this.css('margin-right'),
			marginBottom: this.css('margin-bottom'),
			marginLeft: this.css('margin-left')
		});

	this.css({
		margin: 0
	});

	return this;
}
Type.createNamespace('BoyleSportsTabContainerComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent

BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent = function BoyleSportsTabContainerComponent_BoyleSportsTabContainerComponent() {
    BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent.constructBase(this);
}
BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent.prototype = {
    
    createConcreteTabContainerInstance: function BoyleSportsTabContainerComponent_BoyleSportsTabContainerComponent$createConcreteTabContainerInstance(domElement, parameters) {
        return this.createDynamicComponent(BoyleSportsTabComponent.BoyleSportsTabComponent, domElement, true, parameters);
    }
}


BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent.createClass('BoyleSportsTabContainerComponent.BoyleSportsTabContainerComponent', BoyleSportsAbstractComponents.BoyleSportsTabContainerComponent.BoyleSportsAbstractTabContainerComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsTabComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsTabComponent.BoyleSportsTabComponent

BoyleSportsTabComponent.BoyleSportsTabComponent = function BoyleSportsTabComponent_BoyleSportsTabComponent() {
    BoyleSportsTabComponent.BoyleSportsTabComponent.constructBase(this);
}


BoyleSportsTabComponent.BoyleSportsTabComponent.createClass('BoyleSportsTabComponent.BoyleSportsTabComponent', BoyleSportsAbstractComponents.BoyleSportsTabComponent.BoyleSportsAbstractTabComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsMarketComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsMarketComponent.BoyleSportsMarketComponent

BoyleSportsMarketComponent.BoyleSportsMarketComponent = function BoyleSportsMarketComponent_BoyleSportsMarketComponent() {
    BoyleSportsMarketComponent.BoyleSportsMarketComponent.constructBase(this);
}


BoyleSportsMarketComponent.BoyleSportsMarketComponent.createClass('BoyleSportsMarketComponent.BoyleSportsMarketComponent', BoyleSportsAbstractComponents.BoyleSportsMarketComponent.BoyleSportsAbstractMarketComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
Type.createNamespace('BoyleSportsBetPlacementComponent');

////////////////////////////////////////////////////////////////////////////////
// BoyleSportsBetPlacementComponent.BoyleSportsBetPlacementComponent

BoyleSportsBetPlacementComponent.BoyleSportsBetPlacementComponent = function BoyleSportsBetPlacementComponent_BoyleSportsBetPlacementComponent() {
    BoyleSportsBetPlacementComponent.BoyleSportsBetPlacementComponent.constructBase(this);
}


BoyleSportsBetPlacementComponent.BoyleSportsBetPlacementComponent.createClass('BoyleSportsBetPlacementComponent.BoyleSportsBetPlacementComponent', BoyleSportsAbstractComponents.BoyleSportsBetPlacementComponent.BoyleSportsAbstractBetPlacementComponent);

// ---- Do not remove this footer ----
// Generated using Script# v0.5.1.0 (http://projects.nikhilk.net)
// -----------------------------------
