$(document).ready(function(){
	$('a#gototop').click(function(){
		$('html, body').animate({scrollTop: '0px'}, 300);
		return false;
	});
	
	$("input[name=keywords]").focus(function() {
		var foo = $("input[name=keywords]").val();
		if (foo == "Type in keywords")
		{
			$("input[name=keywords]").val('');	
		}	
	});
	
	$("input[name=keywords]").blur(function() {
		var foo = $("input[name=keywords]").val();
		if (foo == '')
		{
			$("input[name=keywords]").val("Type in keywords");	
		}	
	});
	
	var pgHeight = $('.sub_sections li:first').height();
	
	$('.sub_section_content').hide();
	$('.sub_sections').height(pgHeight);
	$('.sub_sections li:first h3.title').addClass('active');
	$('.sub_section_content:first').show();
	$('.sub_sections h3.title').click(function(){
		$('.sub_sections h3.title').removeClass('active');
		$(this).addClass('active');
		$('.sub_section_content').fadeOut();
		$(this).next('.sub_section_content').delay(800).fadeIn().stop();
		var pgHeight = $(this).parent().height();
		$('.sub_sections').height(pgHeight);
		return false;
	});
	
	$('.sub_section_content a#next').click(function(){
		$('.sub_sections h3.title').removeClass('active');
		$(this).parents('.sub_sections li').next('.sub_sections li').children('h3.title').addClass('active');
		$('.sub_section_content').fadeOut();
		$(this).parents('.sub_sections li').next('.sub_sections li').children('.sub_section_content').delay(800).fadeIn().stop();
		var pgHeight = $(this).parents('.sub_sections li').next('.sub_sections li').height();
		$('.sub_sections').height(pgHeight);
		return false;
	});
	
	$('.sub_section_content a#prev').click(function(){
		$('.sub_sections h3.title').removeClass('active');
		$(this).parents('.sub_sections li').prev('.sub_sections li').children('h3.title').addClass('active');
		$('.sub_section_content').fadeOut();
		$(this).parents('.sub_sections li').prev('.sub_sections li').children('.sub_section_content').delay(800).fadeIn().stop();
		var pgHeight = $(this).parents('.sub_sections li').prev('.sub_sections li').height();
		$('.sub_sections').height(pgHeight);
		return false;
	});
});
