/* ======= jQuery INIT ========== */
jQuery.noConflict();

if ( window.location.hostname.indexOf('www.jameda')>=0 || window.location.hostname.indexOf('dev.jameda')>=0 ) { var site_layout = "jameda"; }
if ( window.location.hostname.indexOf('arztsuche.focus.de')>=0 ) { var site_layout = "focus"; }
if ( window.location.hostname.indexOf('bild.jameda')>=0 || window.location.hostname.indexOf('arztsuche.bild.de')>=0 ) { var site_layout = "bild"; }

jQuery(document).ready(function($){

	// nur auf www.jameda.de oder dev.jameda.de laden!
	if ( site_layout == "jameda" ) {
		
		// Themen-Übersicht MouseEvents
		function themen_einblenden() { jQuery('#themen_nav_mousearea .schatten').stop(true,true).slideDown(500); jQuery('#all_link_container').css({opacity:1}); }
		function themen_ausblenden() { jQuery('#themen_nav_mousearea .schatten').slideUp(500); jQuery('#all_link_container').css({opacity:0.8}); }
		jQuery('#all_link_container').bind('mouseenter', themen_einblenden);
		jQuery('#themen_nav_mousearea').bind('mouseleave', themen_ausblenden);
		
		// Focus auf Login, falls Login
		if ( document.register_form && document.register_form.email ) {
			document.register_form.email.focus();
		}
		// Focus auf Login, falls Login
		else if ( document.login_form && document.login_form.email ) {
			document.login_form.email.focus();
		}
		
		// --- Link und Image-Button Hover Replacement
		$.rollaHover();
		
		// --- Teaser Boxen mit Mouse-Aktionen versehen
		$('.teaser_box_link_div').hover(function(){$(this).addClass('teaser_box_link_div_hover');},	function(){$(this).removeClass('teaser_box_link_div_hover');});
		$('.teaser_box_link_div').click(function(){$(this).find('a.master').click()});
		
		// --- Flash sIFR
		function render_flashText(selector) {
			$(selector).flash(
				{ src: '/_scripts/jquery/flash/jameda_font.swf', wmode: 'transparent' },
				{ version: 8 },
				function(htmlOptions) {
					var params = ($(this).attr('rel')) ? $(this).attr('rel').split(':') : false;
					if ( params[2]=="center" ) {
						htmlOptions.flashvars.txt = "<p align=\"center\">" + this.innerHTML+"</p>";
					} else {
						htmlOptions.flashvars.txt = this.innerHTML;
					}
					if ( $(this).hasClass('red') ) {
						htmlOptions.flashvars.css = "* { color: #D4160D; font-weight:bold; } a { color: #D4160D; text-decoration: underline; }";
					}
					this.innerHTML = '<div class="alt_flash_text">'+this.innerHTML+'</div>';
					var $alt = $(this.firstChild);
					htmlOptions.height = ( params!=false && params[0]!="-" ) ? params[0] : $alt.height();
					htmlOptions.width = ( params!=false && params[1]!="-" ) ? params[1] : $alt.width();
					$(this)
						.addClass('flash-replaced')
						.prepend($.fn.flash.transform(htmlOptions));	
				}
			);
		}
		render_flashText('.make_flash');

		// --- Datepicker
		$.extend(DateInput.DEFAULT_OPTS, {
		  month_names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
		  short_month_names: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
		  short_day_names: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
		
		  stringToDate: function(string) {
			var matches;
			if (matches = string.match(/^(\d{4,4})-(\d{2,2})-(\d{2,2})$/)) {
			  return new Date(matches[1], matches[2] - 1, matches[3]);
			} else {
			  return null;
			};
		  },
		
		  dateToString: function(date) {
			var month = (date.getMonth() + 1).toString();
			var dom = date.getDate().toString();
			if (month.length == 1) month = "0" + month;
			if (dom.length == 1) dom = "0" + dom;
			return  date.getFullYear() + "-" + month + "-" + dom;
		  }
		});
		$(".date_input").date_input();
	}

	/*// --- AutoCompleter
	$("#such_namen").autocomplete("http://www.jameda.eu/_scripts/jquery/autocomplete/result_namen.php", {
		minChars: 4,
		max: 25,
		delay: 600,
		//matchSubset: 0,
		width: 230,
		selectFirst: false,
		extraParams: {
			gruppe: function() { return $("#suchbox_gruppen").val(); } // Ergebnis hängt von Gruppen Dropdown ab
		},
		highlight: function(value, term) {
			term = term.replace(/,/g, "");
			term = term.replace(/ /g, ",&nbsp;");
			return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
		},
		formatResult: function(data) {
			return data[1];
		}
	});
	$("#such_namen").result(function(event, data, formatted) {
		if (data && data[0]!="..." ) {
			if ( data[2]!="" ) { $("#autocomplete").val(data[2]); }
			else { $("#autocomplete").val("yes"); }
			$("#such_adress").val("");
			$('#such_submit').click();
		}
	});
	$("#suchbox_gruppen").change(function() {$("#such_namen").flushCache();}); // Cache leeren, wenn Gruppen Dropdown verändert wird*/

	// --- Enter-Taste auch im IE bei Formularen zum abschicken aktivieren - obwohl kein submit-Button sichtbar ist
	// mino: aber vorher checken, ob die Pfeil-Runter-Taste gedrückt wurde, denn dann macht der User eine Auswahl und dann soll bei Enter noch nicht submitted werden
	arrow_down_pressed = new Array();
	$('input').keydown(function(e){
		if (e.keyCode == 40) { // Nach-unten Key
			arrow_down_pressed[$(this)] = true;
		} else if (e.keyCode == 13 ) { // Enter Key
			if ( arrow_down_pressed[$(this)] ) {
				arrow_down_pressed[$(this)] = false;
			} else {
				$(this).parents("form").find("input:image").click();
				return false;
			}
		}
	}).blur(function(e){
		arrow_down_pressed[$(this)] = false;
	});

	// --- Corner Plugin
	$('.corner_tl').corner("notch tl 1px");
	$('.corner_bl').corner("notch bl 1px");
	$('.corner_tr').corner("notch tr 1px");
	$('.corner_br').corner("notch br 1px");
	$('.corner_all').corner("notch 1px");
	
	// --- Sort-Leiste Hover
	$('#sort_leiste a.up').css({backgroundPosition: 'right -288px'});
	$('#sort_leiste a').hover(
		function(){
			if ( $(this).hasClass('aktiv') && $(this).hasClass('down') ) { $(this).css({backgroundPosition: 'right -288px'}); }
			else if ( $(this).hasClass('aktiv') && $(this).hasClass('up') ) { $(this).css({backgroundPosition: 'right -307px'}); }
			else { $(this).css({backgroundPosition: 'right -269px'}); } },
		function(){
			if ( $(this).hasClass('aktiv') && $(this).hasClass('down') ) { $(this).css({backgroundPosition: 'right -307px'}); }
			else if ( $(this).hasClass('aktiv') && $(this).hasClass('up') ) { $(this).css({backgroundPosition: 'right -288px'}); }
			else { $(this).css({backgroundPosition: 'right -250px'}); } }
	);
	
	// --- Form Input Example
	$('.form_example').example(function() {
		return $(this).attr('title');
	});
	
	// --- old Tooltip
	if ( typeof htmltooltip != "undefined" ) {
		htmltooltip.render();
	}
	
	// --- mino Tooltip
	if ( $.isFunction($.fn.minoTooltip) ) {
		$('.minoTooltip').minoTooltip();
	}
	
	// --- Waiter entfernen
	$('.wait_cursor').removeClass('wait_cursor');
	$('#suchbox2_select1_content').css('background-image','none');
	
	// --- jqModal
	$('#ajax_window').jqm({
		ajax: '@href',
		ajaxText: '<div style="padding:30px; background-color:#fff;"><strong>Bitte warten...</strong></div>',
		trigger: 'a.ajax_window_link',
		cache: false,
		onLoad: function(hash){
			if ( site_layout=="jameda" ) {
				render_flashText('#ajax_window .make_flash');
				temp_omni_pfad = ($(hash.t).attr('name')) ? $(hash.t).attr('name') : $(hash.t).attr('href').substring(21,$(hash.t).attr('href').length-4);
				if ( $(hash.t).attr('name')!="no_omni_count" ) { setomni('popbox/'+temp_omni_pfad,'partner',omni_agof);	}
			}},
		onShow: function(hash){
			if (document.all) { document.body.scroll = "no"; }
			else { $('body').css('overflow','hidden'); }
			$('#superbanner').hide();
			$('#skyscraper').hide();
			$('#eyeDiv').hide();
			if ( $(hash.t).hasClass('breit') ) { // breite Lightbox (statt 600px)
				hash.w.addClass('jqmWindow_breit');
			}
			if ( $(hash.t).attr('rel').indexOf('vcenter')!=-1 ) { // fixe Höhe übermittelt, deshalb vCenter machen
				$('#ajax_window div:first').height(Number($(hash.t).attr('rel').substring(8)));
				hash.w.jqmShow().vCenter().fadeIn(1000);
			} else {
				hash.w.jqmShow().fadeIn(1000);
			}
		},
		onHide: function(hash){
			if (document.all) { document.body.scroll = ""; }
			else { $('body').css('overflow',''); }
			$('#superbanner').show();
			$('#skyscraper').show();
			$('#eyeDiv').show();
			hash.w.find('.flash-replaced').remove();
			hash.w.fadeOut(600, function(){
				if ( $(hash.t).hasClass('breit') ) { // breite Lightbox (statt 600px)
					hash.w.removeClass('jqmWindow_breit');
				}
				hash.o.remove();
			});
		}
	});
	$('#ajax_suchbox_window').jqm({
		ajax: '/_scripts/output_suchbox2.php',
		ajaxText: '<div style="height:565px; text-align:center; color:#666; background-color:#FFFFFF;"><img src="/_images/loading2.gif" width="32" height="32" style="margin-top:240px;" /><br /><br />laden...</div>',
		cache: false,
		onLoad: function(hash){
			if ( site_layout=="jameda" ) {
				render_flashText('#ajax_suchbox_window .make_flash');
			}},
		onShow: function(hash){
			$('#superbanner').hide();
			$('#skyscraper').hide();
			$('#eyeDiv').hide();
			hash.w.jqmShow().vCenter().slideDown(600);
		},
		// nicht faden im IE6, da das irgendwie nicht funzt (jqModal-Window bleibt stehen)
		onHide: function(hash){
			$('#superbanner').show();
			$('#skyscraper').show();
			$('#eyeDiv').show();
			if ( site_layout=="jameda" || site_layout=="focus" ) {
				setomni('suchbox2'+suchbox2_omnipfad,'partner',omni_agof);
			}
			(!window.XMLHttpRequest) ? hash.w.fadeOut(500,function(){hash.o.remove();}) : hash.w.slideUp(500,function(){hash.o.remove();});
		}
	});
		// Alert Confirm Replace
		$('#jqmalert').jqm({modal: true, trigger: false});
		$('#jqmconfirm').jqm({modal: true, trigger: false});
	
	// --- Lightbox
	$('a[@rel*=lightbox]').lightBox({
		overlayBgColor: '#069BD2',
		overlayOpacity: 0.6,
		imageLoading: '/_scripts/jquery/lightbox/lightbox-ico-loading.gif',
		imageBtnClose: '/_scripts/jquery/lightbox/lightbox-btn-close.gif',
		imageBtnPrev: '/_scripts/jquery/lightbox/lightbox-btn-prev.gif',
		imageBtnNext: '/_scripts/jquery/lightbox/lightbox-btn-next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Bild',
		txtOf: 'von'
	});
	$('a[@rel*=lightbox_black]').lightBox({
		overlayBgColor: '#000000',
		overlayOpacity: 0.6,
		imageLoading: '/_scripts/jquery/lightbox/lightbox-ico-loading.gif',
		imageBtnClose: '/_scripts/jquery/lightbox/lightbox-btn-close.gif',
		imageBtnPrev: '/_scripts/jquery/lightbox/lightbox-btn-prev.gif',
		imageBtnNext: '/_scripts/jquery/lightbox/lightbox-btn-next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Bild',
		txtOf: 'von'
	});

	// --- Accordion für FOCUS-Leistungen
	$('#focus_leistungen_container').accordion({
		header: "a.accord_head",
		autoHeight: false,
		alwaysOpen: false,
		active: ".init_open",
		selectedClass: "aktiv"
	});
	$("#focus_leistungen_container").bind("accordionchange", function(event, ui) {
		if ( site_layout=="jameda" || site_layout=="focus" ) {
			setomni('change_focus_leistungen','partner',omni_agof);
		}
	});
	$('#suchen_sitemap').accordion({
		header: "h2.sitemap_accord_head",
		autoHeight: false,
		alwaysOpen: false,
		active: ".init_open",
		selectedClass: "aktiv"
	});
	$("#suchen_sitemap").bind("accordionchange", function(event, ui) {
		if ( site_layout=="jameda" || site_layout=="focus" ) {
			setomni('suchen-bewerten_sitemap','partner',omni_agof);
		}
	});
});
	// Alert Replace für jqModal
	function alert(msg,goto_url) {
		jQuery('#jqmalert').jqmShow().vCenter().find('div.jqmAlertContent').html(msg);
	}
	// Confirm Replace für jqModal
	function confirm(msg,callback) {
		jQuery('#jqmconfirm').jqmShow().vCenter().find('div.jqmAlertContent').html(msg).end().find('a.jqmbutton').click(function(){
			if ( jQuery(this).hasClass('jqm_ok') ) {
				if (typeof callback == 'string') { window.location.href = callback; }
				else { callback(); }
			}
			jQuery('#jqmconfirm').jqmHide();
			return false;
		});
	}

