$(document).ready(function(){

	//dropdown
		
		 $('#communitiesNav').hover(
		 	function () {
		      $(".dropdown").addClass("show");
		   },
		   function () {
		   	  $(".dropdown").removeClass("show");
		   }
		 );
	
	//sideshow! 
		
		    $('.slideshow img:gt(0)').hide();
		    setInterval(function(){
		      $('.slideshow :first-child').fadeOut(3000)
		         .next('img').fadeIn()
		         .end().appendTo('.slideshow');}, 
		      6000);
		
	    
	//modals
	  	
		var t = $('#popup .popupContent')
			$('#popup').jqm({
		trigger: '.popupTrigger',
		ajax: '@href',
		onHide: function(h) { 
				h.o.remove(); // remove overlay
				h.w.fadeOut(888); // hide window
				},
		overlay: 60, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */
		modal: true,
		target:t,
		overlayClass: 'popupOverlay'})
		.jqDrag('.jqDrag'); /* make dialog draggable, assign handle to title */
	
			// Close Button Highlighting.  
			$('input.jqmdX')
				.hover(
			function(){ $(this).addClass('jqmdXFocus'); }, 
			function(){ $(this).removeClass('jqmdXFocus'); })
				.focus( 
			function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); })
				.blur( 
			function(){ $(this).removeClass('jqmdXFocus'); });
	
	
	//replace div (galleries)
	   
	  $('.ajaxtrigger').live('click', function(ev) {
	    // Stop regular handling of "click" in most non-IE browsers
	    ev.preventDefault();
	    ev.stopPropagation();
	   $(".photo").attr("src", this.href);
	   $(".photoGallery a").removeClass('selected');
	   $(this).addClass('selected');
	    return false;
	  });	
	  
	  $('.more').live('click', function () {
	  		$('.bios li p').removeClass('hideBlurb');
	  		$(this).parent().addClass('hideBlurb');
	  		$('.continue').addClass('hidden');
	  		$(this).parent().next().removeClass('hidden');
	  		return false;
	  	});
	  	
	  	$('.less').live('click', function () {
	  		$('.continue').addClass('hidden');
	  		$('.bios li p').removeClass('hideBlurb');
	  		
	  			
	  			return false;
	  		});
	  		

  		     
});
