// Debugging-Function. Only active in Browser who support it
function pr() {
	if (!window.console) {
		return;
	}
	if (typeof window.console !== 'undefined' && typeof window.console.log === 'function') {
		console.log(pr.arguments);
	}
}

(function($) {
	// Produces correct URLs relative to Router::url('/)
	$.url = function(url) {
	  return $('meta[name=identifier-url]').attr('content')+url.substr(1);
	}

	$(function() {
		// Generate a Page-Object to bind events on
		window.Page = $('body');
		
		//Take care about the non-js fallback-version of the site 
		$('body').addClass('js').removeClass('no-js');
		 
		// Make external links open in a new window
		$('a[rel=external]').live('click', function() {
			window.open(this.href);
			return false;
		});

		var height = $('body').height();
		height = height - 350;
		$('.ansprechpartner #ct_content, .aktuelles #ct_content').css('min-height',height+'px');

		// Fix Alpha-PNG's for IE6
		if ($.browser.msie && $.browser.version < 7) {
			$.ifixpng($.url('/js/jquery/ifixpng/pixel.gif'));
			$('img[src$=.png],#wasserzeichen, .plus, .plushover').ifixpng();
		}

		$(".picture").lightbox();
		$(".lbLink").mouseover(function(){
			$(this).attr("src", $(this).attr("alt") + "_hover.png");
		}).mouseout(function(){
			$(this).attr("src", $(this).attr("alt") + ".png");
		});

		$('#contact-form input,#contact-form textarea').each(function(){
			$(this).data('text', $(this).attr('value'));
		});
		$('#contact-form input,#contact-form textarea').bind('focus', function(){
			if ($(this).data('text') == $(this).attr('value')) {
				$(this).attr('value', '');
			}
		}).bind('blur', function(){
			$('#contact-form input,#contact-form textarea').each(function(){
				if ($(this).attr('value').length < 1) {
					$(this).attr('value', $(this).data('text'));
				}
			});
		});

		// And now all the project-specific stuff to be executed ON READY
		$.local.func();
	});

	// Generate namespace for project-specific functions encapsulated in the jQuery $-namespace
	$.local = function() {};
	// Definition of project-specific function
	$.local.func = function() {
		
	};
})(jQuery);

