/* A TARGET */
(function($) {
  $.fn.target = function() {
    return this.each(function(index, elm) {
      if (substr($(this).attr("class"), 0, 7) == 'target-') {
        $(this).attr("target", substr($(this).attr("class"), 7));
      }
    });
  }
})(jQuery);

$(document).ready(function() {
  $("a").target();

  $("div.lang").bind("mouseover mouseout click", function(evt) {
    if (evt.type == 'mouseover') {
      if (!$(this).hasClass('lang_selected')) {
        $(this).addClass("lang_over");
      }
    } else if (evt.type == 'mouseout') {
      if (!$(this).hasClass('lang_selected')) {
        $(this).removeClass("lang_over");
      }
    } else if (evt.type == 'click') {
      if (!$(this).hasClass('lang_selected')) {

        $.POST(window.location.href, {sl_id : $(this).attr("id").substr($(this).attr("id").indexOf('_') + 1, $(this).attr("id").length)});
      }
    }
  });

  if ($(window).height() >= $(document).height()) {
    var sitemap = $("div.footer").position().top + $("div.footer").height();

    $("div.footer").height($("div.footer").height() + ($(window).height() - sitemap) - 10);

  }

});
