$(function() {

	// MAIN NAV DROPDOWNS
	$('#header ul li').hover(function() {
		$(this).addClass('over');
	}, function() {
		$(this).removeClass('over');
	});

	// SIDEBAR NAV DROPDOWNS
	$('#sidebar ul a').click(function() {
	    
	    if ($(this).next('ul').children().length !== 0)
        {
	    	$(this).next('ul').slideToggle('normal');
    		$(this).parent('li').siblings('li').find('ul').slideUp('normal');
    		return false;
	    }

	});

	// HOME PAGE SLIDESHOW
	$('.slideshow').cycle({
		fx: 'scrollRight'
	});
	
    if ($('.gallery-detail li a').length != 0)
    {
        // GALLERY LIGHTBOX
    	$('.gallery-detail li a').lightBox({
    	    imageLoading: site_url + 'assets/images/lightbox-ico-loading.gif',	
    			imageBtnPrev: site_url + 'assets/images/lightbox-btn-prev.gif',
    			imageBtnNext: site_url + 'assets/images/lightbox-btn-next.gif',
    			imageBtnClose: site_url + 'assets/images/lightbox-btn-close.gif',
    			imageBlank: site_url + 'assets/images/lightbox-blank.gif',
    	    fixedNavigation: true
    	}); // Select all links in object with gallery ID
    }
		
		if ($('a.play').length != 0)
		{
				$('a.play').fancybox({
					'onComplete': function() {
							$("#player").jPlayer({
   				    		'swfPath': site_url + 'assets/scripts/',
                	'ready': function () {
                		$("#player").jPlayer('setFile', $("#audio_file").text()).jPlayer('play');
				    			}
							});
						},
						'onClose': function(){
   							$("#player").stop();
   					}
				});
		}
			
});
