﻿  $(document).ready(function() {
   $(".nav_section").click(function() {
    $(".nav_section_on").addClass("nav_section");
    $(".nav_section_on").removeClass("nav_section_on");
    $(this).removeClass("nav_section");
    $(this).addClass("nav_section_on");
    
    var scroll = true;
    
    if($(this).is("#lnkContent1")) { $(".section").hide(); $("#content1").show(); $(".subSection").hide(); $("#content1 #subSection1").show();}
    if($(this).is("#lnkContent2")) { $(".section").hide(); $("#content2").show(); $(".subSection").hide(); $("#content2 #subSection1").show(); $("#content2 #bioDocSection1").show();}
    if($(this).is("#lnkContent3")) { $(".section").hide(); $("#content3").show(); $(".subSection").hide(); $("#content3 #subSection1").show();}
    if($(this).is("#lnkContent4")) { $(".section").hide(); $("#content4").show(); $(".subSection").hide(); $("#content4 #subSection1").show();}
    
    if($(this).is("#lnkHospitalContent3")) { $("#hdnLinkFormInfo").trigger('click'); scroll = false; }
    if($(this).is("#lnkHospitalContent4")) { $("#hdnLinkHomeVideo").trigger('click'); scroll = false; }
    
    if(scroll){$.scrollTo("#main_content",800);}
    
    });
   
   $(".nav_section").mouseenter(function() {
    $(this).addClass("nav_section_on");
    $(this).removeClass("nav_section");
    $(".nav_section_on").mouseleave(function() {
     $(this).addClass("nav_section");
     $(this).removeClass("nav_section_on");
    });
   });
   
   $("#doctors a").click(function() {
    $("#doctors a").addClass("bioLinksOn");
    $("#staff a").removeClass("bioLinksOn");
    $("#bioDoctors").show();
    $("#bioStaff").hide();
   });
   $("#staff a").click(function() {
    $("#staff a").addClass("bioLinksOn");
    $("#doctors a").removeClass("bioLinksOn");
    $("#bioStaff").show();
    $("#bioDoctors").hide();
   });
   
   $("#main_content .backtotop").hover(function() {
    $(this).attr('src',$(this).attr('src').replace('_off', '_on'));
   },
   function(){
    $(this).attr('src',$(this).attr('src').replace('_on', '_off'));
   });
   
   $("#main_content .backtotop").click(function() {
    $.scrollTo("#content", 800);
   });
   
    $("#hdnLinkFormInfo").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
   
    $("#confirmBox").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
   
    $("#deniedBox").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
   
    $("#hdnLinkHomeVideo").fancybox({
    'width': 495, //or whatever
    'height': 285,
    'scrolling':'no',
    'padding': 0, //optional
    'type': 'iframe'
    });

	$("a[rel=group1]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});

	$("a[rel=group2]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});

	$("a[rel=group3]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});

	$("a[rel=group4]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	$( ".datePicker" ).datepicker();
 });

