var $j = jQuery.noConflict();

Shadowbox.loadSkin('classic', '/assets/shadowbox/skin');
$j().ready(function(){
	confirmAction();
	
	gallery();
	$j('#nav-main .collapsed UL').hide();
	Shadowbox.init();
	

});

function gallery() {
	$j('[rel=parent]').click(function(){
		$j(this).siblings('ul').toggle('slow');
		return false;
	});

	$j('.collapsible').click(function(){
		$j(this).next('div').toggle('slow');
		return false;
	});
  setInterval("next()", 6000);

}
function next() {
  var $active = $j('#header-reel img.active');
  if ( $active.length == 0 ) $active = $j('#header-reel IMG:last');

  var $next =  $active.next().length ? $active.next()
      : $j('#header-reel IMG:first');

  $active.addClass('last-active');

  $next.css({opacity: 0.0})
      .addClass('active')
      .animate({opacity: 1.0}, 1000, function() {
          $active.removeClass('active last-active');
      });
}

function confirmAction() {
	$j('A[rel="confirm"]').click(function(){
		if(confirm($j(this).attr('value'))) {
			return true;
		}
		return false;
	});
}
  

