
function closediv(id) {
document.getElementById(id).style.display='none';}

function execJS(node) {
 /* Element auf Javascript überprüfen, und falls nötig ausführen */
 var bSaf = (navigator.userAgent.indexOf('Safari') != -1);
 var bOpera = (navigator.userAgent.indexOf('Opera') != -1);
 var bMoz = (navigator.appName == 'Netscape');
 var st = node.getElementsByTagName('script'); var strExec;
   
 for(var i=0;i<st.length; i++) { if (bSaf) { strExec = st[i].innerHTML; 
} else if (bOpera) { strExec = st[i].text; 
}
   else if (bMoz) { strExec = st[i].textContent; 
} else { strExec = st[i].text; 
} try { eval(strExec); 
} catch(e) { alert(e);
}}}

function formsammeln(listingid) {
var url = 'http://www.immonation.de/index.php?action=contact_agent_quick&listing_id='+listingid+'&popup=yes';
url = url+'&message='+document.contact_agent.message.value;
url = url+'&name='+document.contact_agent.name.value;
url = url+'&email='+document.contact_agent.email.value;
url = url+'&subject='+document.contact_agent.subject.value;
if(document.contact_agent.info.checked == true)
url = url+'&info='+document.contact_agent.info.value;
if(document.contact_agent.termin.checked == true)
url = url+'&termin='+document.contact_agent.termin.value;
escape(url);
return url;
}

function mailwirdgesendet() {
document.getElementById('container2').innerHTML = 'Ihre Anfrage wurde verschickt. <br>Vielen Dank.';

}

/* Simple AJAX Code-Kit (SACK) v1.6.1 */
/* ©2005 Gregory Wild-Smith */
/* www.twilightuniverse.com */
/* Software licenced under a modified X11 licence,
   see documentation or authors website for more details */

function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}



