// Hover-Ersatz f�r IE6
function set_JS_Hover(p_strHover_ID, p_strShow_ID){
	jQuery('#' + p_strHover_ID).mouseover(function(){
		jQuery('#' + p_strShow_ID).addClass('open');
	});
	jQuery('#' + p_strHover_ID).mouseout(function(){
		jQuery('#' + p_strShow_ID).removeClass('open');
	});
}

// Karte bereits geladen
var blnMap_Load = false;
// Karte ist offen
var blnMap_Open = false;
// ID f�r Karten-Container
var strMap_ID = ''

// Google-Map karte �ffnen
function set_GMap_Link(p_strID, p_strMap_ID, p_strGeo_X, p_strGeo_Y){
	strMap_ID = p_strMap_ID;
	jQuery('#' + p_strID).click(function(){
		if(blnMap_Open == false){
			// Karte anzeigen
			jQuery('#' + p_strMap_ID).addClass('show');
			jQuery('#' + p_strID).text(jQuery('#' + p_strID).attr('text_hide'));

			// Karte anzeigen
			if(blnMap_Load == false){
				// Karte laden
				if (GBrowserIsCompatible()) {
					// Karte erstellen
					map = new GMap2(document.getElementById(p_strMap_ID));
					// Karte zentrieren
					map.setCenter(new GLatLng(p_strGeo_X,p_strGeo_Y));
					// Zoomen
					map.setZoom(12);
					// Kontrollelemente setzen
					map.addControl(new GSmallMapControl());
					map.addControl(new GMapTypeControl());
					// Markierung setzen
					var icon = new GIcon();
					icon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png";
					icon.iconSize = new GSize(30, 37);
					icon.iconAnchor = new GPoint(15, 37);
					marker = new GMarker(new GLatLng(p_strGeo_X,p_strGeo_Y), icon)
					map.addOverlay(marker);

					blnMap_Load = true;
				}
			}

			blnMap_Open = true;
		}else{
			// Karte schliessen

			blnMap_Open = false;
			jQuery('#' + p_strMap_ID).removeClass('show');
			jQuery('#' + p_strID).text(jQuery('#' + p_strID).attr('text_show'));
		}
		return false;
	});
}

// Externe Links mit Target versehen
function set_Link_External(p_strExclude){
	var arrInternal = p_strExclude.split(',');

	jQuery('a').each(function(){
		// Pr�fen, ob dies ein Externer Link ist
		var objLink = jQuery(this);
		var blnFind = false;
		jQuery(arrInternal).each(function(intKey){
			if(jQuery(objLink).attr('href') != undefined){
				if(jQuery(objLink).attr('href').replace(arrInternal[intKey], '') != jQuery(objLink).attr('href')){
					// Es gab eine Ersetzung -> Link (Key) gefunden -> Link ist intern
					blnFind = true;
				}
			}
		});

		if(blnFind == false){
			// Wenn es noch kein Target gibt
			if(!jQuery(objLink).attr('target')){
				jQuery(objLink).attr('target', '_blank');
			}
		}
	});
}

function set_Category_Date(){
	if(jQuery('#cboCategory option:selected').attr('tfrom') != ''){
		jQuery('#txtFrom').attr('value', jQuery('#cboCategory option:selected').attr('tfrom'));
	}
	if(jQuery('#cboCategory option:selected').attr('tend') != ''){
		jQuery('#txtTo').attr('value', jQuery('#cboCategory option:selected').attr('tend'));
	}
}

function fadeIn_Search_Map(p_strSearch_ID, p_strMap_ID){
	// Suche ausblenden
	jQuery('#' + p_strSearch_ID).fadeOut('slow', function(){
		// soll eine Karte angezeigt werden
		jQuery('#' + p_strMap_ID).fadeIn('slow', function(){});
	});
}

function fadeOut_Search_Map(p_strSearch_ID, p_strMap_ID){
	// Karte ausblenden
	jQuery('#' + p_strMap_ID).fadeOut('slow', function(){
		// Suche einblenden
		jQuery('#' + p_strSearch_ID).fadeIn('slow', function(){});
		if(jQuery.browser.msie && parseInt(jQuery.browser.version) > 7 && parseInt(jQuery.browser.version) < 9){
			/**
			 * Höhe bei IE 8 korrigieren
			 */
			var old = parseInt(jQuery('#' + p_strSearch_ID).css('height'));
			jQuery('#' + p_strSearch_ID).css('height', (old + 20) + 'px');
		}
	});
}

function check_City_Select(){
	var strValue = jQuery('#cboRegion option:selected').attr('value');
	if(strValue == 'false' && blnRegion_Change == true){
		// alten Inhalt laden
		jQuery('#cboCity').html(strCity);
	}else if(strValue != 'false'){
		jQuery('#cboCity').html(arrRegion[strValue]);
	}
}
