//
// $Id: wohnnet.js,v 1.64 2010/01/26 13:19:47 ics Exp $
//
// $Log: wohnnet.js,v $
// Revision 1.64  2010/01/26 13:19:47  ics
// ph
//
// Revision 1.63  2010/01/26 13:09:37  ics
// ph
//
// Revision 1.62  2009/11/21 09:45:34  ics
// ph: fix in anfrageclose
//
// Revision 1.61  2009/11/10 10:26:28  ics
// *** empty log message ***
//
// Revision 1.60  2009/11/07 09:48:03  ics
// ph
//
// Revision 1.59  2009/11/06 13:29:40  ics
// WNN-50
//
// Revision 1.58  2009/11/03 13:08:45  ics
// WNN-50 ph
//
// Revision 1.57  2009/11/03 13:08:14  ics
// WNN-50 ph
//
// Revision 1.56  2009/10/24 08:28:20  ics
// fix f. IE8
//
// Revision 1.55  2009/10/24 08:09:25  ics
// ph fix f. oewa
//
//

function show_menschen() {
	if(document.getElementById("top_menschen")) {
	  var pr = document.getElementById("top_menschen").style.display="block"
	} 
}


function move_banner(id) {
 if(document.getElementById('ADbanner_'+id)) {
//   document.getElementById('ADbanner_'+id).innerHTML = document.getElementById('frombanner'+id).innerHTML; 
//   document.getElementById('frombanner'+id).innerHTML = ''; 
	document.getElementById('ADbanner_'+id).appendChild(document.getElementById('frombanner'+id)); 
 }

}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
	for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
   x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; 
  x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function IREDS_openBrWindow(theURL,winName,w,h) { //v2.0
  myw=window.open(theURL,winName,'width='+w+',height='+h);
  myw.focus();
}

function is_IE() {
	if(navigator.userAgent.indexOf("MSIE") > 0) {
		return 1==1; 
	} else {
		return 1==0; 
	}
}

function IREDS2_openBrWindow(theURL,winName,w,h) { //v2.0
  
myw=window.open(theURL,winName,'width='+w+',height='+h+',top=0,left=0,menubar=yes, toolbar=yes,status=yes,scrollbars=yes,resizable=yes');
  myw.focus();
}
var dest_url ; 
var dest_link; 
var dest_target = ''; 
var dest_login = ''; 

function showlayer(url,breite,hoehe,t,l) {
	if(url=='/www/ireds/P-81098.html') { //weiterempfehlen layer
		showlayer_05(url);
		return;
	}

  document.getElementById("FORACTION").src =  url;

  if(document.getElementById("xlayer")) {
	if(t > 0){ document.getElementById("xlayer").style.top = t}; 
	if(l > 0){ document.getElementById("xlayer").style.left = l; };
	if(breite > 0){ document.getElementById("FORACTION").style.width = breite+"px" ; }
        if(hoehe > 0) {document.getElementById("FORACTION").style.height = hoehe+"px";}
      document.getElementById("xlayer").style.visibility="visible";
//	alert(document.getElementById("FORACTION").tagName); 
	dest_url = url;       	
  }
}

//var von_oben = 0; 
//function getTop() {
//  von_oben = document.body.scrollTop;
//  alert(document.body.scrollTop);
//}
// setInterval("getTop()",5000);

function showlayer_05(url) {
  document.getElementById("FORACTION").src =  url;
  var ch=document.body.scrollHeight+25; 
  var cw=document.body.clientWidth;
  var sh=document.body.scrollTop ;
//  if(document.getElementById("xlayer")) {
//	alert("DA"); 
//	document.getElementById("FORACTION").style.width = "400px" ; 
//        document.getElementById("FORACTION").style.height = "400px";
//    document.getElementById('xlayer').style.left = '0px'; 
    // document.getElementById('xlayer').style.width=cw+'px';  
    // document.getElementById('xlayer').style.height=ch+'px';  
//    document.getElementById('xlayer').style.top='1px';  
//    if(! is_IE() ) {
//
//	// alert("D2");
//	document.getElementById('xlayer').style.backgroundImage = "url(/bilder/d80/grau_fuerlayer.png)"; 
//	//alert("D4"); 
//    }
//    document.getElementById('xlayer').style.filter = "Alpha(opacity:50, style=0); background-image=url(/bilder/d80/grau_fuerlayer.png)";  
//    document.getElementById("xlayer").innerHTML;
	 document.getElementById("xlayer").style.left = "225px";
    document.getElementById("xlayer").style.top = "662px";
    document.getElementById("xlayer").style.visibility="visible";
	 window.scrollTo(0, 120);
//    document.getElementById("xlayer").style.left = cw/2-150 + "px";
	
//    document.getElementById("xlayer").outerHTML; 
//  } 
}

function showlayer_05_iframe(url) {
	if (parent.document.getElementById("FORACTION")) {
		parent.document.getElementById("FORACTION").src = url;
		parent.document.getElementById("xlayer").style.left = "225px";
		parent.document.getElementById("xlayer").style.top = "662px";
		parent.document.getElementById("xlayer").style.visibility="visible";
		parent.window.scrollTo(0, 120);
	}
}

function layerlogin(url) {
	dest_link = null; 
	showlayer('page.php?P=24764',0,0); 
	dest_url = url;
	dest_link = null;
}

function checklayerlogin() {
         if(dest_login != 'OK') {
                dest_login = 'JS'; 
         	layerlogin('/www/ireds/P-1.html');
		return false; 
	 } else {
		return true; 
	 }

}


function ireds_getLeft(ireds_l) {
	if (ireds_l.offsetParent) return (ireds_l.offsetLeft + ireds_getLeft(ireds_l.offsetParent));
	else return (ireds_l.offsetLeft);
}

function ireds_getTop(ireds_l) {
	if (ireds_l.offsetParent) return (ireds_l.offsetTop + ireds_getTop(ireds_l.offsetParent));
	else return (ireds_l.offsetTop);
}

function hov(loc,cls) {
   if (loc.className)
      loc.className = cls;
}

function checkpopup(url) {
	if (window.opener && !window.opener.closed) {
			window.opener.location.href = url;
	} else {
		window.location.href = url; 
	}
	return false; 

}
/////////////////////////////////////////////////////////////////
 /**
  * Open a connection to the specified URL, which is
  * intended to respond with an XML message.
  * 
  * @param string method The connection method; either "GET" or "POST".
  * @param string url    The URL to connect to.
  * @param string toSend The data to send to the server; must be URL encoded.
  * @param function responseHandler The function handling server response.
  */
var req;

 function hideFeedback() {
   //  document.getElementById('feedback').style.display="none";
 }

 function xmlOpen(method, url, toSend, responseHandler)
 {
	  hideFeedback();
     if (window.XMLHttpRequest)
     {
         // browser has native support for XMLHttpRequest object
         req = new XMLHttpRequest();
			if (req.overrideMimeType) {
				req.overrideMimeType('text/xml');
         }
     }
     else if (window.ActiveXObject)
     {
         // try XMLHTTP ActiveX (Internet Explorer) version
         req = new ActiveXObject("Microsoft.XMLHTTP");
     }
     
     if(req)
     {
         req.onreadystatechange = responseHandler;
         req.open(method, url, true);
		 // wegen OPERA 8 auskommentiert!
			try {
	         req.setRequestHeader("content-type","application/x-www-form-urlencoded");
			}
			catch(e) {
			}
         req.send(toSend);
     }
     else
     {
         alert('Your browser does not seem to support XMLHttpRequest.');
     }
 } 

