$(document).ready(function() {

  if ($.browser.msie) {
    DD_roundies.addRule('.catalogue-items .ci-info-container div table td ul li.act', 3);
    DD_roundies.addRule('.rounded, #fancybox-outer', 2);
  };

  $('.faq dt').click(function() {
    if ($(this).is('.expanded')) {
      $(this).siblings('.expanded').removeClass('expanded').andSelf().removeClass('expanded');
    } else if ($(this).next('dd').length) {
      $(this).siblings().removeClass('expanded').end().next('dd').addClass('expanded').andSelf().addClass('expanded');
    } else {
      return false;
    }
  });

  if ($('.gallery').length) {
    $('.gallery a').attr('rel', 'gallery').fancybox({
      'cyclic': true,
      'padding': 20,
      'opacity': 0.8,
      'title': this.title,
      'titlePosition': 'inside'
    });
  };


  if ($('#callback').length) {
	$('#callback').attr('href', "#callback-form");
	$("#callback").click(function() {

		$("#callback-popup").toggle();
		return false;
	});
  }
  $("#callback-close").click(function() {
    $("#callback-popup").hide();
	return false;
  });

  $('.subnav li a').each(function() {
    if ($.browser.msie) {
      $(this).before('<span class="ie-bullet">–</span>');
    };
    if ($(this).siblings('ul').length) {
      $(this).click(function() {/*$(this).addClass('pseudo-link').click*/
      	$('.subnav li ul').hide();
        $(this).siblings('ul').toggle();
        return false;
      });
    };
    if ($(this).parent('li:first').is('.act')) {
      $(this).parent('li:first').parents('li').children('ul').toggle();
    };
  });

});

