

function VerifyDelete() {
	return confirm('Slet ?');
}

function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
	var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	if ( iframeEl && iframeWin ) {
    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (docHt) iframeEl.style.height = docHt + 2 + "px";
  }
}

function ToggleDivSection(id) {
	 if (document.all) {
	   switch(document.getElementById(id).style.display) {
	       case 'none':
  		     current = 'block';
			 break;
	     default:
		   current = 'none';
		   break;
	   }
	  document.all[id].style.display = current;
		return;
	 }
	 
	 if (document.getElementById) {
	   switch(document.getElementById(id).style.display) {
	       case 'none':
  		     current = 'block';
			 break;
	     default:
		   current = 'none';
  	       break;
	   }
		 document.getElementById(id).style.display = current;
		 return;
	 }
	 alert ('Virker ikke i denne browser.');
}

function OnListBoxOver(object, cls) {
  if (object.className == cls+'_center_row') 
		object.className = cls+'_center_row_over';
}

function OnListBoxOut(object, cls) {
  if (object.className == cls+'_center_row_over') 
		object.className = cls+'_center_row';
}

function OnListBoxSelectedOver(object, cls) {
  if (object.className == cls+'_center_row_selected') 
		object.className = cls+'_center_row_selected_over';
}

function OnListBoxSelectedOut(object, cls) {
  if (object.className == cls+'_center_row_selected_over') 
		object.className = cls+'_center_row_selected';
}

function HintShow(id) {
  if (document.all) {
    if (document.all[id].style.visibility == 'hidden' || document.all[id].style.visibility == '') {
      document.all[id].style.left = event.clientX - 20; // (document.body.clientWidth/2) - (document.all[id].offsetWidth/2) + document.body.scrollLeft;
      document.all[id].style.top = event.clientY + document.body.scrollTop; //document.body.scrollTop + 10;
      document.all[id].style.visibility = 'visible';
    }
    return false;
  };
	
  if (document.getElementById) {
    if (document.getElementById(id).style.visibility == '' || document.getElementById(id).style.visibility == 'hidden') {
      document.getElementById(id).style.left = (window.innerWidth/2) - (document.getElementById(id).offsetWidth/2) + window.pageXOffset; //(document.body.clientWidth/2) - (document.all[id].offsetWidth/2) + document.body.scrollLeft;
      document.getElementById(id).style.top = window.pageYOffset + 10;
      document.getElementById(id).style.visibility = 'visible';
    }
    return false;
  }
}

function HintHide(id) {
  if (document.all) {
    document.all[id].style.visibility = 'hidden';
    return false;
  }
  if (document.getElementById) {
    document.getElementById(id).style.visibility = 'hidden';
    return false;
	}
}

function LanguageEdit(url) {
  win = window.open(url, "", "status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=480");
	win.focus();
	return true;
}

function OpenNewWindow(url) {
  var win = window.open(url);
	win.opener=window;
	win.focus();
	return true;
}

function IconSelect(form, field, dir) {
  var win = window.open('/system/icon_select.php?form='+form+'&field='+field+'&dir='+dir, "", "status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500");
	win.opener=window;
	win.focus();
	return true;
}

function FileSelect(form, field, dir) {
  var win = window.open('/system/file_select.php?form='+form+'&field='+field+'&dir='+dir, "", "status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500");
	win.opener=window;
	win.focus();
	return true;
}

function PopupWindow(url, param, name) {
  var win = window.open(url, name, param);
	win.opener=window;
/*
	var width = 0;
	var height = 0;
	while (!win.document.body) {};
	if (is_ie) {
    width = win.document.body.clientWidth; 
    height = win.document.body.clientHeight; 
	} else {	
    width = win.innerWidth; 
    height = win.innerHeight;
	}
	win.moveTo((screen.width/2)-(width/2), (screen.height/2)-(height/2));
	win.focus();
*/
	return true;
}

function CheckDomainSelect(form, name, isall) {
	if (isall) {
		for (i = 0; i < form.elements[name].length; i++)
			form.elements[name][i].checked = false;
		form.elements[name][0].checked = true;
	} else
		form.elements[name][0].checked = false;
}

function getAnchorPosition(anchorName) {
  if (document.layers) {
    var anchor = document.anchors[anchorName];
    return { x: anchor.x, y: anchor.y };
  }
  else if (document.getElementById) {
    var anchor = document.anchors[anchorName];
    var coords = {x: 0, y: 0 };
    while (anchor) {
      coords.x += anchor.offsetLeft;
      coords.y += anchor.offsetTop;
      anchor = anchor.offsetParent;
    }
    return coords;
  }
}
