jQuery(function () {

	Cufon.replace('#menu', {
		textShadow: '#000 0 1px',
		hover: {color: '#d4181f'}
	});
	Cufon.replace('h2', {
		textShadow: '#808080 0 1px',
		hover: {color: '#000'}
	});
	Cufon.replace('h3', {
		textShadow: '#808080 0 1px',
		hover: {color: '#000'}
	});
	Cufon.replace('h4', {
		textShadow: '#808080 0 1px',
		hover: {color: '#000'}
	});
	Cufon.replace('h6', {
		hover: {color: '#941215'}
	});
	Cufon.replace('.more', {
		textShadow: '#dbdbdb 0 1px',
		hover: {color: '#000'}
	});

	$(document).pngFix();
	$("#chapter").change(filterByChapter);
	$(".link").click(showChapterInfo);
	$("#chapter-map").change(changeMap);
	$("#chapter-list a").click(scrollToTitle);
	$("a.login").colorbox({initialWidth:"50px", initialHeight:"50px", speed:100, opacity:.80, inline:true, href:"#login-box"});
	$("a.terms").colorbox({initialWidth:"300px", maxWidth:"400px", initialHeight:"200px", speed:100, opacity:.80, inline:true, href:"#terms-box"});

	$('#tabs').tabs({ fx: { opacity: 'toggle' } });

	$("#help_cms").accordion({ collapsible: true, active: false });
	$("#email_cms").accordion({ collapsible: true, active: false });

	stLight.options({publisher:'ee28d08b-b160-4b6c-9f70-5c6100e30f2c'});
});

	function filterByChapter() {
		$.cookie('exp_ilrnha_chapter', null);
		var options = { expires: 10, path: '/' };
		var selected = $('#chapter option:selected').val();
	  if(selected != 0){
				$.cookie('exp_ilrnha_chapter', selected, options);
				location.reload();
	  }
	}

	function changeMap() {
		var selected = $('#chapter-map option:selected').val();
	  if(selected != 0){
				var page = 'http://ilrnha.org/chapters/map/'+selected;
	      location.href = page;
	  }
	}

	function showChapterInfo() {
		$(this).text($(this).text() == 'More Info +' ? 'Less Info -' : 'More Info +');
		$(this).next().slideToggle('fast');
		$.scrollTo( $(this).prev(), 800 );
		return false;
	}

	function scrollToTitle() {
		var link = $(this).attr('href');
		$.scrollTo( link, 800 );
		return false;
	}


