
$(document).ready(function() { 
  
		// add a drop class around submenu uls
		$('#main-menu li').each(function() {
			var children = $(this).find('ul').size();
			if (children > 0)
				$(this).addClass('submenu');
		});

		$('#main-menu .submenu').hover(function(){
				$(this).addClass('hover');
			}, function(){
				$(this).removeClass('hover');
		});
	
		// ---- Actions  ----------------------------------------------------------------------------------------------------------

		$('<ul id="actions"><li id="print"><a href="#" title="Print this page">Print this Page</a></li><li id="b2t"><a href="#">Back to top</a></li></ul>').appendTo('#main'); 
		$('#print a').click(function(){window.print();});
		$('#b2t a').click(function(){
			$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
			return false;
		});
		$('.location #actions').remove();
	
	
	  	// ---- Slider  ----------------------------------------------------------------------------------------------------------
		
		/*** 
		Simple jQuery Slideshow Script
		Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
		***/		
		
		$('#banner img:first').addClass('active');
		var currentID = $('#banner img.active').attr('id');
		slideSwitch = function () {
			var $active = $('#banner img.active');
			if ( $active.length == 0 ) $active = $('#banner img:last');
			var $next =  $active.next().length ? $active.next() : $('#banner img:first');
			$next.css({opacity: 0.0})
				.addClass('active')
				.animate({opacity: 1.0}, 1000, function() {
					$active.removeClass('active');
				});
			var currentID = $next.attr('id');
		}
		
		var slideshowIntervalID = setInterval("slideSwitch()",5000); 
		
		
	    // ---- EasyListSplitter  ----------------------------------------------------------------------------------------------------------

		$('#services ul').easyListSplitter({ 
			colNumber: 3,
			direction: 'horizontal'
		});
		

		// ---- People  -----------------------------------------------------------------------------------------------------------
			
		$('<ul id="nav"><li><a href="#" class="prev">prev</a></li><li><a href="#" class="next">next</a></li></ul>').appendTo('#people')
		
		$("#people .container li:nth-child(5n), #people-listing ul li:nth-child(4n)").addClass('last');

		$("#people .container").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev",
			speed: 1200,
			visible:5,
			scroll:5
		});
		
		$("#people .container").width(940);

		$('.popup').hide();
		$('#people ul a,#people-listing ul a').each(function(){
			var targetEl = $(this).parent().next().find('.popup-cont');
			$(this).colorbox({width:"50%", inline:true, href: targetEl, onLoad: function(){
				var clonedEl = $(this).parent().clone().prependTo(targetEl);
				$(clonedEl).find('img').insertAfter(clonedEl);
				$(clonedEl).find('.doctor').appendTo(clonedEl);
				$(clonedEl).find('a').remove();
			}, onClosed: function(){
				$('.popup-cont h3,.popup-cont div,.popup-cont img').remove();
			}});
		});
		
		
		$('#banners li:last,#sidebar-menu li:last,#news-list li:last,#actions li:last').addClass('last');
		$('#news-list li:first').addClass('first');
		

});