function ajax_back() {
     if (req.readyState == 4)
     {
         // Make sure the status is "OK"
         if (req.status == 200)
         {
             var ajax = req.responseXML.getElementsByTagName('ajax');

			 var html_teil = req.responseXML.getElementsByTagName('html');
			 var js_teil = req.responseXML.getElementsByTagName('js');

			for(i=0; i < html_teil.length; i++) {
				var node = html_teil.item(i); 
				var node_id = node.getAttribute('html_id'); 
				var append_node = node.getAttribute('append');
				if(document.getElementById(node_id)) {					
					if(append_node==1) {
						document.getElementById(node_id).innerHTML += node.firstChild.nodeValue
					}
					else {
						document.getElementById(node_id).innerHTML = node.firstChild.nodeValue
					}
				}
			}

			for(i=0; i < js_teil.length; i++) {
				var node = js_teil.item(i); 
				var node_id = node.getAttribute('call'); 
				//eval("document.X_"+node_id+" = 'sss' ;"); 
				jscode = node.firstChild.nodeValue.replace(/\n/g,';'); 
				jscode = jscode.replace(/\r/,';'); 
				jscode = jscode.replace(/"/g,'\\"'); 
				eval(node_id+" = new Function('"+jscode+"');"); 
				eval(node_id+"()");
			}
		 
		 }
         else
         {
             alert("There was a problem retrieving the XML data:\n" + req.statusText);
         }
     }
 } 

 function ajax_call(url){
		var Jetzt = new Date();

		if(url.indexOf("?")>0) {
		    url=url + "&t="+Jetzt.getTime();
		}
		else {
			url=url + "?t="+Jetzt.getTime();
		}
	   xmlOpen("GET", url, null, ajax_back);
 }

 function ajax_post(url,post_data) {
     post_data += '&_REFERER='+escape(this.location.href); 
     xmlOpen("POST",url,post_data,ajax_back);
 }

 function ajax_modul(n,e,p,add){
	var url ="/wn05iframe/a_modul.php?N="+escape(n)+"&E="+e+p+"&"+add; 
	 ajax_call(url); 
 }

 //////////////////////////////////////////////////////////////////////////////////


function ajax_form(obj) {
   if(obj) {
    if(obj.tagName == 'FORM') {
	var values = new Array();
	for (var i = 0; i < obj.elements.length; i++) {
   	   var elem = obj.elements[i];
	   if(elem.name != '') {
		var t = 'NOB'; 
		if(elem.type) { t = elem.type }; 
		if(elem.tagName == 'SELECT' ) { t = "select" }; 
		switch(t) {
			case "NOB": 
				break;
			case "radio": 
				if (elem.checked) {
				  values.push(elem.name+"="+encodeURI(elem.value));
				}
				break;
			case "checkbox":
				if (elem.checked) {
					 values.push(elem.name+"=on");
				} else {
					 values.push(elem.name+"=off");
				}
				break; 
			case "select":
				for(var ii = 0; ii < elem.options.length; ii++ ) {
					if(elem.options[ii].selected) {
						values.push(elem.name+"="+encodeURI(elem.options[ii].value)); 
					} 
				}
	
			break;
                        default:
				values.push(elem.name+"="+encodeURIComponent(elem.value));
			break;
		}
	    }
	}
	ajax_post(obj.action, values.join("&")) ;
    } else {
	alert("Use 'ajax_form' just in formtags "); 
    } 
   } 
 } 



 /////////////////////////////////////////////////////////////////////////////////

 function notesResponseHandler()
 {
     // Make sure the request is loaded (readyState = 4)
     if (req.readyState == 4)
     {
         // Make sure the status is "OK"
         if (req.status == 200)
         {
             var swappableSection = document.getElementById('notesSection');
             var notes = req.responseXML.getElementsByTagName('note');
             var str = '';
             for(i=0; i < notes.length; i++)
             {
                 var noteNode = notes.item(i);
                 if(noteNode != null && noteNode.hasChildNodes())
                 {
                     str += noteNode.getAttribute('name') + ': ';
                     str += noteNode.firstChild.nodeValue + '<br />';
                 }
             }
             swappableSection.innerHTML = str;
         }
         else
         {
             alert("There was a problem retrieving the XML data:\n" +
                     req.statusText);
         }
     }
 } 

/// für die Suchen und Gmaps

var gmap_ready = false; 

function showgmap(id) {
  if( gmap_ready) {
    if(document.getElementById("view_googlemaps")) { 
         if(view_googlemaps) { 
		 view_googlemaps.showInMap(id); 
	 }
    }
  }
}


 ////////////////////////////////////////////////////

/**
 * COMMON DHTML FUNCTIONS
 * These are handy functions I use all the time.
 *
 * By Seth Banks (webmaster at subimage dot com)
 * http://www.subimage.com/
 *
 * Up to date code can be found at http://www.subimage.com/dhtml/
 *
 * This code is free for you to use anywhere, just keep this comment block.
 */

/**
 * X-browser event handler attachment and detachment
 * TH: Switched first true to false per http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html
 *
 * @argument obj - the object to attach event to
 * @argument evType - name of the event - DONT ADD "on", pass only "mouseover", etc
 * @argument fn - function to call
 */
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, false);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 }
}
function removeEvent(obj, evType, fn, useCapture){
  if (obj.removeEventListener){
    obj.removeEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}

/**
 * Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
 *
 * Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
 *
 * Gets the full width/height because it's different for most browsers.
 */
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 

	return window.undefined; 
}
function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
}

/**
 * Gets the real scroll top
 */
function getScrollTop() {
	if (self.pageYOffset) // all except Explorer
	{
		return self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollTop;
	}
}
function getScrollLeft() {
	if (self.pageXOffset) // all except Explorer
	{
		return self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollLeft)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollLeft;
	}
}


/**
 * SUBMODAL v1.5
 * Used for displaying DHTML only popups instead of using buggy modal windows.
 *
 * By Seth Banks
 * http://www.subimage.com/
 *
 * Contributions by:
 * 	Eric Angel - tab index code
 * 	Scott - hiding/showing selects for IE users
 *	Todd Huss - inserting modal dynamically and anchor classes
 *
 * Up to date code can be found at http://www.subimage.com/dhtml/subModal
 * 
 *
 * This code is free for you to use anywhere, just keep this comment block.
 */

// Popup code
var gPopupMask = null;
var gPopupContainer = null;
var gPopFrame = null;
var gReturnFunc;
var gPopupIsShown = false;
var gDefaultPage = "/loading.html";
var gHideSelects = false;
var gReturnVal = null;

var gTabIndexes = new Array();
// Pre-defined list of tags we want to disable/enable tabbing into
var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");	

