$(document).ready(function()
{

//Gallery
$("#gallery").cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 2000, 
		next:   '#next2', 
		prev:   '#prev2' 
});
 
//News accordian
$('ul.news').hide();	
$('ul.news').eq(0).show();
$("#news h4").click(function(){
		var target = $(this).next('ul.news')
		$("#news li *").removeClass('active');
		$(this).toggleClass('active');
		$("ul.news:visible").not(target).slideUp();
		target.slideToggle();
});


//Main Menu
$('ul.sf-menu').superfish({
		animation : { opacity:"show", height:"show" }
});

//lightbox
$(function() {
	// Use this example, or...
	$('a[@rel*=lightbox]').lightBox({
		txtImage: 'Image',
		txtOf: 'of'
   });
});

//Products Accordion menu
var path = location.pathname;
var home = "/index.php";
if (path == home || path == "/") {
	var $nav = $('#products-nav a[@href="' + home + '"]');
} else {
	var $nav = $('#products-nav a[@href$="' + path + '"]');
}
$('#products-nav ul').hide();
$('#products-nav li a[@href$="' + path + '"]').addClass('active').siblings("ul").slideDown();
$('#products-nav li a[@href$="' + path + '"]').parents("ul").show();

//main nav grey line
$('a[@href$="' + path + '"]').parent().parent().parent().addClass('active');
//case study accordian
$('#case-studies-holder li ul').hide();
$('#case-studies-holder li a[@href$="' + path + '"]').addClass('active').siblings("ul").slideDown();
$('#case-studies-holder li a[@href$="' + path + '"]').parents("ul").show();

}); //Close document.ready
