jQuery.noConflict();

(function($) {

var setCorrectedMainHeight = function () {
  var border_element_height = 42;  // Height of flower element in image
  var bar_element_height    = 66;  // Height of top and botem bar in image 

  var header_height        = $('#header').first().height();
  var col_left_height      = ($('#main .column-left, .main .col-left') && $('#main .column-left, .main .col-left').first().height()) || 0;
  var col_container_height = ($('#main .container, .main .col-main') && $('#main .container, .main .col-main').first().height()) || 0;
  var col_right_height     = ($('#main .column-right, .main .col-right') && $('#main .column-right, .main .col-right').first().height()) || 0;
  var footer_height        = $('#footer').first().height();

  var main_height = (Math.ceil((header_height + Math.max(col_left_height, col_container_height, col_right_height) + footer_height) / border_element_height) * border_element_height) - header_height - footer_height;

  $('#main, .main').height(main_height);
}

$(document).ready(function() {
  setCorrectedMainHeight();
  setInterval(setCorrectedMainHeight, 50);

  $('.cycle').cycle({
    fx:    'fade',
    random: true,
    timeout: 5000,
    speed:  1500
  });
});

$('.agreement-content a').live('click', function(event) {
  event.preventDefault();
  window.open(this.href);
})

})(jQuery);

