jQuery.noConflict();

// Center images on page load - http://code.drewwilson.com/entry/imgcenter-jquery-plugin
jQuery(window).load(function(){
	jQuery("#content .post-image img").imgCenter({
		parentSteps: 1,
		scaleToFit: false,
		centerVertical: false
	}); 
});

jQuery(document).ready(function(){
	
	jQuery.fn.print_r = function (theObj){
	  if(theObj.constructor == Array ||
		 theObj.constructor == Object){
		document.write("<ul>")
		for(var p in theObj){
		  if(theObj[p].constructor == Array||
			 theObj[p].constructor == Object){
			document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
			document.write("<ul>")
			print_r(theObj[p]);
			document.write("</ul>")
		  } else {
			  document.write("<li>["+p+"] => "+theObj[p]+"</li>");
		  }
		}
		document.write("</ul>")
	  }
	};
	
	// Grid JS
	jQuery(document).bind("keydown", "Alt+Shift+g", function(){
		jQuery("body").toggleClass("gridsystem");
	});

	// Previous Hot Key 
    jQuery(document).bind('keydown', 'left', function(){
		var prevlink = jQuery("#nav-above .nav-previous a").attr("href");
		if (!prevlink == '') {
			window.location = prevlink;
		}
    });

	// Next Hot Key 
    jQuery(document).bind('keydown', 'right', function(){
		var nextlink = jQuery("#nav-above .nav-next a").attr("href");
		if (!nextlink == '') {
			window.location = nextlink;
		}
    });

	jQuery('scroll-top').each(function() {
			jQuery(window).scroll(function() {
			if(jQuery(window).attr('height') <= jQuery('body').attr('height') ) {
				jQuery(this).stop(true).fadeTo('fast', 1);
				}
			else {
				jQuery(this).stop(true).fadeTo("fast", 0);
				}
		});
	});
	
	jQuery('#search-submit').fadeTo('fast', 0);
	
	jQuery('#s').focus(function () {
		if(jQuery(this).val() == 'suchen...')
			jQuery(this).val('');
		jQuery('#search-submit').fadeTo('slow', 1);
	});
	jQuery('#s').blur(function () {
		if(jQuery(this).val() == ''){
			jQuery(this).val('suchen...');
		}
		jQuery('#search-submit').fadeTo('slow', 0);
	});
	
	jQuery('a').smoothScroll('slow');
});