/* ======= Focus Ads ========== */
//var adsc_keyword="adtest2008"; // only for testing to show deno ads
var adsc_keyword="";         // for live operating
var adsc_layout = "frontpage";     // Typ der Seite, Ressort, Rubrik, Artikel, Galerie...
var adsc_bannerwidth = "728";       // Breite Superbanner
var adsc_bannerheight = "90";       // Hohe Superbanner
var adsc_cad1width = "300";       // Breite Content Ad
var adsc_cad1height = "250";      // Hoehe Content Ad
var adsc_skyscraperwidth = "1";  // Breite Skyscraper
var adsc_skyscraperheight = "2"; // Hoehe Skyscraper
var adsc_skyscraperposx = "830"; // X Position SkyScraper, Breite Content mit Rand

var google_color_border = "cecece";
var google_color_bg = "FFFFFF";
var google_color_link = "069BD2";
var google_color_url = "666666";
var google_color_text = "000000";
var google_ui_features = "rc:0";

function set_background_trans() { // von mino geschrieben, damit beim Wallpaper die Seite eingefärbt werden kann
	document.body.style.backgroundImage = "none";
	document.getElementById('supersuperdiv').style.backgroundImage = "none";
	document.getElementById('superdiv').style.backgroundImage = "none";
}

/* ======= Suchbox-Funktionen ========== */
function hover_cursor(action) {
	if (action=="over") {
		document.body.style.cursor = 'pointer';
	} else {
		document.body.style.cursor = 'default';
	}
}
function checkbox_click(which, box_id, from_suchbox2, force) {
	box = (from_suchbox2) ? document.getElementById('suchbox2_'+box_id) : document.getElementById(box_id);
	if ( typeof force!='undefined' && force!='' ) {
		do_check = (force=="checked") ? true : false;
		box.checked = do_check;
		if (from_suchbox2) { // auch in Suchbox1 übernehmen
			document.getElementById(box_id).checked = do_check;
			(do_check) ? jQuery('#filter_checkbox_'+box_id).show() : jQuery('#filter_checkbox_'+box_id).hide();
		}
	} else if ( !box.readOnly ) {
		if (!which) {
			if ( box.checked ) {
				box.checked = false;
				if (from_suchbox2) { // auch in Suchbox1 übernehmen
					document.getElementById(box_id).checked = false;
					jQuery('#filter_checkbox_'+box_id).hide();
				}
			} else {
				box.checked = true;
				if (from_suchbox2) {
					jQuery('#filter_checkbox_'+box_id).show();
					document.getElementById(box_id).checked = true;
				}
			}
		} else {
			if (from_suchbox2) {
				if ( !box.checked ) {
					jQuery('#filter_checkbox_'+box_id).hide();
					document.getElementById(box_id).checked = false;
				} else {
					jQuery('#filter_checkbox_'+box_id).show();
					document.getElementById(box_id).checked = true;
				}
			}
			return true;
		}
	}
	return false;
}
function select_dropdown_option(dropdown, which) {
	for ( i=0; i<document.getElementById(dropdown).options.length; i++ ) {
		if ( document.getElementById(dropdown).options[i].value == which ) {
			document.getElementById(dropdown).options[i].selected = true;
		}
	}
}

