(function($) { $.fn.innerfade = function(options) { this.each(function(){ var settings = { animationtype: 'fade', speed: '1000', timeout: 6000, type: 'sequence', containerheight: '160px', runningclass: 'innerfade', stdelay: 6000 }; if(options) $.extend(settings, options); var elements = $(this).children(); if (elements.length > 1) { $(this).css('position', 'relative'); $(this).css('height', settings.containerheight); $(this).addClass(settings.runningclass); for ( var i = 0; i < elements.length; i++ ) { $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute'); $(elements[i]).hide(); }; if ( settings.type == 'sequence' ) { setTimeout(function(){ $.innerfade.next(elements, settings, 1, 0); }, settings.stdelay); $(elements[0]).show(); } else if ( settings.type == 'random' ) { setTimeout(function(){ do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 ) $.innerfade.next(elements, settings, current, 0, 0); }, settings.stdelay); $(elements[0]).show(); } else { alert('type must either be \'sequence\' or \'random\''); } } }); }; $.innerfade = function() {} $.innerfade.next = function (elements, settings, current, last) { if ( settings.animationtype == 'slide' ) { $(elements[last]).slideUp(settings.speed, $(elements[current]).slideDown(settings.speed)); } else if ( settings.animationtype == 'fade' ) { $(elements[last]).fadeOut(settings.speed); $(elements[current]).fadeIn(settings.speed); } else { alert('animationtype must either be \'slide\' or \'fade\''); }; if ( settings.type == 'sequence' ) { if ( ( current + 1 ) < elements.length ) { current = current + 1; last = current - 1; } else { current = 0; last = elements.length - 1; }; } else if ( settings.type == 'random' ) { last = current; while ( current == last ) { current = Math.floor ( Math.random ( ) * ( elements.length ) ); }; } else { alert('type must either be \'sequence\' or \'random\''); }; setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout); }; })(jQuery); $(document).ready(function(){ var iSrc = { 0: 'NDDT Photo 6', 1: 'NDDT Photo 1', 2: 'NDDT Photo 5', 3: 'NDDT Photo 4', 4: 'NDDT Photo 3', 5: 'NDDT Photo 1' }; function selectSource(w){ x=iSrc[0]+iSrc[3]+iSrc[4]; if (w >= 1590) { x=iSrc[0]+iSrc[1]+iSrc[3]+iSrc[2]+iSrc[4]+iSrc[5]; } else if (w >= 1420) { x=iSrc[0]+iSrc[1]+iSrc[3]+iSrc[2]+iSrc[4]; } else if (w >= 1230) { x=iSrc[0]+iSrc[3]+iSrc[2]+iSrc[4]+iSrc[5]; } else if (w >= 1060) { x=iSrc[0]+iSrc[1]+iSrc[3]+iSrc[4]; } else if (w >= 890) { x=iSrc[0]+iSrc[1]+iSrc[3]; } return x; }; $('#homeimages').html(selectSource($('#homeimages').width())); $(window).resize(function() { $('#homeimages').html(selectSource($('#homeimages').width())); }); $('#news .fader').innerfade(); $('#events .fader').innerfade({ stdelay: 8000 }); $('#quicklinks').hide(); $('.qltrig').mouseover(function() { $('#quicklinks').show(); }); $('#quicklinks').hover(function() { $('#quicklinks').show(); }, function() { $('#quicklinks').hide(); }); });