// JavaScript Document

$(document).ready(function(){
	
	
	$('#topNavigation').find('a').not('.selected').hover(
		function () {
			$(this).addClass('topNavHover');
		}, 
		function () {
			$(this).removeClass('topNavHover');
		}
    );

	$firstAccordionItem = $('.accordionItem:first')
	$firstAccordionBody = $('.accordionBody:first');
	$firstAccordionBody.show();
	$firstAccordionItem.find('.accordionToggle').text('hide bio');
	
	$('.accordionItem').each(function(){
		bodyText = $(this).find('.accordionBody').text();								  
		if (bodyText.length < 10){
			$(this).find('.accordionToggle').hide();
		}
	});
	
	$('div.footcare').find('li a').each(function(){
		if ($(this).attr('id') == pageID){
			$(this).addClass('sidebarNavSelected');
			$(this).removeClass('sidebarNav');
		}
	});
	
	$('.LHForms').hover(
		function () {
        	$('.LHForm').addClass('linkDisable');
      	}, 
      	function () {
        	$('.LHForm').removeClass('linkDisable');
      	}
	);
	
	$('.LBForms').hover(
		function () {
        	$('.LBForm').addClass('linkDisable');
      	}, 
      	function () {
        	$('.LBForm').removeClass('linkDisable');
      	}
	);
	
	$('.homepageFeature').hover(
		function () {
        	$(this).css('color','#FFFFFF');
      	}, 
      	function () {
        	$(this).css('color','#9C4621');
      	}
	);
	
	$('.hms1').bind('click',function(){
		location.href = '/Treatments';
	});
	$('.hms2').bind('click',function(){
		location.href = '/Forms';
	});
	$('.hms3').bind('click',function(){
		location.href = '/Staff';
	});
	$('.hms4').bind('click',function(){
		location.href = '/Locations';
	});
	$('.hms5').bind('click',function(){
		location.href = '/Foot_Care';
	});
	
	
	$('.homepageSliderItem').hover(
  		function () {
    		$(this).find('.hsImage').css('border-color','#9C4621');
			//$(this).css('color','#333333');
			$(this).addClass('topNavHover');
  		}, 
  		function () {
    		$(this).find('.hsImage').css('border-color','#FFFFFF');
			$(this).removeClass('topNavHover');
			//$(this).css('color','#9C4621');
  		}
	);

	$('.videoLink').bind('click',function(){
		$('#videoContainer').toggle();
		if ($('#videoContainer').is(':visible'))
			$('#videoLink').text('close');
		else
			$('#videoLink').text('watch video');
	});

	
});


$('.accordionToggle').live('click',function(){
		$accordionItem = $(this).parents('.accordionItem');
		$accordionItem.find('.accordionBody').slideToggle('normal')
			
		$accordionToggle = $accordionItem.find('.accordionToggle');
		text = $accordionToggle.text();
		if (text == 'read bio')
			text = 'hide bio';
		else
			text = 'read bio';
		$accordionToggle.fadeOut('fast',function(){
			$accordionToggle.text(text);
			$accordionToggle.fadeIn('fast')
		});
		
		
});
