jQuery(function( $ ){

	
heightArray = new Array(); 
$(".Accordion DD").each(function(i) { theHeight = $(this).height(); heightArray[i] = theHeight; }); 
$(".Accordion DD").hide(); 

$(".Accordion DT").click(function () { 
	if($(this).hasClass("Selected")){
	
	$(this).removeClass("Selected");
	$(this).next("dd").css({height: heightArray[$(".Accordion DT").index(this)]}); 
	$(this).next("dd").slideUp("slow").siblings("dd").slideUp("slow");

	} else {
	
	$(this).addClass("Selected");
	$(this).next("dd").css({height: heightArray[$(".Accordion DT").index(this)]}); 
	$(this).next("dd").slideDown("slow").siblings("dd").slideUp("slow");
	$(this).siblings("dt").removeClass("Selected");
	};
	return false;

	});	
	
$(".Accordion DT.selected").addClass("Selected").next("dd").css({height: heightArray[$(".Accordion DT").index(this)]}).show(); 	
	
/* Homepage Slideshow */
$('#Slideshow').cycle({ speed: 1400, timeout: 8900,  before: onAfter });
function onAfter() {  var temp = this.alt; $('#Caption').fadeOut(400, function(){ $(this).html(temp); }).fadeIn(900) }

$('#PhotoSlideshow').cycle({ speed: 600, timeout: 0, pager: '.PhotoNav SPAN' });

$('.PopUp').click( function(){ 
	$(this).attr('title',$(this).parent().find('.Caption').html()); }).fancybox({
				'titlePosition'	: 'inside',
				'overlayColor'  : '#5b5b5b',
				'overlayOpacity' : '0.9',
				'centerOnScroll': false,
				'scrolling': 'no'
			});

/* $('.PopUp').mouseover( function(){ $(this).attr('title','Click to Enlarge for Details'); }); */
$('.PopUp').prepend('<p class="Message">Click to enlarge for details</p>');			


			
	$(".TellAFriend").fancybox({
		'width'				: 400,
		'height'			: 635,
		'autoDimensions'	: false,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'centerOnScroll': true,
		'scrolling': 'no'

	});


$(".LoginPopup").fancybox({
       		'width': 300,
		'height': 300,
		'modal' : true
	});

$( ".datepicker" ).datepick({ 
    yearRange: '-30:+0', showTrigger: '#calImg'});

$("#Clinician-Other").hide();
$(".RadioRow").hide();

$(".ClinicianList").change(function() { 
  if( $(".ClinicianList :selected").val() == "Other" ){  
    $("#Clinician-Other").fadeIn();
   }
  else $("#Clinician-Other").fadeOut();
});

$(".RadioShow").click(function() { 
  if( $("input[@name='RadioShow']:checked").val() == "Yes" ){  
    $(".RadioRow").fadeIn();
   }
  else $(".RadioRow").fadeOut();
});
	

	
});




