/**
 * Kinstellar JavaScript
 *
 * @filename core.js
 * @author Norbert Laposa
 * @date 2008-04-14
 * @copyright Liquid Light Digital Ltd.
 * @url http://www.liquidlight.co.uk
 */

/**
 * Bootstrap
 */
$(document).ready(function() {

  // Add link before each boxContact
  $('.boxContact').before('<a href="#" class="boxContactOpen"><span><img src="uploads/pics/contact.gif" width="86" height="23" border="0" alt="" /></span></a>');

  // Hide all
  $('.boxContact').css('display', 'none');

  // Add toggle on click event to each link and hide all other
  $("a.boxContactOpen").bind("click", function(e){

    // Find box we are clicking on
    var activeBlock = $(this.parentNode).find('.boxContact');

    if (activeBlock.hasClass('boxActive')) {

      // It's the last opened, we toggle() it
      activeBlock.slideToggle();

    } else {

      // It's a different box, hide all other and display this
      $(".boxContact").slideUp().removeClass('boxActive');
      activeBlock.slideDown().addClass('boxActive');

    }

    return false;

  });

});
