/**
 * Calculation of height from the content containers.
 */
function setCalculatedContentHeight(){
  var contentAreaHeight = 0;
  var contentLeftAreaHeight = 0;
  contentAreaHeight = $('#contentArea').height();
  contentLeftAreaHeight =  $('#contentLeft').height();

  if (contentAreaHeight < 200 && contentLeftAreaHeight < 200){
    contentAreaHeight = 200;
    $('#contentArea').height(200);
  }

  // The new height of the contentLeftArea is calculated from the contentAreaHeight
  // - 53 (53px from top, beacause absolute position of the contentLeftArea)
  // When the leftArea is bigger than the mainArea make the same just on a reversed way.
  if ((contentAreaHeight - 51) > contentLeftAreaHeight){
    if ($.browser.msie && $.browser.version === '6.0'){
      $('#contentLeftInnerWrapper').height(contentAreaHeight - 51);
    } else {
      $('#contentLeftInnerWrapper').height(contentAreaHeight - 53);
    }
  } else if ((contentAreaHeight - 51) < contentLeftAreaHeight){
    if ($.browser.msie && $.browser.version === '6.0'){
      $('#contentArea').height(contentLeftAreaHeight + 32);
    } else {
      $('#contentArea').height(contentLeftAreaHeight + 34);
    }
  }
}

/**
 * Handles the pagination in the eWindows for endowments.
 */
function paginateEndowments(nr){
  if(!$('#pag' + nr).hasClass('active')){
    var currentId = $('#endowmentsPagination a.active').attr('id');
    var nrCurrent = currentId.substr(3,1);
    $('#endowmentsPagination a.active').removeClass('active');
    $('#pag' + nr).addClass('active');

    $('div.endowments'+nr).show();
    $('div.endowments'+nrCurrent).hide();
  }
}

function checkInputFields() {
  if ($('#cablecarSearch_name').length > 0) {
    if ($('#cablecarSearch_name').val() != 'Name der Seilbahn'){
      $('#cablecarSearch_name').attr('rel', 'Name der Seilbahn');
    }
    if ($('#cablecarSearch_city').val() != 'Ort'){
      $('#cablecarSearch_city').attr('rel', 'Ort');
    }
  }
}
