Ext.ns('DJIndexes.RBP');

DJIndexes.RBP.Overview = function() {
	
	var tabContainer = 'overview-tabs';
	var tabContent = [
		{ title: 'Leading/Lagging &nbsp;Series', contentEl: 'leading-lagging-series' },
		{ title: '130/30 &nbsp;Series', contentEl: '130-30-series' },
		{ title: 'Directional &nbsp;Series', contentEl: 'directional-series' },
        { title: 'Size/Style &nbsp;Series', contentEl: 'style-series' },
        { title: 'Dividend &nbsp;Series', contentEl: 'dividend-series' },
        { title: 'Islamic Market Series', contentEl: 'islamic-series' },		
		{ title: 'RBP &nbsp;Weighted &nbsp;Benchmarks', contentEl: 'weighted-benchmarks' }
	];
	
	function _init() {
	 	literatureCenter();		
		
		// overview tabs
		var tabContentEl = Ext.get(tabContainer);
		if (tabContentEl) {
			new DJIndexes.widget.InfoTabs(tabContentEl,{
				tabs: tabContent
			});
		}
		
		// intraday
		if (Ext.get('intraday')) {
			new DJIndexes.widget.Intraday2('intraday',{
				familyId: 'RBP2',
				height: 550,
				title: 'Dow Jones RBP Indexes'
			});
		}
		
		// info windows
		var autoLinkSelector = '.what-is-rbp';
		if ( Ext.select(autoLinkSelector).getCount() ) {
			new DJIndexes.widget.InfoWindow({
				title: 'What is RBP<span class="sm">&reg;</span>?',
				width: 850,
				height: 800,
				autoLoad: 'info-what-is-rbp.html',
				autoShow: false,
				autoLinkCls: autoLinkSelector
			});
		}
		
		var autoLinkSelector = '.the-rbp-methodology';
		if ( Ext.select(autoLinkSelector).getCount() ) {
			new DJIndexes.widget.InfoWindow({
				title: 'The RBP<span class="sm">&reg;</span> Approach',
				width: 850,
				height: 800,
				autoLoad: 'info-the-rbp-methodology.html',
				autoShow: false,
				autoLinkCls: autoLinkSelector
			});
		}
		
	}

	function literatureCenter(){
		
		var container = "literaturecenter";
        if (Ext.get(container)) {
            new DJIndexes.widget.LiteratureSimpleView(container);
        }
		
	}
	
	return {
		init: _init
	}
	
}();
Ext.onReady(DJIndexes.RBP.Overview.init,DJIndexes.RBP.Overview);


DJIndexes.RBP.Contact = function() {
	
	var container = 'contact-form';
	
	function _init() {
		
		if ( Ext.get(container) ) {
			new DJIndexes.widget.ContactForm(container,{
				hiddenFields: [
					{ xtype: 'hidden', name: 'subject', value: 'RBP Indexes' }
				],		
				additionalParams: [
					{ name: '00N60000001N3cm', value: 'RBP Contact Form' }
				]
			});
		}
		
	}
	
	return {
		init: _init
	}
	
}();
Ext.onReady(DJIndexes.RBP.Contact.init, DJIndexes.RBP.Contact);
