function slideSwitch() { var $active = $('.news-slide.active'); var $next = $active.next().length ? $active.next() : $('.news-slide:first'); /* uncomment the 3 lines below to pull the images in random order var $sibs = $active.siblings(); var rndNum = Math.floor(Math.random() * $sibs.length); var $next = $( $sibs[ rndNum ] );*/ $active.fadeOut(); $next.fadeOut() .addClass('active') .fadeIn('slow', function() { $active.removeClass('active last-active'); }); } $(document).ready(function () { /*$('#n1').css({ 'left': '0', 'top': '0' }); $('#n2').css({ 'left': '-260px', 'top': '0' }); $('#n3').css({ 'left': '-520px', 'top': '0' }); var current = 1; var next = 2; $(".news-slide").each(function(index,el) { $('#n' + current).delay(3000).animate({ 'top': '-50px', 'opacity': '0'}, 'slow', function() { $('#n' + next).animate({ 'left': '0', 'opacity': '1'}, 'fast'); alert(current); alert(next); }); });*/ var timer = 3500; $('#news-event .blog').hover( function () { clearInterval(sliderIntervalID); }, function () { sliderIntervalID = setInterval("slideSwitch()", timer); } ); $('.news-slide:first').css('display', 'block'); sliderIntervalID = setInterval("slideSwitch()", timer); }); $(function() { $('#news-letter input[type="text"]').focus(function() { var svar = $(this).val(); var xvar = $(this).attr('title'); if(svar == xvar){ $(this).val(''); } }); $('#news-letter input[type="text"]').blur(function() { var svar = $(this).val(); var xvar = $(this).attr('title'); if(svar == ''){ $(this).val(xvar); } }); $('ul.dropdown li').hover( function () { $(this).css('background-position', '0 -36px'); $('ul:first', this).show(); }, function () { $(this).css('background-position', '0 0'); $('ul:first', this).hide(); }); $('.sub_menu li').hover( function () { $(this).css('background-color', '#f5d707'); }, function () { $(this).css('background-color', '#f8f8f8'); }); $('ul.st-nav > li').hover( function () { $(this).css('background-position', '0 -33px'); $(this).find('.ss-nav').show(); }, function () { $(this).css('background-position', '0 0'); $(this).find('.ss-nav').hide(); }); $('ul.ss-nav > li').hover( function () { $(this).css('background-position', '0 -27px'); }, function () { $(this).css('background-position', '0 0'); }); /*$('#contact-us').toggle( function () { $('#contact-us_box').show(); }, function () { $('#contact-us_box').hide(); });*/ $('#slide-toggle .s-country').click(function() { if(!$(this).hasClass('active')) { $('#slide-toggle .s-country').css({ 'color' : '#fff' }).removeClass('active'); $('#slide-toggle .content').slideUp(); $(this).css({ 'color' : '#eed318' }); $(this).addClass('active'); $(this).next('.content').slideDown(); } else{ $(this).css({ 'color' : '#fff' }).removeClass('active'); $(this).next('.content').slideUp(); } }); $('#form-submit').click(function(){ $('.validate-error').empty(); if($('#first-name').val() == '') { $('#lbl_first-name').append('   **First name is required'); } if($('#last-name').val() == '') { $('#lbl_last-name').append('   **Last name is required'); } if($('#email').val() == '') { $('#lbl_email').append('   **E-mail is required'); } }); $('#select-location, #location-list').hover( function () { $('#location-list').show(); }, function () { $('#location-list').hide(); } ); });