document.observe("dom:loaded", function() {					
		
	extendNavigation({
		nav: $$('#mainnav')[0],
		applyToTag: 'a',
		addFirst: false,
		addLast: true,
		includePages: true,
		includeParents: true,
		includeHomePage: false,
		pageClass: 'selected',
		parentClass: 'selected'
	});

	extendNavigation({
		nav: $$('#subnav ul')[0],
		applyToTag: 'li',
		addFirst: false,
		addLast: true,
		includePages: true,
		includeParents: false,
		includeHomePage: false,
		pageClass: 'selected',
		parentClass: 'selected'
	});

	initExternalLinks();
	
	if ($('masthead'))
	new Feature({
		tabs: 				$('masthead').select('ul.tabs li a'),
		tabContent: 		$('masthead').select('div.tab'),
		prevButton: 		$('masthead').select('ul.controls li.prev a')[0],
		nextButton: 		$('masthead').select('ul.controls li.next a')[0],
		selectorContainer:	$('masthead').select('ul.controls li.selector')[0],
		selectedClass:		'selected',
		autoPlaySpeed:		10
	});
	
/*	This has a tooltip pop up when you hover over the linked title of a White Paper. Removed for March 2011 launch*/
/*	initToolTips({ 
		container: $$('.content')[0],
		classIndicator: 'term'
	});*/
	
	initLabelClick({
		labels: 	$$('#downloadForm label a'),
		checkboxes: $$('#downloadForm input[type=checkbox]')
	});
		
});


function submitDownloads() {
	var form = $('downloadForm');
	var fields = Form.getInputs(form);
	var selected = fields.find(
		function(e) {
			return e.checked;
		}
	);

	if(selected == null || selected.length < 1) {
		alert("Please make a download selection to continue.");
		return false;
	}

	return true;
}


function initLabelClick( args )
{
	
	args.labels.each( function( el, id ) {
		el.observe( 'click', function( e ) {
			e.preventDefault();
			args.checkboxes[id].checked = args.checkboxes[id].checked ? false: true;
		});
	});
	
}

