
function openCal( href ) {
  var height	= 480;
  var width	= 640;
  if ( screen ) {
	height	= ( screen.height >= 700 ) ? 700 : 480;
	width	= ( screen.width >= 700 ) ? 700 : 640;
  }
  cal = window.open( href, "cal", "width=" + width + ",height=" + height + ",resizable=yes,menubar=no,toolbar=no,locationbar=no,statusbar=no,scrollbars=yes");
  if ( screen ) {
	cal.moveTo( (screen.width - width) / 2, (screen.height - height - 30) / 2 );
  }
  cal.focus();
}

var currentPopUp = null;
function resizePopUp() {
	var border = 1;
	if ( currentPopUp && currentPopUp.isOpen ) {
		var width  = currentPopUp.document.getElementById("image").width;
  		var Height = currentPopUp.document.getElementById("image").height;  	  	
		width = width < 150 ? 150 : width;
		Height = Height < 150 ? 150 : Height;
  		currentPopUp.show( (screen.width - width - 2*border) / 2 , (screen.height - Height - 2*border) / 2.5, width+2*border, Height+2*border );	
	}
}
function openPic(wID,url) {
  if ( window.createPopup ) {
  	// PopUp available  	
  	var popup = window.createPopup();
  	var pbody = popup.document.body;
  	var border = 1;
  	pbody.innerHTML = "<img id='image' src='/WFV/images/wohnungen/"+wID+"/"+url+"' border='0' alt='' style='border:"+border+"px solid black'/>";
  	var width  = 564; 
  	var Height = 423;	  	
  	popup.show(  	(screen.width - width - 2*border) / 2, (screen.height - Height - 2*border) / 2.5, width+2*border, Height+2*border );
  	currentPopUp = popup;
  	setTimeout("resizePopUp()",  500);
  	setTimeout("resizePopUp()", 1000);
  	setTimeout("resizePopUp()", 1500);
  	setTimeout("resizePopUp()", 2000);
  	setTimeout("resizePopUp()", 4000);
  } else {
	pic = window.open( "/WFV/images/wohnungen/"+wID+"/"+url, "pic", "width=620,height=500,resizable=yes,menubar=no,toolbar=no,locationbar=no,statusbar=no,scrollbars=yes");
	if ( screen ) {
	pic.moveTo( (screen.width - 600) / 2, (screen.height - 400) / 2 );
	}
	pic.focus();
  }
  return false;
}
function toggleDIV (elementID) {
// den angeklickten DIV aufklappen
var n = document.getElementById(elementID);
n.style.display = n.style.display == "block" ? "none" : "block"; 
}
function openPicH(wID,url) {
  if ( window.createPopup ) {
  	// PopUp available  	
  	var popup = window.createPopup();
  	var pbody = popup.document.body;
  	var border = 1;
  	pbody.innerHTML = "<img id='image' src='/WFV/images/haeuser/"+wID+"/"+url+"' border='0' alt='' style='border:"+border+"px solid black'/>";
  	var width  = 400; 
  	var Height = 310;	  	
  	popup.show(  	(screen.width - width - 2*border) / 2, (screen.height - Height - 2*border) / 2.5, width+2*border, Height+2*border );
  	currentPopUp = popup;
  	setTimeout("resizePopUp()", 500);
  } else {
	pic = window.open( "/WFV/images/haeuser/"+wID+"/"+url, "pic", "width=500,height=400,resizable=yes,menubar=no,toolbar=no,locationbar=no,statusbar=no,scrollbars=yes");
	if ( screen ) {
	pic.moveTo( (screen.width - 600) / 2, (screen.height - 400) / 2 );
	}
	pic.focus();
  }
  return false;
}


function openDetail(hausID,itemID) {
  var height	= 480;
  var width	= 640;
  if ( screen ) {
	height	= screen.height-80;
  }
  detail = window.open( "detail.cgi?itemID=" + hausID + "&wID=" + itemID, "detail", "width=" + width + ",height=" + height + ",resizable=yes,menubar=no,toolbar=no,locationbar=no,statusbar=no,scrollbars=yes");
  if ( screen ) {
	detail.moveTo( (screen.width - width) / 2, 4);
  }
  detail.focus();
  return false;
}

function openDetail2(hausID,itemID) {
  var height	= 480;
  if ( screen ) {
	height	= ( screen.height >= 700 ) ? 700 : 480;
  }
  detail = window.open( "detail.cgi?itemID=" + hausID + "&wID=" + itemID, "detail", "width=640,height=" + height + ",resizable=yes,menubar=no,toolbar=no,locationbar=no,statusbar=no,scrollbars=yes");
  if ( screen ) {
	detail.moveTo( (screen.width - 640) / 2, (screen.height - height - 30) / 2 );
  }
  detail.focus();
  return false;
}