/* ======= Suchbox v1 ======== */
var google_maps_is_loaded = false;
var map;
var bounds;
var geocoder = false;
function prefetch_coords(from_art) {
	document.getElementById('suchbox').style.display = 'none';
	document.getElementById('suchbox_loading').style.display = 'block';
	if ( jQuery('#such_adress').attr('value')!="" && jQuery('#such_adress').attr('value')!="Strasse, PLZ, Ort" ) {
		if (jQuery("#suchbox form[name='suchform']").attr('target')=='_blank') { jQuery("#suchbox form[name='suchform']").attr('target','_top'); } // falls Google-Callback benutzt wird, darf das FORM-Target nicht _blank sein, weil sonst der IE-Popupblocker zuschlägt
		if ( !google_maps_is_loaded ) {
			if ( typeof google != 'undefined' ) {
				google.load("maps", "2",{"callback":load_geocoder, "other_params":"sensor=false"});
			} else {
				submit_search(null, null);
			}
		} else {
			load_geocoder();
		}
	} else {
		submit_search(null, null);
	}
	return false;
}
function load_geocoder() {
	google_maps_is_loaded = true;
	if ( geocoder === false ) {
		geocoder = new google.maps.ClientGeocoder();
	}
	geocoder.setBaseCountryCode('de');
	geocoder.getLocations(document.suchform.address.value+", Germany", fetched_coords);
}
function set_gm_geocode_vars(obj) {
	if ( obj.AddressDetails.Country && obj.AddressDetails.Country.AdministrativeArea && obj.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea ) {
		var temp_response = obj.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea;

		if ( temp_response.Locality ) {
			if ( temp_response.Locality.Thoroughfare ) {
				gmThoroughfareName = temp_response.Locality.Thoroughfare.ThoroughfareName;
			} else if ( temp_response.Locality.DependentLocality && temp_response.Locality.DependentLocality.Thoroughfare ) {
				gmThoroughfareName = temp_response.Locality.DependentLocality.Thoroughfare.ThoroughfareName;
			} else {
				gmThoroughfareName = "";
			}
			if ( temp_response.Locality.PostalCode ) {
				gmPostalCodeNumber = temp_response.Locality.PostalCode.PostalCodeNumber;
			} else if ( temp_response.Locality.DependentLocality && temp_response.Locality.DependentLocality.PostalCode ) {
				gmPostalCodeNumber = temp_response.Locality.DependentLocality.PostalCode.PostalCodeNumber;
			} else {
				gmPostalCodeNumber = "";
			}
			if ( temp_response.Locality.DependentLocality && temp_response.Locality.DependentLocality.DependentLocalityName ) {
				gmDependentLocalityName = temp_response.Locality.DependentLocality.DependentLocalityName;
			} else {
				gmDependentLocalityName = "";
			}
			gmLocalityName = temp_response.Locality.LocalityName;
		} else {
			gmThoroughfareName = "";
			gmPostalCodeNumber = "";
			gmDependentLocalityName = "";
			gmLocalityName = "";
		}
		gmSubAdministrativeAreaName = temp_response.SubAdministrativeAreaName;
		gmAdministrativeAreaName = obj.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
	} else if ( obj.AddressDetails.Country && obj.AddressDetails.Country.AdministrativeArea ) {
		gmThoroughfareName = "";
		gmPostalCodeNumber = "";
		gmDependentLocalityName = "";
		gmLocalityName = "";
		gmSubAdministrativeAreaName = "";
		gmAdministrativeAreaName = obj.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
	} else {
		gmThoroughfareName = "";
		gmPostalCodeNumber = "";
		gmDependentLocalityName = "";
		gmLocalityName = "";
		gmSubAdministrativeAreaName = "";
		gmAdministrativeAreaName = "";
	}
}
function fetched_coords(response) {
	// Keine Antwort
	if ( !response || response.Status.code!=200 ) {
		alert('Der Ort bzw. die Adresse konnte nicht gefunden werden.<br>Bitte ändern Sie Ihre Eingabe. ('+response.Status.code+')');
		document.getElementById('suchbox').style.display = 'block';
		document.getElementById('suchbox_loading').style.display = 'none';
		return false;
	} else {
		set_gm_geocode_vars(response.Placemark[0])
		// noch mal nach Ort suchen, wenn nur nach PLZ gesucht wurde 
		if ( document.suchform.address.value.length==5 && Number(document.suchform.address.value)==document.suchform.address.value && gmLocalityName!="" && gmLocalityName!=gmSubAdministrativeAreaName ) {
			document.suchform.address.value = gmLocalityName+", "+gmSubAdministrativeAreaName;
			geocoder.getLocations(gmLocalityName+", "+gmSubAdministrativeAreaName+", Germany", fetched_coords);
			return false;
		} else {
			// Mehrere Ergebnisse gefunden
			if ( response.Placemark.length > 1 ) {
				if ( document.suchform.suchbox_art && document.suchform.suchbox_art.value=="iframe" ) {
					jQuery("#geocode_response").html("<div style=\"margin-bottom:6px;\"><strong>Bitte w&auml;hlen Sie:</strong></div>");
				} else {
					jQuery("#geocode_response").html("<div style=\"margin-bottom:6px;\">Es wurden mehrere M&ouml;glichkeiten gefunden.<br><strong>Bitte w&auml;hlen Sie:</strong></div>");
				}
				reale_treffer = 0;
				for (i=0; i<response.Placemark.length; i++) {
					treffer = response.Placemark[i];
					if ( treffer.AddressDetails.Country && treffer.AddressDetails.Country.CountryNameCode=="DE" ) {
						reale_treffer++;
						set_gm_geocode_vars(treffer);
						linktext = (gmPostalCodeNumber!="") ? gmPostalCodeNumber+" "+gmLocalityName : gmLocalityName;
						linktext = (gmThoroughfareName!="") ? gmThoroughfareName+", "+linktext : linktext;
						linktext = (gmSubAdministrativeAreaName!=gmLocalityName && gmThoroughfareName=="" && gmPostalCodeNumber=="") ? linktext+", "+gmSubAdministrativeAreaName : linktext;
						search_params = (gmSubAdministrativeAreaName==gmLocalityName) ? "'"+gmThoroughfareName+"','"+gmPostalCodeNumber+"','"+gmLocalityName+"','','"+gmAdministrativeAreaName+"'" : "'"+gmThoroughfareName+"','"+gmPostalCodeNumber+"','"+gmLocalityName+"','"+gmSubAdministrativeAreaName+"','"+gmAdministrativeAreaName+"'";
						jQuery("#geocode_response").append("<a class=\"google_multiple\" href=\"javascript:submit_search("+treffer.Point.coordinates[0]+","+treffer.Point.coordinates[1]+","+search_params+");\">"+linktext+"</a>");
					}
				}
				if ( reale_treffer > 1 ) {
					jQuery("#geocode_response").append("<div style=\"margin-top:6px;\" class=\"blue\"><strong>&laquo;&nbsp;<a href=\"#\" onclick=\"document.getElementById('suchbox').style.display='block'; document.getElementById('geocode_response').style.display='none';\">zur&uuml;ck zur Suche</a></strong></div>");
					document.getElementById('suchbox_loading').style.display = 'none';
					document.getElementById('geocode_response').style.display = 'block';
				} else {
					submit_search(response.Placemark[0].Point.coordinates[0], response.Placemark[0].Point.coordinates[1], gmThoroughfareName, gmPostalCodeNumber, gmLocalityName, gmSubAdministrativeAreaName, gmAdministrativeAreaName);
				}
			// Ein Ergebis gefunden
			} else {
				submit_search(response.Placemark[0].Point.coordinates[0], response.Placemark[0].Point.coordinates[1], gmThoroughfareName, gmPostalCodeNumber, gmLocalityName, gmSubAdministrativeAreaName, gmAdministrativeAreaName);
			}
		}
	}
}
function submit_search(coord_lat, coord_lng, gmThoroughfareName, gmPostalCodeNumber, gmLocalityName, gmSubAdministrativeAreaName, gmAdministrativeAreaName) {
	if (coord_lat && coord_lng) {
		document.suchform.geocode_serialized.value = coord_lat+"_"+coord_lng+"_"+gmThoroughfareName+"_"+gmPostalCodeNumber+"_"+gmLocalityName+"_"+gmSubAdministrativeAreaName+"_"+gmAdministrativeAreaName;
		if ( gmThoroughfareName!="" ) {
			document.suchform.address.value = gmThoroughfareName+", "+gmPostalCodeNumber+" "+gmLocalityName;
		} else if ( gmPostalCodeNumber!="" ) {
			document.suchform.address.value = gmPostalCodeNumber+" "+gmLocalityName;
		} else if ( gmDependentLocalityName!="" ) {
			document.suchform.address.value = gmDependentLocalityName+", "+gmLocalityName;
		} else if ( gmLocalityName!="" ) {
			document.suchform.address.value = (gmLocalityName!=gmAdministrativeAreaName) ? gmLocalityName+", "+gmAdministrativeAreaName : gmLocalityName;
		} else if ( document.suchform.address.value.length!=5 && Number(document.suchform.address.value)!=document.suchform.address.value ) {
			document.suchform.address.value = gmAdministrativeAreaName;
		}
	}
	if ( typeof is_suchbox_widget!="undefined" && is_suchbox_widget==true ) {
		document.getElementById('geocode_response').style.display = 'none';
		document.getElementById('suchbox_loading').style.display = 'none';
		document.getElementById('suchbox').style.display = 'block';
	} else if ( google_maps_is_loaded ) {
		google.maps.Unload();
	}
	document.suchform.submit();
}

