$(document).ready(function(){
	$(".navigation ul li").hover(function(){
		$(this).addClass('hovered');
	}, function(){
		$(this).removeClass('hovered');
	});
	
	$(".hash-select").change(function(){
		document.location.hash = $(this).val();
	});
	
	$(".filter-select").change(function(){
		 
		var path = document.location.href.split('/');
		path.pop();
		document.location.href = path.join('/') + "/" + $(this).val();
	});
	
	$("ul.atoz-select > li > a").click(function(){
		var letter = $(this).attr('href').replace("#", "");
		$("h2.title").text( 
			$("h2.title").text().split(' - ')[0] + " - " + letter
		);
		$(".atoz-all").not('.atoz-' + letter ).parent().slideUp(200);
		
		$(".atoz-" + letter ).parent().slideDown(200);
		if( $(".atoz-" + letter ).length === 0 ){
			$("p.sorry").show();
		} else {
			$("p.sorry").css({display:'none'});	
		}
	});
	
	
	$("#download-file-button").click(function(){
		file = $('#download #file').val();
		if (file != '') {
			window.open('/'+file);
		}
	});
	
    $('#banner').cycle({
		fx: 'fade',
		timeout: 8000
	});
	
	$("#newsletter-button").click(function(){
		if( $(this).hasClass('up') ){
			$("#newsletter-form").animate({top:0, height:0, paddingTop:0, paddingBottom:0});
		} else {
			$("#newsletter-form").animate({top:-280, height:250, paddingTop:15, paddingBottom:15 });
		}
		$(this).toggleClass('up');
	});
	
	
});

