
  /* ---------------------------------------------------------------------------

    Copyright (C) 2009   Vintage Media Ltd   www.vintagewebworks.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 3 as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    A copy of the GNU General Public License is included in the 'docs' folder
    and online at: http://www.gnu.org/licenses/gpl.txt

  --------------------------------------------------------------------------- */


  window.addEvent('domready', function() {

    /* Set columns to equal heights */
    equalColumnHeights($$('.equal-height'));
    
    /* Add special effects to menu */
//  $each($$('#menu1 li a'), function(el) {

//    el.store('original_styles', el.getStyles('color'));

//    el.addEvents({
//      mouseenter: function() {
//        el.set('morph', { duration: 'short' });
//        el.morph('.menu-hover-effect');
//		  },
//      mousedown: function() {
//        el.set('morph', { duration: 'short' });
//        el.morph('.menu-click-effect');
//      },
//      mouseleave: function() {
//        var original_styles = el.retrieve('original_styles');
//        this.set('morph', { duration: 'short' });
//        this.morph({
//          'color' : original_styles['color']
//        });
//      }
//    });

 // });



    /* Add sliding effect to 'login' bar */
  	$('pull-down-area').setStyle('height','auto');
  	var pullDownSlide = new Fx.Slide('pull-down-area').hide(); 
    $('toggle-pull-down').addEvent('click', function(e){
  		e = new Event(e);
  		pullDownSlide.toggle();
  		e.stop();
  	});
//  $('close-pull-down').addEvent('click', function(e){
//		e = new Event(e);
//		pullDownSlide.slideOut();
//		e.stop();
// 	});


  });


  window.addEvent('resize', function() {

    /* Keep column heights in sync */
    equalColumnHeights($$('.equal-height'));

  });


  /*

    equalColumnHeights
    ------------------
    Copyright Richard Hulse
    http://richardhulse.blogspot.com/2008/07/equal-height-columns-with-mootools.html

  */


  function equalColumnHeights(divs) {

    var height = 0;

    /* Remove fixed height setting */
    divs.each( function(e){
      e.setStyle( 'height', 'auto' );
    });    
    
    /* Get tallest column */
    divs.each( function(e){
      if (e.offsetHeight > height){
        height = e.offsetHeight;
      }
    });

    /* Set all columns to the tallest */
    divs.each( function(e){
      e.setStyle( 'height', height + 'px' );
      //alert(e.id + ': ' + height + 'px');
      if (e.offsetHeight > height) {
        e.setStyle( 'height', (height - (e.offsetHeight - height)) + 'px' );
      }
      
    });

  }
  

  
