var remote=null;
function rs(n,u,w,h,x) {
  remote=window.open(u,n,'width='+w+',height='+h+',toolbar=0,close=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');
  if (remote != null) {
    if (remote.opener == null ) {
      remote.opener = self;
    }
    remote.location.href=u;
  }
  if (x==1){
    return remote;
  }
}

function ch_bgcolor(obj, colorTo) {
	if(obj.style.backgroundColor != colorTo) {
		obj.style.backgroundColor = colorTo;
	}
}


function getObj(name)
{
  if (document.getElementById)
  {
      this.obj = document.getElementById(name);
  }
  else if (document.all)
  {
        this.obj = document.all[name];
  }
  else if (document.layers)
  {
       this.obj = document.layers[name];
  }
  return this.obj;
}

function moveMenu() {
    var user_agent = navigator.userAgent.toLowerCase();
    var its_ie = false;
    var its_ns = false;

    if (user_agent.indexOf("msie") != -1 ) { its_ie = true }
    else if (user_agent.indexOf("mozilla") != -1 ) { its_ns = true }

    if (its_ie) {
      document.getElementById("leftmenu").style.top = 230 + document.body.scrollTop;
    } else if (its_ns){
      document.getElementById("leftmenu").style.top = 230 + pageYOffset;
    }

    timerID=setTimeout('moveMenu()',300);
  }

function Confirm(text, url) {
		if(confirm(text)) {
			location.replace(url);
		}
}

var input;
function new_input(url, width, height) {
	var column, row;
	//lukker allerede åbne vinduer
	if(input) {
		input.close();
	}
	input = window.open(url,'opret_window','width='+width+',height='+height+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');

	column = (screen.availWidth - width) / 2;
	row = (screen.availHeight - height) / 2;

	input.moveTo(column, row);
}





layerHandler = {
  getRefs: function (id) {
    var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
    if (el) el.css = el.style? el.style: el;
    return el;
  },
  
  writeLayer: function (el, cntnt) {
    if (typeof el.innerHTML!="undefined") {
        el.innerHTML = cntnt;
    } else if (document.layers) {
  			el.document.write(cntnt);
  			el.document.close();
    }
  },
  
  shiftTo: function (el,x,y) {
    var px = (document.layers || window.opera)? 0: "px";
    if (x != null) el.css.left = x + px;
    if (y != null) el.css.top = y + px;
  },

  show: function (el) { el.css.visibility = "visible"; },
  hide: function (el) { el.css.visibility = "hidden"; }
}

var imageHandler = {
  imgs: [], path: "",
  preload: function() {
    for (var i=0; arguments[i]; i++) {
      var img = new Image(); img.src = this.path + arguments[i];
      this.imgs[this.imgs.length] = img;
    }
  }
}

// returns amount of vertical scroll
function getScrollY() {
	var sy = 0;
	if (document.documentElement && document.documentElement.scrollTop)
		sy = document.documentElement.scrollTop;
	else if (document.body && document.body.scrollTop) 
		sy = document.body.scrollTop; 
	else if (window.pageYOffset)
		sy = window.pageYOffset;
	else if (window.scrollY)
		sy = window.scrollY;
	return sy;
}

// returns amount of horizontal scroll
function getScrollX() {
	var sx = 0;
	if (document.documentElement && document.documentElement.scrollLeft)
		sx = document.documentElement.scrollLeft;
	else if (document.body && document.body.scrollLeft) 
		sx = document.body.scrollLeft; 
	else if (window.pageXOffset)
		sx = window.pageXOffset;
	else if (window.scrollX)
		sx = window.scrollX;
	return sx;
}

