// ready!
$(function(){
   
if ($('.news-single-img img').length > 1) {  
     
   // make it visible (important if JS isn't active)
   $('#ppy3').show();
        
   $('.news-single-img img').each(function(i) {
    $('.ppy-imglist').append('<li> <a href="' + $(this).attr('src') + '"><img src="' + $(this).attr('src') +'" alt="" /></a> <span class="ppy-extcaption">' + $('.news-single-img .news-single-imgcaption:eq(' + i + ')').html() + '</span></li>'); 
    //$('.ppy-imglist').append('<li> <a href="' + $(this).attr('src') + '"><img alt="' + $('.news-single-img .news-imgcaption:eq(' + i + ')').html() + '" src="' + $(this).attr('src') + '"></a></li>'); 
   }); 
   
    var options = {
    caption: 'false'
    }

   $('#ppy3').popeye(options); 
   $('.news-single-img').remove(); 
 } else {
   //$('#ppy3').remove();   
 }      

    // image reflections
    jQuery(function($) {
        $("div.ref img").reflect({ height: 0.3, opacity: 0.5 });
    });
        
    // set classes for li items
    $('ul.quadmenu > li').each(function(i) {
        i++;
        $(this).addClass('item_' + i);
    });
    
    // make it go down!
    $('ul.quadmenu > li').hover(
        function() {
            if ($(this).hasClass('active')) {
                $(this).find('ul.sub').show();        
            } else {
                $(this).find('> a').stop(false, false).animate({ 'padding-top': '60px', 'height':'25px' }, 250, 
                    function() { 
                        $(this).parent().find('ul.sub').show(); 
                    });
            }
            
        }, function() {                   
                if ($(this).hasClass('active')) {
                    $(this).parent().find('ul.sub').hide(); 
                } else {                                       
                        $(this).parent().find('ul.sub').hide();  
                        $(this).find('> a').stop(false, false).animate({ 'padding-top': '5px', 'height':'80px' } );         
                }                            
        }
        
  	);
    

});