// If using Mozilla or Firefox, use Tab-key trap.
if (!document.all) {
	document.onkeypress = keyDownHandler;
}



/**
 * Initializes popup code on load.	
 */
function initPopUp() {
	// Add the HTML to the body
	theBody = document.getElementsByTagName('BODY')[0];
	popmask = document.createElement('div');
	popmask.id = 'popupMask';
	popcont = document.createElement('div');
	popcont.id = 'popupContainer';
	popcont.style.display='none'; 
	popcont.innerHTML = '' +
		'<div id="popupInner" >' +
			'<div id="popupTitleBar">' +
				'<div id="popupTitle"></div>' +
				'<div id="popupControls">' +
					'<img src="/bilder/d80/icon_close_hov.gif" onclick="hidePopWin(false);" id="popCloseBox" />' +
				'</div>' +
			'</div>' +
			'<iframe src="'+ gDefaultPage +'" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%"></iframe>' +
		'</div>';
	theBody.appendChild(popmask);
	theBody.appendChild(popcont);
	
	gPopupMask = document.getElementById("popupMask");
	gPopupContainer = document.getElementById("popupContainer");
	gPopFrame = document.getElementById("popupFrame");	
	
	// check to see if this is IE version 6 or lower. hide select boxes if so
	// maybe they'll fix this in version 7?
	var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
	if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
		gHideSelects = true;
	}
	
	// Add onclick handlers to 'a' elements of class submodal or submodal-width-height
	var elms = document.getElementsByTagName('a');
	for (i = 0; i < elms.length; i++) {
		if (elms[i].className.indexOf("submodal") == 0) { 
			// var onclick = 'function (){showPopWin(\''+elms[i].href+'\','+width+', '+height+', null);return false;};';
			// elms[i].onclick = eval(onclick);
			elms[i].onclick = function(){
				// default width and height
				var width = 400;
				var height = 200;
				// Parse out optional width and height from className
				params = this.className.split('-');
				if (params.length == 3) {
					width = parseInt(params[1]);
					height = parseInt(params[2]);
				}
				showPopWin(this.href,width,height,null); return false;
			}
		}
	}
}
addEvent(window, "load", initPopUp);

 /**
	* @argument width - int in pixels
	* @argument height - int in pixels
	* @argument url - url to display
	* @argument returnFunc - function to call when returning true from the window.
	* @argument showCloseBox - show the close box - default true
	*/

function showPopWin(url, width, height, returnFunc, showCloseBox,map) {
	// show or hide the window close widget
	if (showCloseBox == null || showCloseBox == true) {
		document.getElementById("popCloseBox").style.display = "block";
	} else {
		document.getElementById("popCloseBox").style.display = "none";
	}
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);


	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	
	setMaskSize();

	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	
	// set the url
	gPopFrame.src = url;
	
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	if(map != '') { 
		document.getElementById("popupTitle").innerHTML = map; 
	}
	window.setTimeout("setPopTitle();", 600);
}

//
var gi = 0;
function centerPopWin(width, height) {
	if (gPopupIsShown == true) {
		if (width == null || isNaN(width)) {
			width = gPopupContainer.offsetWidth;
		}
		if (height == null) {
			height = gPopupContainer.offsetHeight;
		}
		
		//var theBody = document.documentElement;
		var theBody = document.getElementsByTagName("BODY")[0];
		//theBody.style.overflow = "hidden";
		var scTop = parseInt(getScrollTop(),10);
		var scLeft = parseInt(theBody.scrollLeft,10);
	
		setMaskSize();
		
		//window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;
		
		var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
		
		var fullHeight = getViewportHeight();
		var fullWidth = getViewportWidth();
		
		gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px";
		gPopupContainer.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
		//alert(fullWidth + " " + width + " " + gPopupContainer.style.left);
	}
}
addEvent(window, "resize", centerPopWin);
addEvent(window, "scroll", centerPopWin);
window.onscroll = centerPopWin;


/**
 * Sets the size of the popup mask.
 *
 */
function setMaskSize() {
	var theBody = document.getElementsByTagName("BODY")[0];
			
	var fullHeight = getViewportHeight();
	var fullWidth = getViewportWidth();
	
	// Determine what's bigger, scrollHeight or fullHeight / width
	if (fullHeight > theBody.scrollHeight) {
		popHeight = fullHeight;
	} else {
		popHeight = theBody.scrollHeight;
	}
	
	if (fullWidth > theBody.scrollWidth) {
		popWidth = fullWidth;
	} else {
		popWidth = theBody.scrollWidth;
	}
	
	gPopupMask.style.height = popHeight + "px";
	gPopupMask.style.width = popWidth + "px";
}

/**
 * @argument callReturnFunc - bool - determines if we call the return function specified
 * @argument returnVal - anything - return value 
 */
function hidePopWin(callReturnFunc) {
	gPopupIsShown = false;
	var theBody = document.getElementsByTagName("BODY")[0];
	theBody.style.overflow = "";
	restoreTabIndexes();
	if (gPopupMask == null) {
		return;
	}
	gPopupMask.style.display = "none";
	gPopupContainer.style.display = "none";
	if (callReturnFunc == true && gReturnFunc != null) {
		// Set the return code to run in a timeout.
		// Was having issues using with an Ajax.Request();
		gReturnVal = window.frames["popupFrame"].returnVal;
		window.setTimeout('gReturnFunc(gReturnVal);', 1);
	}
	gPopFrame.src = gDefaultPage;
	// display all select boxes
	if (gHideSelects == true) {
		displaySelectBoxes();
	}
}

/**
 * Sets the popup title based on the title of the html document it contains.
 * Uses a timeout to keep checking until the title is valid.
 */
function setPopTitle() {
	return;
	if (window.frames["popupFrame"].document.title == null) {
		window.setTimeout("setPopTitle();", 10);
	} else {
		document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title;
	}
}

// Tab key trap. iff popup is shown and key was [TAB], suppress it.
// @argument e - event - keyboard event that caused this function to be called.
function keyDownHandler(e) {
    if (gPopupIsShown && e.keyCode == 9)  return false;
}

// For IE.  Go through predefined tags and disable tabbing into them.
function disableTabIndexes() {
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				gTabIndexes[i] = tagElements[k].tabIndex;
				tagElements[k].tabIndex="-1";
				i++;
			}
		}
	}
}

// For IE. Restore tab-indexes.
function restoreTabIndexes() {
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				tagElements[k].tabIndex = gTabIndexes[i];
				tagElements[k].tabEnabled = true;
				i++;
			}
		}
	}
}


/**
* Hides all drop down form select boxes on the screen so they do not appear above the mask layer.
* IE has a problem with wanted select form tags to always be the topmost z-index or layer
*
* Thanks for the code Scott!
*/
function hideSelectBoxes() {
	for(var i = 0; i < document.forms.length; i++) {
		for(var e = 0; e < document.forms[i].length; e++){
			if(document.forms[i].elements[e].tagName == "SELECT") {
				document.forms[i].elements[e].style.visibility="hidden";
			}
		}
	}
}

