$(function() {
	
	// remove border from last highlight div and last table row on the page
	$('#secondaryContent div.highlight:last, tbody tr:last, .secondary div.highlight:last').css('border-bottom','none');
	
	// add stripes to table rows
	$('table.nonsortable tbody tr:odd').addClass('altRow');
	$('table.sortable tbody tr td:first').addClass('nowrap');
	$('#mainContent .primary div.thumbnail:even').addClass('altDiv');
	
	// add icons to specific types of links for non-IE browsers
	if (!$.browser.msie) {
		// add 'globe' icon to external links in specific places
		$('#mainContent  a[href^="http"]').not('div.thumbnail a, div.centerColLgImg a, .secondary a, p.addThis a, td a').addClass('linkOffsite');
		// add icons to links to downloadable files
		$('a[href$="pdf"], a[href$="PDF"]').not('div.thumbnail a, div.centerColLgImg a, .secondary a').addClass('linkPDF');
		$('a[href$="doc"], a[href$="DOC"],a[href$="docx"], a[href$="DOCX"]').not('div.thumbnail a, div.centerColLgImg a, .secondary a').addClass('linkWord');
		$('a[href$="xls"], a[href$="XLS"],a[href$="xlsx"], a[href$="XLSX').not('div.thumbnail a, div.centerColLgImg a, .secondary a').addClass('linkExcel');
	}
	
	// add 'active' class to menu items for current page
		$('#accordion a, div.quickLinks a').each(function(){
		if ($(this).attr('href')==window.location.pathname) {
			$(this).addClass('active');
		}
	});	

		
	
	// initialize accordion menu
	$('#accordion').accordion({
		active: true,
		alwaysOpen: false,
    	header: '.head', 
    	event: 'click', 
		autoHeight: false ,
		clearStyle: true,
		selectedClass: 'active'
	});

	// activate approprate index of accordion depending on directory
	var currentSection = (window.location).toString();
	if((currentSection.indexOf('science-education') != -1) || (currentSection.indexOf('scientific-peer-review') != -1)) {
		$('#accordion').accordion("activate", 0);
	} else if ((currentSection.indexOf('national-security-emergency-management') != -1) || (currentSection.indexOf('radiation-emergency-medicine') != -1))  {
		$('#accordion').accordion("activate", 1);
	} else if ((currentSection.indexOf('environmental-assessments-health-physics') != -1)  || (currentSection.indexOf('health-communication') != -1) || (currentSection.indexOf('occupational-exposure-worker-health-studies') != -1)) {
		$('#accordion').accordion("activate", 2);
	} else if (currentSection.indexOf('about-orau') != -1) {
		$('a#navAbout').css('background-image','url(/images/btn-about-over.gif)');
	} else if (currentSection.indexOf('what-we-do') != -1) {
		$('a#navWhat').css('background-image','url(/images/btn-what-over.gif)');
	} else if (currentSection.indexOf('university-partnerships') != -1) {
		$('a#navUniv').css('background-image','url(/images/btn-univ-over.gif)');
	} else if (currentSection.indexOf('careers') != -1) {
		$('a#navCareers').css('background-image','url(/images/btn-careers-over.gif)');
	} else if (currentSection.indexOf('media-center') != -1) {
		$('a#navMedia').css('background-image','url(/images/btn-media-over.gif)');
	} else if (currentSection.indexOf('contact') != -1) {
		$('#searchBar #shortcuts a#navContact').css({'color':'#6d86b5', 'font-weight':'bold'});
	} else if (currentSection.indexOf('working-with-orau') != -1) {
		$('#searchBar #shortcuts a#navWork').css({'color':'#6d86b5', 'font-weight':'bold'});
	} else if (currentSection.indexOf('sitemap.aspx') != -1) {
		$('#searchBar #shortcuts a#navSitemap').css({'color':'#6d86b5', 'font-weight':'bold'});
	} else if (currentSection.indexOf('http://www.orau.org/default.aspx') != -1) {
		$('#searchBar #shortcuts a#navHome').css({'display':'none'});
	}

	// alternate row styling for CSE Events pages
	if ($('#eventDetails').length) {
		$('#eventDetails tr:odd').addClass('odd');
	}

});