/* ======= Suchbox v2 ======== */
var suchbox2_omnipfad = "";
var filter_grupen_ebene = new Array();
var filter_fach_ebene = new Array();
var suchbox2_last_gruppenlink = new Array('','',''); // object_ref | fachs | id
var suchbox2_last_fachlink = new Array('','','',''); // object_ref | theras | id
var suchbox2_last_theralink = new Array('','',''); // object_ref | _leer_ | id
var suchbox2_last_dialink = new Array('','',''); // object_ref | _leer_ | id

function suchbox2_open() {
	// zusätzliche jqModal-Window-Opener Links, die nicht von anfang an da waren, sondern nachgeladen wurden
	jQuery('#ajax_suchbox_window').jqmShow();
	return false;
}
function suchbox2_select_gruppe(link_ref, gruppe, hat_fachs, hat_filter) {
	if ( suchbox2_last_gruppenlink[0]!=link_ref ) { // klick aufs gleiche verhindern
		// vorher geklickten reseten
		if ( suchbox2_last_gruppenlink[0]!="" ) {
			if ( jQuery(suchbox2_last_gruppenlink[0]).hasClass('with_fachs_aktiv') ) {
				jQuery(suchbox2_last_gruppenlink[0]).removeClass('with_fachs_aktiv');
			} else {
				jQuery(suchbox2_last_gruppenlink[0]).removeClass('without_fachs_aktiv');
			}
			jQuery(suchbox2_last_gruppenlink[0]).css('color','');
		}
		// neuen markieren
		if (hat_fachs) {
			jQuery(link_ref).addClass('with_fachs_aktiv');
		} else {
			jQuery(link_ref).addClass('without_fachs_aktiv');
		}
		jQuery(link_ref).css('color','#FFFFFF');
		// --- Filter-Checkboxen
		for ( i in filter_gruppen_ebene ) { // ertsmal alle als sichtbar markieren
			filter_gruppen_ebene[i][0] = 'visible';
		}
		if ( gruppe!="" ) { // alle wieder zum ausblenden markieren, die bei aktueller Gruppe nicht möglich sind
			for ( i in filter_gruppen_ebene ) { // Filter auf Gruppenebene ausblenden
				if ( hat_filter=="" || hat_filter.indexOf(filter_gruppen_ebene[i][1])==-1 ) { // Filter in dieser Gruppe nicht verfügbar
					filter_gruppen_ebene[i][0] = 'hidden';
				}
			}
			for ( i in filter_fach_ebene ) { // Filter auf Fachebene ausblenden
				filter_fach_ebene[i][0] = 'hidden';
			}
			suchbox2_update_filter();
		}
		// neue Aktionen ausführen
		set_suchbox_element('gruppe', Array(gruppe, jQuery(link_ref).html()) );
		if ( suchbox2_last_gruppenlink[2]!="" && suchbox2_last_gruppenlink[2]!=jQuery(link_ref).attr('id') ) {
			suchbox2_delete('fach');
			suchbox2_delete('thera');
			suchbox2_delete('dia');
		}
		suchbox2_last_gruppenlink = new Array(link_ref, hat_fachs, jQuery(link_ref).attr('id'));
		if ( hat_fachs ) {
			jQuery('#suchbox2_fachs').html('<div style="margin:100px 50px 0px 0px; text-align:center; color:#666;"><img src="/_images/loading2.gif" width="32" height="32" /><br /><br />laden...</div>');
			load_content('/_scripts/load_ajax_content.php', 'which=fachgebiet_select&load_for_suchbox2=true&gruppe='+gruppe, 'suchbox2_fachs', true);
		} else {
			jQuery('#suchbox2_fachs').html('<br />&nbsp;&nbsp;&nbsp;&nbsp;&raquo; <em>keine Unterteilung nach Fachgebieten vorhanden</em>');
		}
	}
	return false;
}
function suchbox2_select_fach(link_ref, fach, hat_theras, hat_filter, thera) {
	if ( suchbox2_last_fachlink[0]!=link_ref ) {
		// --- vorher geklickten reseten
		if ( suchbox2_last_fachlink[0]!="" ) {
			if ( jQuery(suchbox2_last_fachlink[0]).hasClass('with_theras_aktiv') ) {
				jQuery(suchbox2_last_fachlink[0]).removeClass('with_theras_aktiv');
			} else {
				jQuery(suchbox2_last_fachlink[0]).removeClass('without_theras_aktiv');
			}
			jQuery(suchbox2_last_fachlink[0]).css('color','');
		}
		// --- neuen markieren
		if (hat_theras) {
			jQuery(link_ref).addClass('with_theras_aktiv');
		} else {
			jQuery(link_ref).addClass('without_theras_aktiv');
		}
		jQuery(link_ref).css('color','#FFFFFF');
		// --- Filter-Checkboxen
		for ( i in filter_fach_ebene ) { // ertsmal alle als sichtbar markieren
			filter_fach_ebene[i][0] = 'visible';
		}
		for ( i in filter_fach_ebene ) { // alle wieder zum ausblenden markieren, die bei aktueller Fach nicht möglich sind
			if ( fach=="" ) {
				filter_fach_ebene[i][0] = 'visible';
			} else if ( hat_filter=="" || hat_filter.indexOf(filter_fach_ebene[i][1])==-1 ) { // Filter in dieser Fach nicht verfügbar
				filter_fach_ebene[i][0] = 'hidden';
			}
		}
		suchbox2_update_filter();
		// --- neue Aktionen ausführen
		if ( fach!="" ) {
			set_suchbox_element('fach', Array(fach, jQuery(link_ref).html()) );
		} else {
			suchbox2_delete('fach');
		}
		suchbox2_last_fachlink = new Array(link_ref, hat_theras, jQuery(link_ref).attr('id'));
		if ( hat_theras ) {
			jQuery("#suchbox2_spalten_container").animate({marginLeft: "-400px"}, 1500);
			if ( suchbox2_last_gruppenlink[0]!="" && jQuery("#suchbox2_selected_gruppe_in_fach").length==0 ) { // Gruppe einblenden, damit die geändert werden kann und die Höhe des Fach-Scrollers verringern
				jQuery("#suchbox2_fachs_container").prepend('<div style="padding:0px 15px;" id="suchbox2_selected_gruppe_in_fach"><a href="#" onclick="return suchbox2_change_gruppe();" style="display:block; color:#000; text-decoration:none; padding: 2px 0px 10px 2px;"><strong style="font-size:16px;">'+jQuery(suchbox2_last_gruppenlink[0]).html()+'</strong>&nbsp;&nbsp;&nbsp;<img src="/_images/suchbox2_change_button.gif" border="0" align="top" /></a></div>');
				jQuery("#suchbox2_fachs div:first").height(jQuery("#suchbox2_fachs").height()-35);
			}
			jQuery('#suchbox2_theras').html('<div style="margin:70px 20px 0px 0px; text-align:center; color:#666;"><img src="/_images/loading2.gif" width="32" height="32" /><br /><br />laden...</div>');
			load_content('/_scripts/load_ajax_content.php', 'which=thera_dia_select&load_for_suchbox2=true&thera='+thera, 'suchbox2_theras', true);
		} else {
			jQuery('#suchbox2_theras').html('<div style="margin:20px 0px 0px 42px;"><em>&raquo; keine Therapie- oder<br />&nbsp;&nbsp;&nbsp;Diagnose-M&ouml;glichkeiten vorhanden</em></div>');
		}
	}
	return false;
}
function suchbox2_select_thera(link_ref, wert) {
	// --- vorher geklickten reseten
	if ( suchbox2_last_theralink[0]!="" ) {
		jQuery(suchbox2_last_theralink[0]).removeClass('theralink_aktiv');
		jQuery(suchbox2_last_theralink[0]).css('color','');
	}
	// --- neuen markieren
	jQuery(link_ref).addClass('theralink_aktiv');
	jQuery(link_ref).css('color','#FFFFFF');
	// --- neue Aktionen ausführen
	if ( wert!="" ) {
		set_suchbox_element('thera', Array(wert, jQuery(link_ref).html()) );
	} else {
		suchbox2_delete('thera');
	}
	suchbox2_last_theralink = new Array(link_ref,'',jQuery(link_ref).attr('id'));
	return false;
}
function suchbox2_select_dia(link_ref, wert) {
	// --- vorher geklickten reseten
	if ( suchbox2_last_dialink[0]!="" ) {
		jQuery(suchbox2_last_dialink[0]).removeClass('theralink_aktiv');
		jQuery(suchbox2_last_dialink[0]).css('color','');
	}
	// --- neuen markieren
	jQuery(link_ref).addClass('theralink_aktiv');
	jQuery(link_ref).css('color','#FFFFFF');
	// --- neue Aktionen ausführen
	if ( wert!="" ) {
		set_suchbox_element('dia', Array(wert, jQuery(link_ref).html()) );
	} else {
		suchbox2_delete('dia');
	}
	suchbox2_last_dialink = new Array(link_ref,'',jQuery(link_ref).attr('id'));
	return false;
}

