function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	} else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		} else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

BrowserDetect.init();
if (BrowserDetect.browser == "Explorer") {
  function myScrollbars() {
    var wh = getWindowHeight();
    var ww = getWindowWidth();
    if (ww < 980 || wh < 500) {
      document.getElementsByTagName("html")[0].style.overflow = "auto";
    } else {
      document.getElementsByTagName("html")[0].style.overflow = "hidden";
    }
  }
  //AddToInitArray(myScrollbars);
  //window.onresize = myScrollbars;
}

function immo_go(url, popup) {
  if (inCMS()) {
    parent.xcmsGoto(url);
  } else {
    if (/^http/.test(url)) {
        url = url;
    } else {
        url = "/"+url;
    }
    if (popup) {
      var w = window.open(url, "immo");
      w.focus();
    } else {
      location.href = url;
    }
  }
  if (window.event) event.cancelBubble = true;
}

AddToInitArray(function() {
  for (var i = 3; i < 5; i++) {
    var elem = document.getElementById("column"+i);
    if (elem.onclick) elem.style.cursor = "pointer";
  }
  for (var i = 1; i < 4; i++) {
    var elem = document.getElementById("tile"+i);
    elem.style.cursor = elem.onclick ? "pointer" : "default";
  }

});

function fixBreadcrumbs() {
  /// fix breadcrumbs...
  var b = document.getElementById("breadcrumbs");
  var a = b.getElementsByTagName("A");
  for (var i = 1; i < a.length; i++) {
    a[i].setAttribute("title", a[i].innerText);
    a[i].setAttribute("text", a[i].innerText);
  }
  while (b.offsetHeight > 20) {
    for (var i = 1; i < a.length; i++) {
      var t = a[i].getAttribute("text");
      t = t.substring(0, t.length-2);
      a[i].setAttribute("text", t);
      a[i].innerText = t+"...";
    }
  }
}
