var ajaxTimeout = false;
function writeFlash(message) {
	if (ajaxTimeout) window.clearTimeout(ajaxTimeout);
	var flashMessage = $('#flash_messages');
	flashMessage.children('.messages:first').html('<p>'+message+'</p>');
	flashMessage.show();
	ajaxTimeout = window.setTimeout('hideFlash()',30000);
}
function hideFlash() {
	$('#flash_messages').fadeOut();
}
$(document).ready(function(){
	$('.widget.right.image img').each(function(){
		$(this).attr('title', 'Klicke, um das Bild zu vergrößern.');
		$(this).click(function(){
			$(this).parent().toggleClass('clicked');
		});
	});
});

/**
 * Function : print_r()
 */
function print_r(arr,depth) {
	if (depth == undefined) depth = 2;
	if (depth = 0) return '';
	var intend = "";
	for (var i=1;i<depth;i++) intend += "      ";
	if(typeof(arr) == 'object') { //Array/Hashes/Objects
		dumped_text = intend+"Object [\n";
		for(var item in arr) {
			var value = arr[item];
			if (typeof(value) == 'function')
				dumped_text += intend+"      '" + item + "' => \"function()\"\n";
			else
				dumped_text += intend+"      '" + item + "' => (" + typeof(value) + ") \"" + print_r(value,depth-1) + "\"\n";
		}
		dumped_text += intend+"]\n";
	} else { //Stings/Chars/Numbers etc.
		dumped_text = intend+arr;
	}
	return dumped_text;
}

var CKEDITOR;