function suchbox2_update_filter() {
	// erst Fach-Ebene durchgehen, da später von Gruppe überstimmt werden soll
	if ( site_layout != "bild" ) {
		for ( i in filter_fach_ebene ) {
			if ( jQuery('#suchbox2_filter_checkbox_'+filter_fach_ebene[i][1]).length > 0 ) { // gibt's diesen Filter im HTML eigentlich?
				if ( filter_fach_ebene[i][0]=='visible' && jQuery('#suchbox2_filter_checkbox_'+filter_fach_ebene[i][1]).is(':hidden') ) {
					jQuery('#suchbox2_filter_checkbox_'+filter_fach_ebene[i][1]).css('background-color','#ffaba7').fadeIn(600,function(){jQuery(this).css('background-color','')});
				} else if ( filter_fach_ebene[i][0]=='hidden' && jQuery('#suchbox2_filter_checkbox_'+filter_fach_ebene[i][1]).is(':visible') ) {
					jQuery('#suchbox2_filter_checkbox_'+filter_fach_ebene[i][1]).hide();
					checkbox_click(jQuery('#'+filter_fach_ebene[i][1]), filter_fach_ebene[i][1], true, 'unchecked');
				}
			}
		}
		for ( i in filter_gruppen_ebene ) {
			if ( jQuery('#suchbox2_filter_checkbox_'+filter_gruppen_ebene[i][1]).length > 0 ) { // gibt's diesen Filter im HTML eigentlich?
				if ( filter_gruppen_ebene[i][0]=='visible' && jQuery('#suchbox2_filter_checkbox_'+filter_gruppen_ebene[i][1]).is(':hidden') ) {
					jQuery('#suchbox2_filter_checkbox_'+filter_gruppen_ebene[i][1]).css('background-color','#ffaba7').fadeIn(600,function(){jQuery(this).css('background-color','')});
				} else if ( filter_gruppen_ebene[i][0]=='hidden' && jQuery('#suchbox2_filter_checkbox_'+filter_gruppen_ebene[i][1]).is(':visible') ) {
					jQuery('#suchbox2_filter_checkbox_'+filter_gruppen_ebene[i][1]).hide();
					checkbox_click(jQuery('#'+filter_gruppen_ebene[i][1]), filter_gruppen_ebene[i][1], true, 'unchecked');
				}
			}
		}
		// checken, ob min. eine Table visible ist
		( jQuery('#suchbox2_filter table:visible').length > 0 ) ? jQuery('#suchbox2_filter').show() : jQuery('#suchbox2_filter').hide();
	}
}
function set_suchbox_element(which, params) {
	if ( which=="gruppe" ) {
		jQuery('#suchbox_gruppen').attr('value', params[0]);
		jQuery('#suchbox2_select1_content').html(params[1]);
		suchbox2_omnipfad = "/"+ersetze_sonderzeichen(params[1]);
	}
	if ( which=="fach" ) {
		jQuery('#suchbox_fachgebiete').attr('value', params[0]);
		jQuery('.suchbox2_select1').css('background-position','-454px -923px');
		jQuery('#suchbox2_select2_container').show();
		jQuery('#suchbox2_select2_fach').show().html("<a href=\"#\" onclick=\"return suchbox2_delete('fach');\" class=\"suchbox2_select2_del\" title=\"Kriterium entfernen...\"><img src=\"/_images/suchbox2_delete.gif\" border=\"0\" /></a><a href=\"#\" onclick=\"return suchbox2_open();\" class=\"suchbox2_select2\" title=\"Fachgebiet &auml;ndern...\"><strong>"+params[1]+"</strong></a>");
		suchbox2_omnipfad += "/"+ersetze_sonderzeichen(params[1]);
	}
	if ( which=="thera" ) {
		jQuery('#suchbox2_thera').attr('value', params[0]);
		jQuery('#suchbox2_select2_thera').show().html("<a href=\"#\" onclick=\"return suchbox2_delete('thera');\" class=\"suchbox2_select2_del\" title=\"Kriterium entfernen...\"><img src=\"/_images/suchbox2_delete.gif\" border=\"0\" /></a><a href=\"#\" onclick=\"return suchbox2_open();\" class=\"suchbox2_select2\" title=\"Therapie &auml;ndern...\">"+params[1]+"</a>");
	}
	if ( which=="dia" ) {
		jQuery('#suchbox2_dia').attr('value', params[0]);
		jQuery('#suchbox2_select2_dia').show().html("<a href=\"#\" onclick=\"return suchbox2_delete('dia');\" class=\"suchbox2_select2_del\" title=\"Kriterium entfernen...\"><img src=\"/_images/suchbox2_delete.gif\" border=\"0\" /></a><a href=\"#\" onclick=\"return suchbox2_open();\" class=\"suchbox2_select2\" title=\"Diagnose-M&ouml;glichkeit &auml;ndern...\">"+params[1]+"</a>");
	}
	return false;
}
function suchbox2_delete(which) {
	if ( which=="fach" ) {
		jQuery('#suchbox_fachgebiete').attr('value', '');
		jQuery('#suchbox2_select2_fach').fadeOut(500).html('');
		suchbox2_last_fachlink = new Array('','','');
	}
	if ( which=="thera" ) {
		jQuery('#suchbox2_thera').attr('value', '');
		jQuery('#suchbox2_select2_thera').fadeOut(500).html('');
		suchbox2_last_theralink = new Array('','','');
	}
	if ( which=="dia" ) {
		jQuery('#suchbox2_dia').attr('value', '');
		jQuery('#suchbox2_select2_dia').fadeOut(500).html('');
		suchbox2_last_dialink = new Array('','','');
	}
	if ( jQuery('#suchbox2_select2_fach').html()=="" && jQuery('#suchbox2_select2_thera').html()=="" && jQuery('#suchbox2_select2_dia').html()=="" ) {
		jQuery('.suchbox2_select1').css('background-position','-454px -900px');
		jQuery('#suchbox2_select2_container').fadeOut(500);
	}
	return false;
}
function suchbox2_change_gruppe() {
	jQuery("#suchbox2_spalten_container").animate({marginLeft: "0px"}, 1000);
	if ( jQuery("#suchbox2_selected_gruppe_in_fach").is(':visible') ) {
		jQuery("#suchbox2_selected_gruppe_in_fach").remove();
		jQuery("#suchbox2_fachs div:first").height(jQuery("#suchbox2_fachs").height()+35);
	}
	return false;
}
function pre_select_suchbox2_option(which,wert) {
	if ( which=="gruppe" ) {
		if ( suchbox2_last_gruppenlink[2]!="" ) { // vorher in Suchbox2 Gruppe selected
			jQuery('#'+suchbox2_last_gruppenlink[2]).click();
		} else if ( wert!="" && jQuery('#suchbox_gruppen').attr('value')!="" ) { // Session-Wert vorhanden, aber nicht über kleines "x" gelöscht
			jQuery('#gruppen_link_'+wert).click();
		}
	}
	else if ( which=="fachgebiet" ) {
		if ( suchbox2_last_fachlink[2]!="" ) { // vorher in Suchbox2 Fachgebiet selected
			jQuery('#'+suchbox2_last_fachlink[2]).click();
		} else if ( wert!="" && jQuery('#suchbox_fachgebiete').attr('value')!="" ) { // Session-Wert vorhanden, und nicht über kleines "x" gelöscht
			jQuery('#fach_link_'+wert).click();
		} else { // vorher keine Fachgebiets-Suche gesucht, oder nachträglich Gruppe geändert
			jQuery('#fach_link_').click();
		}
	}
	else if ( which=="thera" ) {
		if ( suchbox2_last_theralink[2]!="" ) { // vorher in Suchbox2 Fachgebiet selected
			jQuery('#'+suchbox2_last_theralink[2]).click();
		} else if ( wert!="" && jQuery('#suchbox2_thera').attr('value')!="" ) { // Session-Wert vorhanden, und nicht über kleines "x" gelöscht
			jQuery('#thera_link_'+wert).click();
		} else { // vorher keine Fachgebiets-Suche gesucht, oder nachträglich Gruppe geändert
			jQuery('#thera_link_').click();
		}
	}
	else if ( which=="dia" ) {
		if ( suchbox2_last_dialink[2]!="" ) { // vorher in Suchbox2 Fachgebiet selected
			jQuery('#'+suchbox2_last_dialink[2]).click();
		} else if ( wert!="" && jQuery('#suchbox2_dia').attr('value')!="" ) { // Session-Wert vorhanden, und nicht über kleines "x" gelöscht
			jQuery('#dia_link'+wert).click();
		} else { // vorher keine Fachgebiets-Suche gesucht, oder nachträglich Gruppe geändert
			jQuery('#dia_link_').click();
		}
	}
}
function suchbox2_suche_starten() {
	jQuery('#ajax_suchbox_window').jqmHide();
	prefetch_coords();
	return false;
}

