$(document).ready(function(){

// $("#grid-overlay").height($("#container").height());

// Script: Balance img heights with adjusted margin bottom

var line_height = 20;
var min_margin = 5;
$('div.article img, div.article object, div.article pre').each(function() {
    var $this = $(this);	// prefixed variable name with $ to remind it's a jQuery object
	var img_height = $this.height();
	var img_margin = ((Math.ceil(img_height / line_height)) * line_height) - img_height;
	img_margin = (img_margin < min_margin)? img_margin + line_height : img_margin;
	if ($this.parent('a').length) {
		$this.parent().parent().css({'margin-bottom' : img_margin + 'px'});
	} else {
		$this.parent().css({'margin-bottom' : img_margin + 'px'});
	}
});

// Script: HoverImgSwap, a-href wird zu img-src und vice versa

$("a[rel='hoverimgswap']").hover(function() {
    var swap_rollover = $(this).attr('href'),
    swap_rollout = $(this).find('img').attr('src');
    $(this).attr("href", swap_rollout).find("img").attr("src", swap_rollover);
},
function() {
    var swap_rollover = $(this).attr("href"),
    swap_rollout = $(this).find("img").attr("src");
    $(this).attr("href", swap_rollout).find("img").attr("src", swap_rollover);
});

// Srcipt-Ende: HoverImgSwap

// Script: Textbox Hints jQuery Plugin

/**
* @author Remy Sharp
* @url http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/

(function ($) {

$.fn.hint = function (blurClass) {
  if (!blurClass) { 
    blurClass = 'blur';
  }
    
  return this.each(function () {
    // get jQuery version of 'this'
    var $input = $(this),
    
    // capture the rest of the variable to allow for reuse
      title = $input.attr('title'),
      $form = $(this.form),
      $win = $(window);

    function remove() {
      if ($input.val() === title && $input.hasClass(blurClass)) {
        $input.val('').removeClass(blurClass);
      }
    }

    // only apply logic if the element has the attribute
    if (title) { 
      // on blur, set value to title attr if text is blank
      $input.blur(function () {
        if (this.value === '') {
          $input.val(title).addClass(blurClass);
        }
      }).focus(remove).blur(); // now change all inputs to title
      
      // clear the pre-defined text when form is submitted
      $form.submit(remove);
      $win.unload(remove); // handles Firefox's autocomplete
    }
  });
};

})(jQuery);

// Script-Ende: Textbox Hints jQuery Plugin

// Script: Textbox Hints Aufruf

$('input:text').hint();

// Script-Ende: Textbox Hints Aufruf

});