
(function($){$.fn.slideshow=function(){var $container=$(this);var $slides=$container.children();var options=$.extend({perSlide:5000,fade:750},arguments[0]||{});var advanceSlide=function(){var shownSlide=$slides.filter(":visible").eq(0);var index=$slides.index(shownSlide);var nextIndex=(index==$slides.length-1)?0:index+1;$slides.eq(index).fadeOut(options.fade);$slides.eq(nextIndex).fadeIn(options.fade);};var slideAdvancer=setInterval(advanceSlide,options.fade+options.perSlide);$(window).unload(function(){clearInterval(slideAdvancer);});return $container;};$.fn.megaDropDown=function(){var $this=$(this);var $dropdowns=$this.find('.dropdown');var $links=$dropdowns.siblings('a').addClass('dropdown-link');var $parents=$dropdowns.parent();var closeAllDropdowns=function(){$dropdowns.filter(':visible').fadeOut(300);$links.removeClass('selected');};var cancelEvent=function(event){event.preventDefault();return false;};var openDropdown=function(){clearTimeout($(this).parent().data('fadeTimeout'));var $dropdown=$(this).siblings('.dropdown');var hidden=$dropdown.is(':hidden');if(hidden){closeAllDropdowns();$(this).addClass('selected');$dropdown.position({'my':'left top','at':'left bottom','of':$dropdown.parent(),'collision':'fit none'});$dropdown.fadeIn(300);}
return false;};$(document.body).click(closeAllDropdowns);$links.click(openDropdown).hover(openDropdown,function(){});$parents.hover(function(){clearTimeout($(this).data('fadeTimeout'));},function(event){var $parent=$(this);var $dropdown=$parent.find('.dropdown');var $link=$dropdown.siblings('a');$parent.data('fadeTimeout',setTimeout(function(){$dropdown.fadeOut(300);$link.removeClass('selected');},750));});};$(function(){$('a.external').click(function(){window.open(this.getAttribute('href'),"www.diopa.org - External Link");return false;});$('#nav .inner > ul').megaDropDown();$('.slideshow').slideshow();$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});});})(jQuery);