$(document).ready(function() {
  $('#index').flash('flash/index.swf', 850, 620);
  $('#top').flash('flash/top.swf', 760, 194, {vars:'lang='+lang});
  fixfooter();
  $(window).bind('resize', fixfooter);
  $('#menu a').bind('focus', function() { this.blur() });
  $('#gallery a').lightBox();
});


function fixfooter()
{
  //return;
  //$('#middle').css('height', '0');
  //if ($(window).height() - $('#container').height() > 0) {
    var height1 = $(window).height() - $('#top').height() - $('#bottom').height() - 2;
    var height2 = $('#content').height() + 30;
    if (height2 > height1) {
      height1 = height2;
    } 
    $('#middle').height(height1 + 'px');
  //}
  
  
  return;
  
  var height1 = $(window).height() - getTotalHeight('#top') - getTotalHeight('#footer');
  $('#menu').height((height1 - 10) + 'px');

}

function getTotalHeight(element)
{
  var ret = 0;
  var properties = ['height', 'border-top-width', 'border-bottom-width', 
                    'padding-top', 'padding-bottom', 'margin-top', 'margin-bottom']; 

  var value;
  
  for (var x in properties) {
    value = parseInt($(element).css(properties[x]));
    isNaN(value) ? (value = 0) : null;
    ret += value;
  }
  
  return ret;
  
  return  parseInt($(element).height()) 
          + parseInt($(element).css('border-top-width'))
          + parseInt($(element).css('border-bottom-width'))
          + parseInt($(element).css('padding-top')) 
          + parseInt($(element).css('padding-bottom'))
          + parseInt($(element).css('margin-top'))
          + parseInt($(element).css('margin-bottom')); 
}

