// Initialize FAQ
function initFAQ() {
	$('#faq').accord({
		idle: 'li',
		active: 'li.open',
		duration: 200
	});
}

function initFeaturesRollovers() {
	// Initialize Features rollovers
	
	var features = $('#promos .promo');
	features.mouseenter(function(){
		
		var current = this;
		features.each( function() {
			if(this !== current ) {
				$(this).stop().animate({ opacity: .3 }, 200);
			}
		});
		
	}).mouseleave(function(){
	
		var current = this;
		features.each( function() {
			if(this !== current ) {
				$(this).stop().animate({ opacity: 1 }, 200);
			}
		});
	});
}

$(document).ready(function(){
	//this is crazy Adam B....
	if(HD.util.Localization.getLocale() == 'en_US'){
		initFAQ();
		initFeaturesRollovers();

		// Initialize rentalDealers button which brings up locator overlay
		HD.getByClass('rentalDealers', '*', this.containerEl, function(el) {
			el.onclick = function() {
				HD.util.DealerFinder.View.prototype.displayDealerRentalWidget();
			};				
		});

		// Scroll to top
		$('a.top').click(function(){
			$('html, body').animate({scrollTop: '0px'}, 500);
		}); 
	}
	else	{
	 /* Start FAQ */

            $('#common-questions-content').accordion({
            active: false,
            collapsible: true,
            autoHeight: false,
            icons: {
            header: "item-closed",
            headerSelected: "item-open"
            }
            });
            $('#common-questions-content h3').addClass("pointer");
            /* End FAQ */
        
            HD.getByClass('rentalDealers', '*', this.containerEl, function(el) {
				el.onclick = function() {
							HD.util.DealerFinder.View.prototype.displayDealerRentalWidget();
				};                                              
            });
	}
});

