var components = {
    
	cur_component : '',
	contentAreaHeight : '',
	relativeDivs: ['include_container','what_covered_init_display'], //Container to be relative (size-altered) parent of the components container.
	relativeDivIndex: 0, //Altered in INIT() to use different containers
	minHeight: 1150, //Min Height for /help_me_choose/pricing* only
    
    /*Set Up Components and Disabled Components*/
    setUpComponents: function(){
        this.cur_component = $('component_links_container').getFirst().getProperty('id');
        
            $$('div.component_link').each(function(item){
                
                item.addEvent('click', function(){
	                     components.turnOffCurComponent();
                         components.cur_component = this.getProperty('id');
                         components.turnOnCurComponent();
		        });
		            
                if(disabled_components.indexOf(item.getProperty('id')) >= 0){
		            item.getLast().addClass('linkDisabled');
		        }
		        
	        });
        
        $('component_links_container').setStyle('visibility','visible');
        
        if (components.pricingPage == true) {
			this.contentAreaHeight = this.minHeight;
		} else {
			$('slot_2').getFirst().getFirst().setStyle('position','relative');
			this.contentAreaHeight = $('slot_2').getFirst().getSize().size.y;
		}
		
		
        this.turnOnCurComponent();
        
    },

    /*Turns on Component*/
    turnOnCurComponent : function(){
	
		var componentsHeight = $(this.cur_component + "_bullets").getSize().size.y;
		if(componentsHeight >= this.minHeight){
			$(components.relativeDivs[components.relativeDivIndex]).setStyle('height', componentsHeight+75);
		}else{
			$(components.relativeDivs[components.relativeDivIndex]).setStyle('height', this.minHeight);
		}
	        
        $(this.cur_component).getLast().removeClass('linkOff');
        $(this.cur_component).getLast().addClass('linkOn');
        $(this.cur_component + "_bullets").setStyle('visibility','visible');

    },
    
    /*Turns off Component*/
    turnOffCurComponent : function(){
        $(this.cur_component).getLast().removeClass('linkOn');
        
        if(disabled_components.indexOf(this.cur_component) < 0){
            $(this.cur_component).getLast().addClass('linkOff');
        }else{
            $(this.cur_component).getLast().addClass('linkDisabled');
        }
        
        $(this.cur_component + "_bullets").setStyle('visibility','hidden');
    },
		
	init: function() {
		if ((window.location.toString()).match(/help_me_choose\/pricing/)) { 
			components.relativeDivIndex = 1; //Otherwise 0, by default
		}			
		/* This ^^ must preceed setUpComponents(). It affects height, actions */

		//Don't set up components on pricing_conv.html
		if (!(window.location.toString()).match(/pricing_conv/)) { components.setUpComponents();}
	}
	
}


onload_register('components.init()'); 