// AJAX ======================================
var httpRequest = false;
var noResult = "Kein Ergebnis";

function load_content(url, params, outputId, own_loader) {
	if ( own_loader!==true ) { document.getElementById(outputId).innerHTML = "laden..."; }
	httpRequest = false;
	if(window.XMLHttpRequest)  // Mozilla, Safari,...
	   httpRequest = new XMLHttpRequest();
	else if(window.ActiveXObject) { // IE
	   try {
		   httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	}
	   catch (e) {
		   try {
			   httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	 }
		   catch (e) {}
	   }
	}
	if(!httpRequest) 
	  return false;
	httpRequest.onreadystatechange = function() {
		if (httpRequest.readyState == 4) {
			if (httpRequest.status == 200) 
				handleHttpResponse(httpRequest.responseText, outputId);
			else
			  return false;
		}
		else
		   return false;
	} 
	httpRequest.open('post', url, true);
	httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	httpRequest.send(params);
	return false;
}
function handleHttpResponse(content, outputId) {
	if(!document.getElementById)
		return false;
	if(!document.getElementById(outputId))
		return false;
	if (content == "FALSE") {
		document.getElementById(outputId).innerHTML = noResult;
	} else {
		document.getElementById(outputId).innerHTML = content;
		evalScript(content);
	}
}
function evalScript(scripts) {
	try {
		if (scripts != '') {
			var script = "";
			scripts = scripts.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){ if (scripts !== null) script += arguments[1] + '\n'; return '';});
			if (script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
		}
		return false;
	}
	catch(e) { alert(e)	}
}

