
	var navAccordion;
	
	$(document).ready(function() {
		
		// launch new windows
		$("a.new_window").click( function() {
			var win = window.open(this.href, "Arcadia_popup", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
			// focus on the window in case it's already open
			win.focus();
			return false;			
			});												 
														 		 
		// track zip file downloads
		// see http://www.google.com/support/googleanalytics/bin/answer.py?answer=74985 for details
		$("a.track_download").click( function() {
			urchinTracker(this.href);
			});
										 
		// Site uses the jQuery Accordion plugin to manage the nav
		navAccordion = $('#navlinks').Accordion({ 
			header: '.main',
			autoheight: false,
			alwaysOpen: false,
			active: false,
			animated: false,
			event: 'onclick'
		});
		
		$('#navlinks').show();
		
		// Accordion navigation attribute doesn't work when the page
		// doesn't exist as an element in the accordion, though under
		// the directory of that element. So it's activated manually.
		if (location.href.indexOf('about') != -1)
			navAccordion.activate(0);
		else if (location.href.indexOf('careers') != -1) {
			navAccordion.activate(1);
			if (location.href.indexOf('careers/graduates') != -1)
				$('#navCareersGrads').show();
		}
		else if (location.href.indexOf('press') != -1)
			navAccordion.activate(2);
		else if (location.href.indexOf('responsibilities') != -1)
			navAccordion.activate(3);
		else if (location.href.indexOf('vouchers') != -1)
			navAccordion.activate(4);
		else if (location.href.indexOf('contact') != -1)
			navAccordion.activate(5);

		// This statement is used to trigger and handle the even for
		// the international store locator on the contact us page.
		$("#sloc-countries").change(function() {
			var str = [];
			$("select option:selected").each(function() {
				str[str.length] = $(this).val();
			});
			if (str[str.length-1] != "") {
				$(this).selectedIndex = 0;
				window.open(str[str.length-1],"Popup","width=800,height=500,menubar=no,toolbar=no,location=no,directories=no,personalbar=no,scrollbars=no,dependent=no");
			}
		}).change();
		
		var now = new Date();
		var mths = ['January','February','March','April','May','June','July','August','September','October','November','December'];
		$('#current-date').text( mths[now.getMonth()] + ' ' + now.getDate() + ', ' + now.getFullYear());
		
		$('.pop-locator').click(function() {
			window.open($(this).attr('href'),"Popup","width=800,height=430,menubar=no,toolbar=no,location=no,directories=no,personalbar=no,scrollbars=no,dependent=no");
			return false;
		});
	});
	
