$(document).ready(function(){
	//login form
	$('.login-form').hide();
	$('#login-button').click(function(){
		if($('.login-form').hasClass('visible')){
			$('.login-form').fadeOut("fast");
			$('.login-form').removeClass('visible');
		}
		else{
			$('.login-form').fadeIn("fast");
			$('.login-form').addClass('visible');
		}
		return false;
	});
	
	//tabs
	$('#tabs div').hide(); // Hide all divs
	$('#tabs div:first').fadeIn("slow"); // Show the first div
	$('#tabs ul li:first a').addClass('active-tab').removeClass('blue-button-small'); // Set the class for active state
	$('#tabs ul li:first a span').addClass('active')
	$('#tabs ul li a').click(function(){ // When link is clicked
		$('#tabs ul li a').removeClass('active-tab').addClass('blue-button-small'); // Remove active class from links
		$('#tabs ul li a span').removeClass('active')
		$(this).addClass('active-tab').removeClass('blue-button-small'); //Set parent of clicked link class to active
		$(this).children().addClass('active')
		var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
		$('#tabs div').hide(); // Hide all divs
		$(currentTab).fadeIn("slow"); // Show div with id equal to variable currentTab
		return false;
	});
	
	$('#comments-tabs div').hide(); // Hide all divs
	$('#comments-tabs div:first').fadeIn("slow"); // Show the first div
	$('#comments-tabs ul li:first').addClass('comments-active-tab'); // Set the class for active state
	$('#comments-tabs ul li a').click(function(){ // When link is clicked
		$('#comments-tabs ul li').removeClass('comments-active-tab'); // Remove active class from links
		$(this).parent().addClass('comments-active-tab'); //Set parent of clicked link class to active
		var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
		$('#comments-tabs div').hide(); // Hide all divs
		$(currentTab).fadeIn("slow"); // Show div with id equal to variable currentTab
		return false;
	});

	$('#phone-tabs div').hide(); // Hide all divs
	$('#phone-tabs div:first').show();
	$('#phone-tabs div:first div').show();// Show the first div and all its children
	$('#phone-tabs ul li:first').addClass('phone-active-tab'); // Set the class for active state
	$('#phone-tabs ul li a').click(function(){ // When link is clicked
		$('#phone-tabs ul li').removeClass('phone-active-tab'); // Remove active class from links
		$(this).parent().addClass('phone-active-tab'); //Set parent of clicked link class to active
		var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
		$('#phone-tabs div').hide(); // Hide all divs
		$(currentTab).fadeIn("fast"); // Show div with id equal to variable currentTab
		return false;
	});

	// commented since it conflicts with sliders on search page.
	//$("#slider").easySlider({
    //auto: true,
	//	continuous: true
	//});

});

