jQuery(function($){
    
    var tooltip_options = {
            track:      true,
            delay:      0,
            showURL:    false,
            fade:       0,
            left:       -30,
            top:        20,
            bodyHandler: function() {
                if ($(this)[0].id == "")
                    return;
        
                var tooltip_selector = $(this)[0].id + "_body";
                var tooltip_content = '<div id="erkl_0" class="erklaerung info_layer">'
                                    + '<div class="il_top"></div>'
                                    + '<div class="il_mid">'                                   
                                    + '<div class="richtext"><p>'
                                    + $('#' + tooltip_selector).html()
                                    + '</p></div>'
                                    + '</div><div class="il_bot"></div></div>'; 
                
                return tooltip_content;
            }
    };
    
	$(".tooltip_btn").each(function(){
	    var $this = $(this);
	    var tooltip_options_extended = tooltip_options;
	    if($this.hasClass('tooltip_notrack')) {
	        tooltip_options_extended.track=false;
	    }
        $(this).tooltip(tooltip_options_extended);
	});
	function dena20_add_hovereffects( selector ) {
	    $(selector).each(function(){
	        var me = $(this);
	        if(!me.attr('src') || me.data('overimage')) {
	            return true;
	        }
	        me.data('outimage',me.attr('src'));
	        me.data('overimage',me.attr('src').replace(/\.([^\/]*)$/,'_hover.$1'));
	        me.hover(function(){
	            var me=$(this);
	            me.attr('src',me.data('overimage'))
	        },function(){
	            var me=$(this);
	            me.attr('src',me.data('outimage'))
	        })
	    })
	}
	dena20_add_hovereffects('.img_hover');
});

function replace_umlauts ( text )
{
    text = text.replace ( /[Ä]/g, 'Ae' );
    text = text.replace ( /[ä]/g, 'ae' );
    text = text.replace ( /[Ö]/g, 'Oe' );
    text = text.replace ( /[ö]/g, 'oe' );
    text = text.replace ( /[Ü]/g, 'Ue' );
    text = text.replace ( /[ü]/g, 'ue' );
    text = text.replace ( /ß/g, 'ss' );
    newtext = text.replace(/[^a-z0-9A-Z-]/g,'');

    return newtext;
}