/**
* Makes all drop down form select boxes on the screen visible so they do not reappear after the dialog is closed.
* IE has a problem with wanted select form tags to always be the topmost z-index or layer
*/
function displaySelectBoxes() {
	for(var i = 0; i < document.forms.length; i++) {
		for(var e = 0; e < document.forms[i].length; e++){
			if(document.forms[i].elements[e].tagName == "SELECT") {
			document.forms[i].elements[e].style.visibility="visible";
			}
		}
	}
}

/************************************************************/

var eu_match = new Array(); 
var eu_match_page  = 0; 
function set_eu_firmen() {
	if(  eu_match_page  == 0)  {  eu_match_page = 106252; } 
	for(var i = 0 ; i < eu_match.length; i++) {
		if(document.getElementById('ELEMENT'+eu_match[i].E+'_'+eu_match[i].F)) {
			var e = document.getElementById('ELEMENT'+eu_match[i].E+'_'+eu_match[i].F); 
			var c = " <a href='page.php?P="+eu_match_page +"&FID="+eu_match[i].K+"'>"+eu_match[i].T+"</a> "; 
			var p = e.innerHTML.indexOf(eu_match[i].T ); 
			if(p > 0) {
				e.innerHTML = e.innerHTML.substr(0,p-1)+c+e.innerHTML.substr(p+eu_match[i].T.length); 
			}
		}
	}
}

/************************************************************/


function do_oewa() {
    try {	
	var OEWAd = (new Date()).getTime()
        var OEWA="http://wohnnet.oewabox.at/cgi-bin/ivw/CP/"+OEWANEU;
	var url = OEWA+"?r="+escape(document.referrer)+"&d="+OEWAd 
	var im = new Image; 
	im.src = url;
	var im2 = new Image;
	im2.src = '/wn05iframe/mrtg.php?r='+escape(document.referrer)+"&late=1&d="+(Math.random()*100000);
	var xx = 1;	 
    } catch (e) {}
}

/************************************************************
*** 3 Tab Reiter (Neu) - JS - sk@ics.at 
************************************************************/

function do_opacity(htmlid) {
  if(document.getElementById(htmlid)) {
   var c = 'content_' + htmlid.replace(/d/,''); 
   if(document.getElementById(c)) {
    if(document.getElementById(c).style.display == 'none') {
     var mdiv = document.getElementById(htmlid);
     
     if(mdiv.className.indexOf("wnn_suche_opacity") >= 0) {
           mdiv.className = mdiv.className.replace(/ wnn_suche_opacity/g,"");
     }
     else {
       mdiv.className = mdiv.className+" wnn_suche_opacity";  
     }
    }
   }  
  } 
} 

function wnn_suche_show_redakt(elid,which,countv) {
   for(i=0;i<=countv;i++) {
      if (i != which) {
		  if (document.getElementById("content_"+elid+"_"+i)) {
           document.getElementById("content_"+elid+"_"+i).style.display="block";
		  }
      }
   }
}

var anfrageshow = false;

function switch_wnns_tab(elid, active,countv) {
  for(var xy = 1 ; xy <= countv; xy++) {    
      if (xy != active) {
        document.getElementById("d"+elid+"_"+xy).className = "reiter_inactiv";
        document.getElementById("content_"+elid+"_"+xy).style.display="none";
      }
      else {
		  if (arguments[3] != undefined) {
				document.getElementById("d"+elid+"_"+xy).style.backgroundColor = arguments[3];	
		  }
        document.getElementById("d"+elid+"_"+xy).className = "reiter_activ";
        document.getElementById("content_"+elid+"_"+xy).style.display = "block";
		  if (anfrageshow > 0 && active == anfrageshow) {
				hide_anfragebox("show");
		  }
      }
   }
	if (arguments[4] != undefined) {
		if (arguments[5] == 1) {
			MeinNFenster = window.open(arguments[4], "Neuesfenster", "toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,scrollbars=yes");
			MeinNFenster.focus();
		}
		else {
			window.location.href = arguments[4];
		}
	}
}

function set_tab_inactiv(htmlid) {
	elem = document.getElementById(htmlid);
	elemf = findparent(elem);
	if (elemf) {
		linkname = elemf.id.replace(/content_/, "link_");
		divname = elemf.id.replace(/content_/, "d");
		if (document.getElementById(linkname)) {
			document.getElementById(linkname).style.color = "#9E9C9C";
			document.getElementById(linkname).href = "#";
			document.getElementById(linkname).onclick = function () {return false;};
			document.getElementById(divname).style.backgroundColor = "#FFFFFF";
			document.getElementById(divname).className = "reiter_inactiv";
		}
	}
}

function findparent(elem) {
	regex = "(content_)[0-9]+(_)[0-9]+";
	parid = elem.parentNode.id;
	if (!parid.match(regex)) return (findparent(elem.parentNode));
	else return (elem.parentNode);
}

var tabarray = new Object();

function set_tab_ajax(pid,oid,htmlid,elemid,argum) {
	elem = document.getElementById(htmlid);
	elemf = findparent(elem);
	scr_name = '';
	if (typeof(arguments[5]) != "undefined") {
		scr_name = arguments[5];
	}
	if (elemf) {
		linkname = elemf.id.replace(/content_/, "link_");
		linkf = document.getElementById(linkname);
		try {
			tabarray[htmlid] = linkf.onclick;
			linkf.onclick = function() { switch_ajax_tab(pid,oid,htmlid,elemid,argum,scr_name);return false; };
		} catch (e) {}

	}
}

function hide_anfragebox(wie) {
	if (document.getElementById("anfrage_box")) {
		if (wie == "hide") {
			document.getElementById("anfrage_box").style.display = "none";
		}
		else {
			document.getElementById("anfrage_box").style.display = "block";
		}
	}
}

function switch_ajax_tab(pid,oid,htmlid,elemid,argum,scr_name) {
	app_t = "";
	if (exectab_append != "") {
		app_t = exectab_append;
	}
	tmpfunc = tabarray[htmlid];
	tmpfunc();
	script = "get_ajax_content.php";
	if (scr_name != "") {
		script = scr_name;
	}
	try {
	 	loader_div.show(htmlid); 
	} catch(e) {}
	document.getElementById(htmlid).innerHTML = '<table border="0" width="100%" height="200"><tr><td align="center" valign="center"><img src="../bilder/d146/loading.gif"></td></tr></table>';
	if(typeof ajax_call2 == 'function') {
		ajax_call2("/wn05iframe/"+script+"?Page="+pid+"&div="+htmlid+"&OID="+oid+"&ELID="+elemid+"&"+argum+app_t);
	} else {
		ajax_call("/wn05iframe/"+script+"?Page="+pid+"&div="+htmlid+"&OID="+oid+"&ELID="+elemid+"&"+argum+app_t);	
	}
	return false;
}

function setFrameHeight(h,elid) {
	if (document.getElementById("tabr_frame"+elid)) {
		document.getElementById("tabr_frame"+elid).height = h+"px";
	}	
}
function iFrameResize(fenster) {
   var hoehe = fenster.contentWindow.document.body.scrollHeight;
	if (hoehe > 0) {
		fenster.height = hoehe;
	}
}

