// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// main navigation buttons rounded with dropshadows
var border = RUZEE.ShadedBorder.create({ corner:4, shadow:8 });
// rounded columns
var rounded = RUZEE.ShadedBorder.create({ corner:8  });
// section rounded2
var section = RUZEE.ShadedBorder.create({ corner:6, border:1  });

function matchColumns()
{
  var columns = $A($$('.equal-column'));
  var column_height = 0;
  var max_height = 0;

  columns.each( function( column )
  {
    column.style.height = 'auto'
  } )

  columns.each(function(column)
  {
    column_height = column.getHeight();
    max_height = ( column_height > max_height ) ? column_height : max_height;
  });
 
  columns.each(function(column)
  {
    column.setStyle({
      height: max_height + 'px'
    });
  });
}

function safeadjustColumns()
{
  if ( window.XMLHttpRequest )
  {
    matchColumns()
  }
}

function saferoundCorners()
{
  if ( window.XMLHttpRequest )
  {
    rounded.render( $$( '.rounded' ) )
    section.render( $$( '.rounded2' ) )
  }
}

function doIt() // IE6 can handle one set of rounded corners, but not
                // more. saferoundCorner and safeadjustColumns keeps
                // ie6 from completing the render functions.
{
  border.render( $$( '#main-navigation li' ) ) //safe for ie6
  safeadjustColumns()
  saferoundCorners()
}

Event.observe(window, 'resize', safeadjustColumns );