/* 
	Copyright: Robert Nyman, http://www.robertnyman.com
	Free to use for anyone, for studying or commercial purposes. This text has to be included when used:
	Concept and code by Robert Nyman, http://www.robertnyman.com
*/
// ---
var ask = new Ask();
addWindowEvent("load", function(){ask.init();}, false);
addWindowEvent("unload", function(){ask.clearVariables();}, false);
// ---
function Ask(){	
	this.hasXmlHttpSupport = typeof XMLHttpRequest != "undefined" || typeof window.ActiveXObject != "undefined";
	this.xmlHttp = null;
	this.xmlHttpCallComplete = true;	
	this.isIE = document.all && navigator.userAgent.search(/MSIE/i) != -1 && navigator.userAgent.search(/Opera/i) == -1;
	this.isIE50 = this.isIE && navigator.userAgent.search(/MSIE 5.0/i) != -1;
	this.iframe = null;
	this.iframeFakeFile = "blank.htm";
	this.hashLocation = location.hash;
	this.locationInterval = null;
	this.history = [];
	this.useSameTargetForSeveralCalls = true;
	this.linksToGetContentFor = null;
	this.intUniqueCounter = 0;
	this.urlExt = "ajax=true";
	this.links = [];
	this.currentLink = null;
	this.currentLinkIndex = null;
	this.currentLinkURL = null;
	this.elmToPresentIn = null;
	this.responseText = "";
}
Ask.prototype.init = AskInit;
Ask.prototype.clearVariables = AskClearVariables;
Ask.prototype.timerLocationCheck = AskTimerLocationCheck;
Ask.prototype.setState = AskSetState;
Ask.prototype.createXmlHttp = AskCreateXmlHttp;
Ask.prototype.clearXmlHttp = AskClearXmlHttp;
Ask.prototype.createHistory = AskCreateHistory;
Ask.prototype.addEvents = AskAddEvents;
Ask.prototype.linkClickEvent = AskLinkClickEvent;
Ask.prototype.getContent = AskGetContent;
Ask.prototype.getMultipleContent = AskGetMultipleContent;
Ask.prototype.presentContent = AskPresentContent;
// ---
function AskInit(){
	if(this.hasXmlHttpSupport){
		this.addEvents(document);
		/*if(this.isIE && !this.isIE50){
			var oIframe = document.createElement("iframe");
			oIframe.style.position = "absolute";
			oIframe.style.left = "-999px";
			oIframe.setAttribute("id", "fake-history-iframe");
			document.body.appendChild(oIframe);
			this.iframe = window.frames["fake-history-iframe"];
			this.iframe.location.href = this.iframeFakeFile;
		}*/
		if(!this.isIE50){
			if(this.hashLocation.length > 0){
				this.setState();
			}
			else{
				this.locationInterval = setInterval("ask.timerLocationCheck()", 100);
			}
		}
	}
}
// ---
function AskClearVariables(){
	this.clearXmlHttp();
	this.xmlHttpCallComplete = true;
	this.locationInterval = null;
	this.iframe = null;
	this.hashLocation = location.hash;
	this.history = [];
	this.intUniqueCounter = 0;
	this.links = [];
	clearInterval(this.locationInterva);
}
// ---
function AskTimerLocationCheck(){
	if(location.hash != this.hashLocation){
		this.hashLocation = location.hash;
		this.setState();
	}
}
// ---
function AskSetState(){
	var arrLinkIndexes = (this.hashLocation.length > 1)? this.hashLocation.replace(/#/, "").split(":") : [];
	if(arrLinkIndexes.length > 0 && this.history.length == 0){
		this.linksToGetContentFor = [];
		try{
        	for(var i=0; i<arrLinkIndexes.length; i++){
				intLinkIndex = arrLinkIndexes[i];
				this.linksToGetContentFor.push(this.links[intLinkIndex][0]);
			}
        }
        catch(e){
        	// To avoid history cache errors in IE
        }
		this.getMultipleContent();
	}
	else if(arrLinkIndexes.length > 0 || this.history.length > 0){
		var bNavigateBack = (this.history.length > arrLinkIndexes.length)? true : false;
		var intLinkIndex;
		if(bNavigateBack){
			intLinkIndex = this.history.last();
			var strElmToRemoveContentFromId = this.links[intLinkIndex][1];
			document.getElementById(strElmToRemoveContentFromId).innerHTML = this.links[intLinkIndex][2];
		}
		else{
			intLinkIndex = arrLinkIndexes.last();
			var oRegExp = new RegExp((intLinkIndex));
			var oLinkToGetContentFor = this.links[intLinkIndex][0];
			var strRetrievedContent = this.links[intLinkIndex][3];
			var bHasCachedContent = strRetrievedContent && strRetrievedContent.length > 0;
			if(bHasCachedContent){
				this.responseText = strRetrievedContent;
			}
			ask.getContent(oLinkToGetContentFor, bHasCachedContent);
		}
		this.history = arrLinkIndexes;
	}
}
// ---
function AskCreateXmlHttp(){
	if(typeof XMLHttpRequest != "undefined"){
		this.xmlHttp = new XMLHttpRequest();
	}
	else if(typeof window.ActiveXObject != "undefined"){
		try {
			this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
		}
		catch(e){
			try {
				this.xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
			}
			catch(e){
				try {
					this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					this.xmlHttp = null;
				}
			}
		}
	}
}
// ---
function AskClearXmlHttp(){
	this.responseText = "";
	if(this.xmlHttp){
		this.xmlHttp.onreadystatechange = function(){};
		if(typeof this.xmlHttp.abort == "function"){
			this.xmlHttp.abort();
		}
		this.xmlHttp = null;
		this.xmlHttpCallComplete = true;
	}
}
// ---
function AskCreateHistory(oLink){
	this.currentLinkIndex = oLink.getAttribute("rel").replace(/ask-/, "");
	if(this.history.toString().search(this.currentLinkIndex) == -1 || this.useSameTargetForSeveralCalls){
		this.history.push(this.currentLinkIndex);
		var strHistoryJoined = this.history.join(":");
		if(this.isIE && this.iframe){
			this.iframe.location.href = this.iframeFakeFile + "?loadedcontent=" + strHistoryJoined;
		}
		else{
			location.hash = strHistoryJoined;
		}
	}
}
// ---
function AskAddEvents(oContainerElm){
	var arrAllAJAXLinks = getElementsByClassName(oContainerElm, "a", "ask");
	for(var i=0; i<arrAllAJAXLinks.length; i++){
		oLink = arrAllAJAXLinks[i];
		oLink.setAttribute("rel", ("ask-" + this.intUniqueCounter++));
		arrAllAJAXLinks[i].onclick = ask.linkClickEvent;
		this.links.push([oLink, oLink.className.replace(/.*target-([\w\d\-]+)(\b.*|$)/i, "$1")]);
	}
}
// ---
function AskLinkClickEvent(oEvent){
	var oEvent = (typeof oEvent != "undefined")? oEvent : event;
	oEvent.returnValue = false;
	if(oEvent.preventDefault){
		oEvent.preventDefault();
	}
	if(ask.isIE50){
		ask.getContent(this);
	}
	else{
		ask.createHistory(this);
	}
}
// ---
function AskGetContent(oLink, bHasCachedContent){
	this.currentLink = oLink;
	var strURL = this.currentLink.getAttribute("href");	
	this.currentLinkURL = strURL + ((strURL.search(/\?/) != -1)? "&" : "?") + this.urlExt;
	this.elmToPresentIn = document.getElementById(this.currentLink.className.replace(/.*target-([\w\d\-]+)(\b.*|$)/i, "$1"));
	if(!bHasCachedContent){
		this.createXmlHttp();
		this.xmlHttpCallComplete = false;
		this.xmlHttp.onreadystatechange = function (){
			if(ask.xmlHttp && ask.xmlHttp.readyState == 4){				
				ask.presentContent();
			}
		}
		this.xmlHttp.open("GET", this.currentLinkURL, true);
		this.xmlHttp.send(null);
	}
	else{
		this.presentContent();
	}
}
// ---
function AskGetMultipleContent(){
	if(this.linksToGetContentFor.length > 0){
		if(this.xmlHttpCallComplete){
			var oLink = this.linksToGetContentFor.shift();
			this.createHistory(oLink);
			this.getContent(oLink);
		}
		setTimeout("ask.getMultipleContent()", 100);
	}
	else{
		this.locationInterval = setInterval("ask.timerLocationCheck()", 100);
	}
}

function AskPresentContent(){
	if(this.xmlHttp){
		this.responseText = this.xmlHttp.responseText;
	}
	if(!this.isIE50){
		this.links[this.currentLinkIndex][2] = this.elmToPresentIn.innerHTML;
		if(typeof this.links[this.currentLinkIndex][3] == "undefined"){
			this.links[this.currentLinkIndex][3] = this.responseText;
		}
	}
	this.elmToPresentIn.innerHTML = this.responseText;
	this.addEvents(this.elmToPresentIn);
	this.clearXmlHttp();
}
// ---
function addWindowEvent(strEvent, oFunction, bCapture){
	if(window.addEventListener){
		window.addEventListener(strEvent, oFunction, bCapture);
	}
	else if(window.attachEvent){
		window.attachEvent(("on" + strEvent), oFunction)
	}
}
// ---
function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];		
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}
// ---
if(typeof Array.prototype.push != "function"){
	Array.prototype.push = ArrayPush;
	function ArrayPush(value){
		this[this.length] = value;
	}
}
Array.prototype.last = ArrayLast;
function ArrayLast(value){
	return this[this.length - 1];
}
// ---