function iFrameResize2(fenster) {
	var hoehe = fenster.contentWindow.document.body.scrollHeight;
	fenster.style.height = hoehe;
	document.getElementById('drag-contentarea_id').style.height = hoehe;
}

var exectab_append = "";

function exec_tab_func(htmlid) {
	if (typeof(arguments[1]) != "undefined") {
		exectab_append = arguments[1];
	}
	else {
		exectab_append = "";	
	}
	if (document.getElementById(htmlid)) {
		funct = document.getElementById(htmlid).onclick;
		funct();
	}
}

function disable_loader(objid) {
	if (document.getElementById("loader_"+objid)) {	
		document.getElementById("loader_"+objid).style.display = "none";
	}
	iframe_loaded[objid] = true;
}

/**** anfrage box ***/
function close_layer_neu() {
       body1 = document.getElementsByTagName("body")[0];
       new Effect.Fade(document.getElementById("content_popup"),{ duration:1});
       new Effect.Fade(document.getElementById("opacity_div"),{ duration:1});
       window.setTimeout("body1.removeChild(document.getElementById('opacity_div'))",3000);
       window.setTimeout("body1.removeChild(document.getElementById('content_popup'))",3000);
}

function show_it(elemid) {
    if (document.getElementById(elemid)) {
        document.getElementById(elemid).style.display = "block";
    }
}

function hide_it(elemid) { 
	 if (document.getElementById(elemid)) {
        document.getElementById(elemid).style.display = "none";
    }
}

function form_serialize(htmlid) {
   form = document.getElementById(htmlid);
   prefix_name = "";
   if (typeof(arguments[1]) != "undefined") {
		prefix_name = arguments[1];
	}
   values = new Array();
   for (var i = 0; i < form.elements.length; i++) {
      elem = form.elements[i];
      switch(elem.type) {
          case "checkbox":
             if (elem.checked) {
                 values.push(prefix_name+elem.name+"=on");
             }
             else {
                 values.push(prefix_name+elem.name+"=off");
             }
          break;
			 case "radio":
				 if (elem.checked) {
					  values.push(prefix_name+elem.name+"="+escape(elem.value));
				 }
			 break;
          default:
                 values.push(prefix_name+elem.name+"="+escape(elem.value));
          break;
     }
   }
   return values.join("&");
}

function send_form_ajax(formid,script) {
          strd = form_serialize(formid);
          ajax_post("/wn05iframe/"+script,strd);
}


function checkval() {
       sel_form = document.getElementById("actionselect");
       sel_index = sel_form.selectedIndex;
       switch (sel_index) {
          case 1:
             set_val_anf('sel_eingabe','Telefonnummer');
          break;
          case 3:
          case 2:
             set_val_anf('sel_eingabe1','Email-Adresse');
          break;
       }
}

function set_val_anf(htmlid,text) {
     if (document.getElementById(htmlid).value == "") {
          document.getElementById(htmlid).value = text;
     }
}

function display_error(error,how) {
	  errorfield = "anfrage_error";
	  if (typeof(arguments[2]) != "undefined") {
		  errorfield += "_"+arguments[2];
	  }
     if (how == 0) {
        document.getElementById(errorfield).innerHTML = error;
     }
     else {
        document.getElementById(errorfield).innerHTML = "";
     }
}

function setborder(htmlid,how) {
     if (how == 0) {
          document.getElementById(htmlid).style.border='1px solid red';
     }
     else {
          document.getElementById(htmlid).style.border='1px solid #CCCCCC';
     }
}

function empty_field(htmlid) {
		 field = "notice";
		 if (typeof(arguments[1]) != "undefined") {
		    field += "_"+arguments[1];
		 }
       document.getElementById(htmlid).value = "";
       document.getElementById(field).style.display = "none";
}


var detail_iframe_height = "420px";
var detail_page = 111169;

function submit_anf_form(oid) {
       sel_form = document.getElementById("actionselect");
       sel_index = sel_form.selectedIndex;
       eingabeval = document.getElementById("sel_eingabe1").value;
       if (eingabeval == "Email-Adresse" || eingabeval == "Telefonnummer") {
          eingabeval = "";
       }
		 if (arguments[1] == 1) {
			sel_index = 4;
		 }
       switch (sel_index) {
          case 1:
             eingabeval = document.getElementById("sel_eingabe").value;
             document.getElementById("sel_eingabe").style.display = "block";
             document.getElementById("sel_eingabe1").style.display = "none";
				 dhtmlwindow.open('telanfrage','iframe','/www/ireds/P-'+detail_page+'.html?OID='+oid+'&IS=telanfrage&VAL='+eingabeval,'Tel. Anfrage','width=580px,height='+detail_iframe_height+',resize=1,scrolling=0,center=0,top=600,left=225,opacitiy=1','recal');
			break;
          case 2:
             document.getElementById("sel_eingabe1").style.display = "block";
             document.getElementById("sel_eingabe").style.display = "none";
             dhtmlwindow.open('anfragesend','iframe','/www/ireds/P-'+detail_page+'.html?OID='+oid+'&IS=anfrage&VAL='+eingabeval,'Anfrage senden','width=580px,height='+detail_iframe_height+',resize=1,scrolling=0,center=0,top=600,left=225,opacitiy=1','recal');
          break;
          case 3:
             document.getElementById("sel_eingabe1").style.display = "block";
             document.getElementById("sel_eingabe").style.display = "none";
             dhtmlwindow.open('mehrdetails','iframe','/www/ireds/P-'+detail_page+'.html?OID='+oid+'&IS=details&VAL='+eingabeval,'Mehr Details','width=580px,height='+detail_iframe_height+',resize=1,scrolling=0,center=0,top=600,left=225,opacitiy=1','recal');
			break;
			case 4:
				  dhtmlwindow.open('weiterempfh','iframe','/www/ireds/P-112430.html','Einem Freund senden','width=580px,height=240px,resize=1,scrolling=0,center=0,top=600,left=225,opacitiy=1','recal');
			break;
       }
}

function schnell_anf_open(page,w,h,mainpage) {
	document.getElementById("schnell_anf_load").style.display = "inline";
	werte = form_serialize("schnellanfrage","PRELOAD_");
	werte += "&WIDTH="+w;
   werte += "&HEIGHT="+h;
	werte += "&MAINPAGE="+mainpage;
	ajax_post("/wn05iframe/save_preloads.php",werte);	
}

function open_schnell_pop(page,w,h) {
	dhtmlwindow.open('anfragesend','iframe','/www/ireds/P-'+page+'.html','Anfrage senden','width='+w+'px,height='+h+'px,resize=1,scrolling=0,center=0,top=600,left=225,opacitiy=1','recal');
	document.getElementById("schnell_anf_load").style.display = "none";
}