/* ======= Allgemeines Javascript ========== */
function geheZu(ziel) {
	document.location.href = ziel.replace(/§/g, "/");
	return false;
}
var bisher_empfohlen = new Array();
function do_empfehlung(ref_id, ist_bewertbar, art) {
	if ( bisher_empfohlen[ref_id] != true && bisher_empfohlen[ref_id] != "working" ) {
		jQuery('#empfehlen_container_'+ref_id+' div.minoTooltip_Content').html(''); // empty minoTooltip
		if ( jQuery('#empfehlen_'+ref_id+' img').length == 0 ) {
			jQuery('#empfehlen_'+ref_id+' div').css('marginTop','-2px').prepend('<img src="/_images/loading2_small_invers.gif" border="0" style="margin-bottom:4px;" /><br />');
		}
		jQuery.ajax({type: "GET", cache: false, url: "/_scripts/load_ajax_content.php", data: "which=empfehlung&response=json&ref_id="+ref_id+"&art="+art+"&ist_bewertbar="+ist_bewertbar, dataType: 'json', success: function(response){after_empfehlung(response, false);}});
		bisher_empfohlen[ref_id] = true;
	} else if ( bisher_empfohlen[ref_id] != "working" ) {
		jQuery.ajax({type: "GET", cache: false, url: "/_scripts/load_ajax_content.php", data: "which=undo_empfehlung&response=json&ref_id="+ref_id+"&art="+art+"&ist_bewertbar="+ist_bewertbar, dataType: 'json', success: function(response){after_empfehlung(response, true);}});
		bisher_empfohlen[ref_id] = "working";
	}
	return false;
}
function after_empfehlung(r, undo) {
	if ( undo===true ) {
		animate_px = new Array('-48px','-20px','-10px -280px','-10px -324px','Jetzt erneut empfehlen...'); // DIV from, DIV to, Background-Position Erfolg, Background-Position kein Erfolg
	} else {
		animate_px = new Array('-20px','-48px','-10px -346px','-10px -324px','Klicken Sie erneut, um die Empfehlung r&uuml;ckg&auml;ngig zu machen.');
	}
	if ( r.msg=="success" ) {
		if ( undo===true ) { bisher_empfohlen[r.ref_id] = false; }
		jQuery('#empfehlen_'+r.ref_id+' div').css('marginTop',animate_px[0]).animate({marginTop: animate_px[1]}, 1000, "easeInOutBack", function() {
			if ( r.ist_bewertbar=="1" && undo!==true ) {
				jQuery('#empfehlen_container_'+r.ref_id).append("<div id=\"danke_"+r.ref_id+"\" style=\"position:absolute; top:-74px; left:-26px; width:261px; height:84px; overflow:hidden; z-index:2000; zoom:1;\"><div style=\"margin-top:100px; z-index:2001; zoom:1;\"><img class=\"pngfix\" src=\"/_images/danke-empfehlung.png\" width=\"261\" height=\"74\" border=\"0\" /></div></div>");
				jQuery('#danke_'+r.ref_id+' div').animate({marginBottom:'0px'},300).animate({marginTop:"10px"}, 1000, "easeInOutBack", function(){
					jQuery(this).animate({marginBottom:'0px'}, 4000, function(){
						jQuery('#danke_'+r.ref_id).slideUp(800, function(){
							jQuery('#empfehlen_container_'+r.ref_id+' div.minoTooltip_Content').html('<span style="display:block; padding:6px;">'+animate_px[4]+'<br />Bitte geben Sie auch eine ausf&uuml;hrliche Bewertung ab.</span>'); // minoTooltip neu setzen
							jQuery('#empfehlen_container_'+r.ref_id+' a.empfehlen_button').css('backgroundPosition',animate_px[2]);
							jQuery(this).remove();
						});
					});
				});
			} else {
				jQuery('#empfehlen_container_'+r.ref_id+' div.minoTooltip_Content').html('<span style="display:block; padding:6px;">'+animate_px[4]+'</span>'); // minoTooltip neu setzen
				jQuery('#empfehlen_container_'+r.ref_id+' a.empfehlen_button').css('backgroundPosition',animate_px[2]);
			}
		});
	} else {
		jQuery('#empfehlen_'+r.ref_id+' div').stop(true).css('marginTop',animate_px[0]);
		jQuery('#empfehlen_container_'+r.ref_id+' div.minoTooltip_Content').html('<span style="display:block; width:250px; padding:6px; white-space:normal;">'+r.msg+'</span>'); // minoTooltip neu setzen
		jQuery('#empfehlen_container_'+r.ref_id+' a.empfehlen_button').css('backgroundPosition',animate_px[3]);
		alert(r.msg);
	}
}

function mouse_radiobox(which, what, bgcolor) {
	if ( what=="over" ) {
		which.style.backgroundColor=bgcolor;
		if ( bgcolor=="#069BD2" ) { which.style.color = '#ffffff'; }
		which.style.cursor = 'pointer';
	} else {
		which.style.backgroundColor='transparent';
		which.style.color = '';
		which.style.cursor = 'default';
	}
}

function submit_form(submit_button_id) {
	jQuery('#'+submit_button_id+'').click();
	return false;
}

function openWin (url, name, features) {
	new_win = window.open(url, name, features);
	new_win.focus();
}

