// JavaScript Document

function isFlash() {
  flash_major = 9;
  flash_minor = 0;
  flash_release = 0;
  vers = swfobject.getFlashPlayerVersion();
  noFlash = false;
  if(flash_major<=vers.major) {
    if(flash_minor<=vers.minor) {
      if(flash_release<=vers.release) {
        return true;
      }
    }
  }
  return false;
}

function checkFlash() {

  if(isFlash()) {
    var params = { wmode: "transparent" }
    swfobject.embedSWF("/eng/data/flash/altera.swf", "content", "100%", "100%", flash_major+"."+flash_minor+"."+flash_release, null, null, params);
  } else {
    window.location = '/eng/assets/';
  }
}

$(document).ready(function(){
  var open = false;
  var bottomTimeoutId = 0;
  var loginTimeoutId = 0;

  $('#bottom .buttons ul li.contact').hover( function(){
    $('#bottom .bot').slideDown('fast');
    $('#bottom .bot_spacer').slideDown('fast');
    $("#bottom").animate({
        marginTop: '-38px'
      }, "fast");
    if(bottomTimeoutId)
        clearTimeout(bottomTimeoutId);
  }, function() {
    bottomTimeoutId = setTimeout ( function() {
             $('#bottom .bot').slideUp('slow');
             $('#bottom .bot_spacer').slideUp('slow');
             $("#bottom").animate({
                 marginTop: '0px'
               }, "fast");
             bottomTimeoutId = 0;
        }, 2000);
  });

  $('#login').hover(function() {
    $(this).animate({
      top: '0px'
    }, "fast");
    if(loginTimeoutId)
        clearTimeout(loginTimeoutId);
  }, function() {
    var This = this;
    loginTimeoutId = setTimeout ( function() {
             $(This).animate({
               top: '-49px'
             }, "fast");
             loginTimeoutId = 0;
        },2000);

  });


  if ( !$.browser.msie || ($.browser.msie && $.browser.version > 6 )) {
    function over () {
        el = $(this);
        el.find(".flower").show();
        el.find(".text").show();
        el.find("ul").show();

    }
    function out () {
        el = $(this);
        el.find(".flower").hide();
        el.find("ul").hide();
        el.find(".text").hide();
    }

    $('.tree_but').hover(over,out);

  } else {
    $('.tree_but').hover(function(){
        $(this).find("ul").show();
        $(this).find(".flower").show();
        $(this).find(".text").show();
    },function() {
        $(this).find("ul").hide();
        $(this).find(".flower").hide();
        $(this).find(".text").hide();
    });
  }

  $(document).pngFix();
});

function siteTypeVersion() {
  if(!isFlash()) {
    $("#site_type").hide();
  }
}