function closeanfrage(){
       vararray = new Array('telanfrage','anfragesend','mehrdetails','weiterempfh');
       for (ab = 0; ab < vararray.length; ab++) {
          if (document.getElementById(vararray[ab])) {
				document.getElementById(vararray[ab]).style.display = "none"; 
          }
       }
       for (ab = 0; ab < vararray.length; ab++) {
          if (document.getElementById(vararray[ab])) {
				document.getElementById(vararray[ab]).hide();	
          }
       }
		 if (document.getElementById("gespDat") && document.getElementById("anfragGes")) {
			document.getElementById("gespDat").style.display = "none";
			document.getElementById("anfragGes").style.display = "block";
			window.setTimeout("anfr_reset()", 3000);
		 }
}


function anfr_reset() {
       document.getElementById("anfragGes").style.display = "none";
       document.getElementById("gespDat").style.display = "block";
}

var m_page = 0;

function set_merken_things(oid,how,text,what) {
	mappend = what;	
	if (what == "liste") {
		mappend = oid;
	}
	if (document.getElementById('merken_input'+mappend)) {
		if (how == 1) {
			document.getElementById('merken_input'+mappend).checked = true;
			document.getElementById('merken_link'+mappend).onclick = function() { merken_uncheck(oid);return false; };
			document.getElementById('merken_input'+mappend).onclick = function() { merken_uncheck(oid);return false; };
		}
		else {
			document.getElementById('merken_input'+mappend).checked = false;
			document.getElementById('merken_link'+mappend).onclick = function() { merken_check(oid);return false; };
			document.getElementById('merken_input'+mappend).onclick = function() { merken_check(oid);return false; };
		}
		document.getElementById('merken_link'+mappend).innerHTML = text;
	}
}


var mcheck_append = "";
var merkliste_appendf = "";

function merken_check(oid) {
	if (typeof(arguments[1]) != "undefined") {
		mcheck_append = arguments[1];	
	}
	add2merkliste(oid);
}

function merken_uncheck(oid) {
	if (typeof(arguments[1]) != "undefined") {
		mcheck_append = arguments[1];	
	}
	stml = "merken_link";
	if (mcheck_append != "") {
		 stml += oid;
	}
	document.getElementById(stml).innerHTML = '<img src="/bilder/d177/ajax-loader.gif" width="14" border="0">';
	ajax_call('/wn05iframe/o_merken.php?DO=UNCHECK&OID='+oid+'&P='+m_page+'&LISTE='+mcheck_append);
	hide_m_items(oid);
	unsetf_array(oid);
}

var pos_success = new Object();

function place_element(ziel,x,y,elem,how) {
	pos_success[elem] = 0;
	window.setTimeout("do_place_it('"+ziel+"',"+x+","+y+",'"+elem+"',"+how+")",1000);
}

//how=0: position absolute, how=1: append

function do_place_it(ziel,x,y,elem,how) {
	if (document.getElementById(ziel) && document.getElementById(elem)) {
		zobj = document.getElementById(ziel);
	   ntop = ireds_getTop(zobj)+y;
		nleft = ireds_getLeft(zobj)+x;
		if (ireds_getTop(zobj) == 0 && ireds_getLeft(zobj) == 0) {
			 window.setTimeout("do_place_it('"+ziel+"',"+x+","+y+",'"+elem+"',"+how+")",2000);
		}
		else {
			document.getElementById(elem).style.position = "absolute";
			document.getElementById(elem).style.top = ntop+"px";
			document.getElementById(elem).style.left = nleft+"px";
			if (how != 0) {
				zobj.appendChild(document.getElementById(elem));
			}
			pos_success[elem] = 1;
		}
	}
}

// PNGHack 1.0.1 (2008-06-18)
// Copyright (c) 2008 Yves Van Goethem and png-hack project contributors
// http://code.google.com/p/png-hack/
// Distributed under MIT X11 License
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
document.write('<!--[if lte IE 6]><style type="text/css">.hack-png{visibility:hidden}</style><![endif]-->');
var PNGHack = function(spacer) {
        var remoteUrl = 'http://pnghack.googlepages.com/spacer.gif';
        var hackMethod = function(obj, method, that) {
                // browser check
                if (that.checkIE && !navigator.userAgent.match(that.checkIE))
                        return;
                
                // settings
                if (!obj) obj = {};
                var d   = obj.scope || document;
                var elm = (!obj.elm && method != 2) ? d.all : d.getElementsByTagName(obj.elm);
                var src = obj.src || 'src';
                var ext = new RegExp((obj.ext) ? '\\w+.'+obj.ext.toUpperCase() : '\.PNG$');

                // hack core
                var hack = function(elm, source) {
                        var style = elm.style;
                        if (!elm.pngsrc)
                                that.elements.push(elm);
                        elm.pngsrc = elm.getAttribute(source);
		
			if(elm.pngsrc.indexOf('spacer.gif') > 0 ) return ; 			

                        style.width = elm.clientWidth;
                        style.height = elm.clientHeight;
                        style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+elm.pngsrc+"',sizingMethod='scale')";
                        
                        // using hosted spacer, set it up to rescue local spacer or cancel remotehost
                        if (that.remotehost == true)
                                spacer = remoteUrl;
                        else if (that.remotehost != false) {
                                var rescueSpacer = function() {
                                        elm.setAttribute(source, remoteUrl);
                                };
                                var setRescueSpacer = function() {
                                        if (elm.readyState == 'complete') {
                                                elm.detachEvent('onerror', rescueSpacer);
                                                elm.detachEvent('onreadystatechange', setRescueSpacer);
                                        }
                                };
                                elm.attachEvent('onerror', rescueSpacer);
                                elm.attachEvent('onreadystatechange', setRescueSpacer);
                        }
                        
                        // displaying element / removing hack-png class
                        elm.setAttribute(source, spacer || 'images/spacer.gif');
                        if (elm.className.match(/\bhack-png\b/))
                                var x = setTimeout(function(){elm.className = elm.className.replace(/hack-png/g,'');clearTimeout(x);},300);
                };
                
                // hack method
                if (method == 2) {
                        hack(obj.elm, src);
                        return;
                }
                

	
                // go and crush method
                for (var i = 0; i < elm.length; ++i) {
                        var isrc = elm[i].getAttribute(src) || '';
                        if (method == 0 && elm[i].className.match(/\bhack-png\b/)
                        || (method == 1 && isrc.toUpperCase().match(ext)))
                                hack(elm[i], src);
                }
        };
        return {
                hackClass : function(obj) {
                        hackMethod(obj, 0, this);
                },
                hackExtension : function(obj) {
                        hackMethod(obj, 1, this);
                },
                hackElement : function(obj) {
                        hackMethod(obj, 2, this);
                },
                elements : [],
                checkIE : 'MSIE 5\.5|MSIE 6',
                remotehost : null
        };
};


pnghck = new PNGHack("/bilder/spacer.gif");


//merkliste neu js, SK

function switch_navi(w) {
    document.getElementById(w).style.display = "block";
    document.getElementById('but_'+w).className = "navi_mtab_activ";
    if (w == 'mainNav') {
        document.getElementById('mywohnnet').style.display = "none";
        document.getElementById('but_mywohnnet').className = "navi_mtab_inactiv";
    }
    else {
        document.getElementById('mainNav').style.display = "none";
        document.getElementById('but_mainNav').className = "navi_mtab_inactiv";
    }
}

