
/* Für das Switchen bei den Inputtexte von sichtbar zu unsichtbar und umgekehrt */

/* sollten Inputfeldern dazukommen, muss dieses Array hier ergänzt werden */
var field_id_array = new Array();

field_id_array[0] = new Object();
field_id_array[0]["field_id"] = "#postal_code";
field_id_array[0]["field_value"] = "Ort, Postleitzahl";


field_id_array[1] = new Object();
field_id_array[1]["field_id"] = "#username";
field_id_array[1]["field_value"] = "E-Mail";

field_id_array[2] = new Object();
field_id_array[2]["field_id"] = "#pw";
field_id_array[2]["field_value"] = "Passwort";


field_id_array[3] = new Object();
field_id_array[3]["field_id"] = "#profile_name";
field_id_array[3]["field_value"] = "Name des Suchprofiles eingeben";

$(document).ready(function(){

	for (var i = 0; i < field_id_array.length; i++) {
		setInputValues(field_id_array[i]["field_id"], field_id_array[i]["field_value"]);
	}

});

function setInputValues(field_id, field_value) {	
	$(field_id).click(function(){
		this.value = "";		
	});
	$(field_id).focus(function(){
		this.value = "";		
	});
	$(field_id).blur(function(){
		if (this.value != "") {
			field_value = this.value;
		}this.value = field_value;
	});
	// Type Aenderung im IE nicht moeglich - vermutlich aus Security Gruenden */
	/*
	if (field_id == "#pw"){
		$(field_id).click(function(){
			this.type = "password";
		});
		$(field_id).blur(function(){
			if (this.value != "" && this.value != "Passwort") {
				this.type = "password"
			}
			else {
				this.type = "text";				
			}			
		});
	}
	*/
}


/* Für das Markieren eine Immobilie bei den Suchergebnissen */

var checked_array = new Array();

function switch_inactive(li)
{
	var li = document.getElementById(li);
	var li_id = li.getAttribute("id")
	
	if (li_id == "geo_suche") {
		li.className = "active";
		document.getElementById("erweiterte_suche").className = "inactive";
	}
	else if (li_id == "erweiterte_suche") {		
		li.className = "active";
		document.getElementById("geo_suche").className = "inactive";
	}
}
function select_immo(checkbox_id)
{
	var checkbox = document.getElementById(checkbox_id);
	var style_attr = checkbox.parentNode.parentNode.style;
	
	var bgcolor_active = "#a8a8a8";
	var color_default = "#000000";
	var color_active = "#ffffff";
	
	if (checkbox.checked && (checked_array[checkbox_id] || checked_array[checkbox_id] == undefined)) {
		style_attr.backgroundColor = bgcolor_active;
		style_attr.color = color_active;
		checked_array[checkbox_id] = false;
	}
	else {
		style_attr.backgroundColor = "#e7e7e7";
		style_attr.color = color_default;
		checked_array[checkbox_id] = true;
	}
}


/* Quicklink Navigatin in der Sidebar links */

function load_quicklink(select)
{
	var index = select.options.selectedIndex;
	if (index == 0) return false;
	var seite = select[index].value.split("|");
	window.open(seite[0], seite[1]);
}