function minmax_map() {
	if ( jQuery("#map_div").outerHeight() < 120 ) {
		jQuery("#map_div").animate({height: "500px"}, 1500, "easeInOutBack", function(){map_resize_finished('maxed');});
		jQuery("#minmax_map").css({display:"none"});
	} else {
		map.removeControl(largeMapControl);
		map.removeControl(mapTypeControl);
		jQuery("#map_div").animate({height: "100px"}, 1000, "easeOutBack", function(){map_resize_finished('mined');});
		jQuery("#minmax_map").css({display:"none"});
	}
	if ( site_layout=="jameda" || site_layout=="focus" ) {
		setomni('resize_map','partner',omni_agof);
	}
}
function map_resize_finished(which) {
	if ( which == "maxed" ) {
		map.checkResize();
		largeMapControl = new google.maps.LargeMapControl3D();
		mapTypeControl = new google.maps.MapTypeControl();
		map.addControl(largeMapControl);
		map.addControl(mapTypeControl);
		map.setZoom(map.getBoundsZoomLevel(bounds));
		map.setCenter(bounds.getCenter());
		jQuery("#minmax_map").css({backgroundPosition:"0px -23px", top:"35px", display:"block"});
		jQuery("#minmax_map").attr({title: "Karte wieder verkleinern..."});
	} else {
		map.checkResize();
		map.setZoom(map.getBoundsZoomLevel(bounds));
		map.setCenter(bounds.getCenter());
		jQuery("#minmax_map").css({backgroundPosition:"0px 0px", top:"7px", display:"block"});
		jQuery("#minmax_map").attr({title: "Karte vergr&ouml;&szlig;ern..."});
	}
}

function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}
function ersetze_sonderzeichen(str) {
	such = new Array("Ä","ä","Ö","ö","Ü","ü","ß"," - "," / ","/"," | ","|"," & ","&",". ",".","'","\"","“","„","’",", ",","," (","(",") ",")"," ");
	ersetzen = new Array("Ae","ae","Oe","oe","Ue","ue","ss","-","-","-","-","-","-","-","-","-","","","","","","-","-","-","-","-","-","-");
	for ( i=0; i<such.length; i++ ) {
		str = str_replace(such[i], ersetzen[i], str);
	}
	return str;
}

/* ======= FOCUS Omniture ======== */
function delomni() {
	delete(s.pageName); delete(s.eVar5); delete(s.channel); delete(s.eVar6); delete(s.eVar3); delete(s.hier1); delete(s.prop2); delete(s.eVar7); delete(s.prop3); delete(s.prop4); delete(s.prop5); delete(s.prop6); delete(s.eVar8); delete(s.prop7); delete(s.prop8); delete(s.prop9); delete(s.prop10); delete(s.prop11); delete(s.prop12); delete(s.prop13); delete(s.prop14); delete(s.prop15); delete(s.prop16); delete(s.prop17); delete(s.prop18); delete(s.prop19); delete(s.prop22);
}
function setDefaultProperties(category,agof) {
	delomni();
	s.pageName="jameda";
	s.eVar5=s.pageName;
	s.channel="jameda";
	s.eVar6=s.channel;
	if (category) {s.prop6=category;} else {s.prop6='partner';}
	s.eVar8=s.prop6;
	if (agof) {s.prop7=agof;} else {s.prop7='20370';}
	s.trackingServer="omni.focus.de";
	s.hier1=s.pageName;
}
function getomni(category,agof) {
	setDefaultProperties(category,agof);
	var s_code=s.t();
	if (document.getElementById('ivwpixel')) {document.getElementById('ivwpixel').src = getivw(s.prop7);}
}
function setomni(pagename,cat,agof,from_partner,vermarkt_id) {
	setDefaultProperties('','');
	var defIdent = 'defProp';
	if (pagename != defIdent) {
		pagename = pagename.replace(/%===%/g, "/"); // Pagename-Verschandeln-Zurücksetzen - damit Google nicht indiziert
		if ( site_layout == "focus" ) {
			if ( pagename.indexOf('focus_channelizer')!==0 ) { pagename = (pagename.indexOf('/')!==0) ? "focus_channelizer/"+pagename : "focus_channelizer"+pagename; } // MINO Edit
		} else {
			if ( pagename.indexOf('jameda/')!==0 ) { pagename = (pagename.indexOf('/')!==0) ? "jameda/"+pagename : "jameda"+pagename; } // MINO Edit
		}
		var spl = pagename;
		var parts = spl.split("/");
		s.pageName=""+pagename;
		s.eVar5=s.pageName;
		//s.channel= ""+parts[0];   -- MINO Edit
		s.channel= "jameda";
		s.eVar6=s.channel;
		if (parts[1]){s.prop2=parts[1]; s.eVar7=parts[1];} else {delete(s.prop2); delete(s.eVar7);}
		if (parts[2]){s.prop3=parts[2]} else {delete(s.prop3);}
		if (parts[3]){s.prop4=parts[3]} else {delete(s.prop4);}
		if (parts[4]){s.prop5=parts[4]} else {delete(s.prop5);}
	}
	if (cat == "") {delete(s.prop6); delete(s.eVar8);} else if (cat != defIdent) {s.prop6=cat; s.eVar8=cat;}
	if (agof == "") {delete(s.prop7);} else if (agof != defIdent) {s.prop7=agof;}
	//if (datum == "") {delete(s.prop8);} else if (datum != defIdent) {s.prop8=datum;}
	//if (autor == "") {delete(s.prop9);} else if (autor != defIdent) {s.prop9=autor;}
	//if (ad == "") {delete(s.prop10);} else if (ad != defIdent) {s.prop10=ad;}
	//if (adkw == "") {delete(s.prop11);} else if (adkw != defIdent) {s.prop11=adkw;}
	//if (archiv == "") {delete(s.prop12);} else if (archiv != defIdent) {s.prop12=archiv;}
	//if (special == "") {delete(s.prop13);} else if (special != defIdent) {s.prop13=special;}
	// s.prop14: omni_uv
	//if (such1 == "") {delete(s.prop15);} else if (such1 != defIdent) {s.prop15=such1;}
	//if (such2 == "") {delete(s.prop16);} else if (such2 != defIdent) {s.prop16=such2;}
	//if (p17 =='undefined' || p17 == "") {
	//	if (cat=="artikel" || cat=="video") {
	//		s.prop17=cat+":"+parts[parts.length-1];
	//	} else {
	//		delete(s.prop17);
	//	}
	//} else if (p17 != defIdent) {s.prop17=p17;}
	//if (map == "") {delete(s.prop18);} else if (map != defIdent) {s.prop18=map;}
	//if (p19 =='undefined' || p19 == "") {delete(s.prop19);} else if (p19 != defIdent) {s.prop19=p19;}
	// -- MINO Edit
	if (from_partner == "") {delete(s.prop9);} else {s.prop9=from_partner;}
	if (vermarkt_id == "") {delete(s.prop10);} else {s.prop10=vermarkt_id;}
	// --
	s.trackingServer="omni.focus.de";
	s.hier1=s.pageName;
	var s_code=s.t();
	if (document.getElementById('ivwpixel')) {document.getElementById('ivwpixel').src = getivw(s.prop7);}
}
function getivw (ivwagof) {
	var tft_ivwagof = '20370';
	if (ivwagof != "") {tft_ivwagof=ivwagof;}
	var ivw_path = 'http://focus.ivwbox.de/cgi-bin/ivw/CP/'+tft_ivwagof;
	var ra0 = new Date().getTime();
	var tmp0= "";
	var rf0 = "";
	if (! document.referrer) {rf0='noref';} else {tmp0 = document.referrer;rf0 = tmp0.replace(/\"/g, "");rf0 = rf0.replace(/\'/g, "");rf0 = rf0.replace(/\</g, "");rf0 = rf0.replace(/\>/g, "");rf0=escape(rf0);}
	rf0=rf0.replace (/\//g, '%2F');
	return ivw_pixel=ivw_path+";"+ra0+"?r="+rf0;
}