function fill_merk_left() {
	if (document.getElementById("mywohnnet") &&
		document.getElementById("mywohnnet").innerHTML == "") {
		app_ml = document.getElementById("merkl_left");
		document.getElementById("mywohnnet").appendChild(app_ml);
	}
}

var iframe_loaded = new Object();

function do_tip(obid,page) {
  if (document.getElementById('merkliste_'+obid)) {
      mdiv = document.getElementById('merkliste_'+obid);
		if (typeof(page) == "undefined") {
			page = 114989; 	
		}
      if (mdiv.innerHTML == "") {
          iframe_loaded[obid] = false;
          mtop = ireds_getTop(document.getElementById('top_'+obid));
          mdiv.style.top = mtop+"px";
          mdiv.innerHTML = '<div class="merkliste_background"><div id="loader_'+obid+'" class="merkliste_loading"><img class="merkliste_loadingimg" src="/bilder/d146/loading.gif"></div><iframe height="320" id="merkl_fr_'+obid+'" onmouseover="do_tip('+obid+','+page+')" onmouseout="hide_tip('+obid+')" class="merkliste_iframe" src="/www/page.php?P='+page+'&OID='+obid+'" scrolling="no" frameborder="0" onLoad="iFrameResize(this);" onChange="iFrameResize(this);"></iframe></div>';
          mdiv.style.display  = "block";
      }
      else {
          mdiv.style.display  = "block";
      }
  }
}

function hide_tip(obid) {
  if(iframe_loaded[obid] == false) {
       document.getElementById('merkliste_'+obid).innerHTML = '';
  }
  if (document.getElementById('merkliste_'+obid)) {
       do_it_finally(obid);
  }
}

function do_it_finally(obid) {
       document.getElementById('merkliste_'+obid).style.display = "none";
}

var in_merkliste = new Array;

function add2merkliste(objid) {
   if (document.getElementById('mywohnnet') && document.getElementById('mywohnnet').style.display=="none") {
        exec_tab_func('link_mywohnnet');
   }
   alr_found = jQuery.inArray(objid, in_merkliste);
   if (alr_found >= 0) {
       show_m_error("Dieses Objekt ist schon in Ihrer Merkliste");
   }
   else {
      if (in_merkliste.length < 30) {
				 if (document.getElementById("m_wholemerk"+merkliste_appendf).style.display == "none") {
					document.getElementById("m_wholemerk"+merkliste_appendf).style.display = "block";
				 }
				 stml = "merken_link";
				 if (mcheck_append != "") {
						stml += objid;
				 }
				 document.getElementById(stml).innerHTML = '<img src="/bilder/d177/ajax-loader.gif" width="14" border="0">';
             merkl = document.getElementById("merkliste_pos"+merkliste_appendf);
             mdiv = document.getElementById("item_left_c_"+objid);
             mdiv.style.display = "block";
             my = ireds_getTop(merkl);
             mx = ireds_getLeft(merkl);
             mdy = ireds_getTop(mdiv);
             mdx = ireds_getLeft(mdiv);
				 if (typeof(Prototype) == "undefined")	{
					$("#item_left_c_"+objid).css({"position":"absolute","left":mdx+"px","top":mdy+"px"});
				 }
				 else {
					jQuery("#item_left_c_"+objid).css({"position":"absolute","left":mdx+"px","top":mdy+"px"});
				 } 
				 mdiv2 = mdiv.cloneNode(true);
             mdiv2.id = "item_left_"+objid;
             mdiv.style.display = "none";
             mbody  = document.getElementsByTagName('BODY')[0];
             mbody.appendChild(mdiv2);
             mdiv2.style.display = "block";
				 if (typeof(Prototype) == "undefined") {
					$("#item_left_"+objid).animate({"left": mx+"px","top": my+"px"},500, "linear", function(){ appendtomerk(objid);} );
				 }
				 else {
					jQuery("#item_left_"+objid).animate({"left": mx+"px","top": my+"px"},500, "linear", function(){ appendtomerk(objid);} );
				 }
             in_merkliste.push(objid);
				 if (in_merkliste.length > 0) {
					document.getElementById("empty_merk"+merkliste_appendf).style.display = "none";
					document.getElementById("m_actiontable"+merkliste_appendf).style.display = "block";
				 }
       }
       else {
           show_m_error("Zuviele Objekte!");
       }
    }
}

function appendtomerk(objid) {
		 if (typeof(Prototype) == "undefined") {
			$("#item_left_"+objid).appendTo("#merkliste"+merkliste_appendf);
			$("#item_left_"+objid).css({"position":"static"});
		 }
		 else {
			jQuery("#item_left_"+objid).appendTo("#merkliste"+merkliste_appendf);
			jQuery("#item_left_"+objid).css({"position":"static"});
		 }
       ajax_call('/wn05iframe/o_merken.php?DO=CHECK&OID='+objid+'&LISTE='+mcheck_append);
}

function hide_m_items(objectid) {
       htmlids = new Array('item_','item_c_','item_left_');
       for (ab=0;ab < htmlids.length;ab++) {
          if (document.getElementById(htmlids[ab]+objectid)) {
             if (htmlids[ab] == "item_left_") {
					 if (typeof(arguments[1]) == "undefined") {
						document.getElementById("merkliste"+merkliste_appendf).removeChild(document.getElementById(htmlids[ab]+objectid));
					 }
					 else {
						document.getElementById("merkliste"+arguments[1]).removeChild(document.getElementById(htmlids[ab]+objectid));
					 }
             }
             else {
                document.getElementById(htmlids[ab]+objectid).style.display = "none";
             }
          }
       }
}

function show_hide_cont(htmlid) {
       if(document.getElementById(htmlid+"_content").style.display == 'none') {
          document.getElementById(htmlid+"_content").style.display='block';
          document.getElementById(htmlid).src = '/bilder/btn_up.gif';
       } else {
          document.getElementById(htmlid).src = '/bilder/btn_right.gif';
          document.getElementById(htmlid+"_content").style.display='none';
       }
}

function delete_item(objid) {
          var Check = confirm("Wollen Sie dieses Objekt aus Ihrer Merkliste entfernen?");
          if (Check) {
             ajax_call('/wn05iframe/o_merken.php?DO=UNCHECK&OID='+objid+'&P='+m_page+'&LISTE='+mcheck_append);
             unsetf_array(objid);
				 if (typeof(arguments[1]) == "undefined") {
					 hide_m_items(objid);
				 }
				 else {
					 hide_m_items(objid,arguments[1]);
				 }
          }
}

function unsetf_array(objid) {
       for (var ab = 0; ab < in_merkliste.length; ab++) {
          if (objid == in_merkliste[ab]) {
             in_merkliste.splice(ab,1);
          }
       }
		 if (in_merkliste.length == 0) {
                  document.getElementById("empty_merk"+merkliste_appendf).style.display = "block";
						document.getElementById("m_actiontable"+merkliste_appendf).style.display = "none";
						document.getElementById("m_wholemerk"+merkliste_appendf).style.display = "none";
       }
}

