if (typeof GUI == 'undefined') var GUI = {};
jQuery.extend(GUI, {
	init: function() {
		this.setupImageBanners();
		this.setupContentSections();
	},
	
	setupImageBanners: function() {
		$('.bannerWrapper').each( function() {
			var item = $(this);
			var img = item.find('img');
			item.css({ backgroundImage: 'url(' + img.attr('src') + ')', width: img.width()+'px', height: img.height()+'px' });
			img.remove();
		});
	},
	
	setupContentSections: function() {
		$('#mainContent .sectionHeader').click( function(e) {
			e.preventDefault();
			var sectionh = $(this);
			var section = sectionh.parent();
			
//			var activeSection = $('#mainContent .active');
//			if ( activeSection.length ) {
//				if ( activeSection[0] === section[0] ) return;
//				
//				activeSection.find('.sectionContent').slideUp('fast', function() {
//					activeSection.removeClass('active');
//				});
//			}
			
			section.find('.sectionContent').slideToggle('fast', function() {
				section.toggleClass('active');
			});
		});
	}
});
var OmnitureHelper = {};
jQuery.extend(OmnitureHelper, {
	init: function() {
		$('.omni').click( function(e) {
			var item = $(this);
			var page_name = item.attr('id');
			if (!page_name) page_name = item.parent().attr('id');
			if ( page_name ) {
				e.preventDefault();
				odt.omni_track(page_name);
				window.open(item.attr('href'));
			}
		});
	}
});
$(window).load( function() {
	OmnitureHelper.init();
	GUI.init();
});