function collect_checkboxes(htmlid) {
       form = document.getElementById(htmlid);
       values = new Array();
       for (var i = 0; i < form.elements.length; i++) {
          elem = form.elements[i];
          switch(elem.type) {
              case "checkbox":
                 if (elem.checked) {
                     values.push(elem.value);
                 }
              break;
             }
         }
        return values.join(";");
}

function reset_m_frame() {
       mframe = document.getElementById('merkl_frame');
       if (mframe.src != "") {
          mframe.src = "";
          mframe.height = 0;
          document.getElementById('merkl_frm_div').style.display = "none";
			 if (typeof(arguments[0]) != "undefined") {  
				show_m_error(arguments[0],"pos");
			 }
       }
       if (arguments[0] == 'Anfrage erfolgreich gesendet.') {
          aktmarkiert = collect_checkboxes('merkliste_form');
          teile = aktmarkiert.split(";");
          for(ab=0;ab<teile.length;ab++) {
             if (document.getElementById("anfrage_ges_"+teile[ab])) {
                document.getElementById("anfrage_ges_"+teile[ab]).innerHTML = "<i>Anfrage gesendet:"+document.getElementById('AKTM_DAT').value+"</i>";
             }
          }
       }
}


var merkliste_anf = 115549;
var merkliste_pr = 115569;
var merkliste_rec = 115550;

function merkliste_action(dow){
       reset_m_frame();
       aktmarkiert = collect_checkboxes('merkliste_form');
       mframe = document.getElementById('merkl_frame');
       if (aktmarkiert != "") {
          switch (dow) {
             case "telliste":
					 dhtmlwindow.open('mdrucken','iframe','/www/ireds/P-'+merkliste_pr+'.html?OID='+aktmarkiert,'Drucken','width=620px,height=390px,resize=1,scrolling=0,center=0,top=300,left=225,selfresize=1,opacitiy=1','recal');
             break;
             case "delete":
                var Check = confirm("Wollen Sie diese Objekte aus Ihrer Merkliste entfernen?");
                if (Check) {
                   ajax_call("/wn05iframe/del_from_merkl.php?OID="+aktmarkiert);
                }
             break;
             case "anfrage":
                document.getElementById('merkl_frm_div').style.display = "block";
                mframe.src="/www/ireds/P-"+merkliste_anf+".html?IS=anfrage&OIDS="+aktmarkiert;
             break;
             case "rueckruf":
                document.getElementById('merkl_frm_div').style.display = "block";
                mframe.src="/www/ireds/P-"+merkliste_anf+".html?IS=telanfrage&OIDS="+aktmarkiert;
             break;
             case "recommend":
                document.getElementById('merkl_frm_div').style.display = "block";
                mframe.src="/www/ireds/P-"+merkliste_rec+".html?OIDS="+aktmarkiert;
             break;
          }
       }
       else {
          show_m_error("Keine Objekte markiert!");
       }
}

function chk_merkliste_action(htmlid,action) {
		if (document.getElementById("merkliste_error")) {
			merkliste_action(action);	
		}
		else {
			exec_tab_func(htmlid,'&DO='+action);
		}
}

function merkliste_drop(htmlid) {
       if (htmlid.value != "") {
				merkliste_action(htmlid.value);
       }
}

function slide_infos(objid) {
       it = document.getElementById('mehr_infos_'+objid);
       itl = document.getElementById('mehr_infos_link_'+objid);
       if (it.style.display == "none") {
          $("#mehr_infos_"+objid).slideDown("slow");
       }
       else {
          $("#mehr_infos_"+objid).slideUp();
       }
}

function show_m_error(text) {
		 mhtmlid = "merkliste_error";
		 if(typeof(arguments[2]) != "undefined") {
			mhtmlid += arguments[2];
		 }
       if (document.getElementById(mhtmlid)) {
			 if (arguments[1] == "pos") {
				text = '<span style="color:green;">'+text+'</span>';
			 }
          document.getElementById(mhtmlid).innerHTML = text;
          document.getElementById(mhtmlid).style.display = "block";
          window.setTimeout('document.getElementById("'+mhtmlid+'").style.display = "none"', 10000);
       }
}

function send_ml_ajax(objid,script) {
           strd = "&OID="+objid+"&IS_MERKL=1&notice_text="+document.getElementById('notice_text_'+objid).value;
           ajax_post("/wn05iframe/"+script,strd);
}

//merkliste neu , sk

//google call
function do_google() {
	pageTracker._trackPageview(); 
}


// suchagent neu, by SK
var suchag_req = 0;
function suchag_slide_ajax(suchid,page) {
   adiv = document.getElementById('suchagent_insert');
	if (suchag_req == 3) {
		show_m_error("Sie haben diese Suche schon gespeichert","neg","1");		
	}
	else {
		if (adiv.style.display == "none") {
			$("#suchagent_insert").slideDown("slow");
			if (suchag_req == 0) {
				 ajax_call("/wn05iframe/load_suchagent.php?suchid="+suchid+"&div=suchagent_insert&P="+page);
				 //suchag_req = 1;
			}
		}
		else {
			    $("#suchagent_insert").slideUp();
		}
	}
}

function send_suchagent() {
   astr = "TAGE="+document.getElementById('TAGE').value;
   astr += "&suchid="+document.getElementById('suchid').value;
   astr += "&DO_REMINDER="+document.getElementById('DO_REMINDER').checked;
   astr += "&PAGE_ID="+document.getElementById('page_id').value;
   ajax_post('/wn05iframe/save_suchagent.php',astr);
}
// suchagent neu, by SK

//////////////////////////////////////////////////////////
/// Roomle js + div 
//////////////////////////////////////////////////////////
var Roomle_url = ""; 
var Roomle2_div = ""; 
var Roomle_CallerO = "abc"; 

function load_js(j) {
	var exs = document.createElement("script");
	exs.src = j;
	exs.type="text/javascript";
	document.getElementsByTagName("head")[0].appendChild(exs);
}

var Roomle_urlx = 0;
function wait_f_Roomle2(url) {
	Roomle_urlx = Roomle_urlx + 1000; 
	try{
		Roomle2.init(url); 
	} catch(e) {
		window.setTimeout("wait_f_Roomle2('"+url+"')",500); 
		Roomle_urlx = Roomle_urlx +1; 
	}
} 
//////////////////////////////////////////////////////////


function dhtmlwindow_open(page,w,h,t,o) {
	// page, width, hieght, titel, "this.window" 
	dhtmlwindow.open('popup','iframe',page,'','width='+w+'px,height='+h+'px,resize=1,scrolling=0,center=0,top=400,left=225,opacitiy=1','recal');
	if(t) {
		dhtmlwindow.titel(t); 
	}
	if(o) {
		 top.Roomle_CallerO = o; 
	}
}

function window_reloader() {
	if(top.Roomle_CallerO != "abc") {
             if(top.Roomle_CallerO.location) {
			var Jetzt = new Date();
			var url = top.Roomle_CallerO.location.href; 
			if(url.indexOf("?")>0) {
			    url=url + "&t="+Jetzt.getTime();
			} else {
				url=url + "?t="+Jetzt.getTime();
			}

                       top.Roomle_CallerO.location = url ; 
             }
        }
}


