function PopupService(url, width, height) {
	remote = window.open('', 'PopupService', 'width='+width+',height='+height+',resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
	if( remote != null) {
		if( remote.opener == null)
			remote.opener = self;
			remote.location.href = url
			remote.focus();
	}
}
function openwin(URL,NAME,W,H,T,L) { 
	window.open(URL,NAME,'width=' + W + ',height=' + H + ',top=' + T + ',left=' + L + ',toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,scrollbars=yes,resizable=yes');
}
function visgemt(id) {
			var tr = document.getElementById(id);
			var img = document.getElementById("img"+id);
			tr = tr.nextSibling;
			if ((tr.tagName != "TR") && (tr.nodeName == "#text") && tr.nextSibling && (tr.nextSibling.tagName == "TR") )
				tr = tr.nextSibling;
				
			while ( tr ) { 
				if ( tr.nextSibling ) {
					tr = tr.nextSibling;
					if ((tr.tagName != "TR") && (tr.nodeName == "#text") && tr.nextSibling && (tr.nextSibling.tagName == "TR") )
						tr = tr.nextSibling;

					if ( (tr.tagName == "TR") && (tr.className == "udvid") ) {
						if ( tr.style.display == "none" ) {
							tr.style.display = "";
							if (img && img.src) {
								img.src = "/images/minus.gif";
								img = null;
							}
						} else {
							tr.style.display = "none";
							if (img && img.src) {
								img.src = "/images/plus.gif";
								img = null;
							}
						}
					} else tr = null;
				} else tr = null;
			}
}
function checkData() {
	var f1 = document.forms[0];
	var wm = "<?PHP echo $strJSHello; ?>\n\r\n";
	var noerror = 1;

	// --- entered_login ---
	var t1 = f1.entered_login;
	if (t1.value == "" || t1.value == " ") {
		wm += "<?PHP echo $strLogin; ?>\r\n";
		noerror = 0;
	}

	// --- entered_password ---
	var t1 = f1.entered_password;
	if (t1.value == "" || t1.value == " ") {
		wm += "<?PHP echo $strPassword; ?>\r\n";
		noerror = 0;
	}

	// --- check if errors occurred ---
	if (noerror == 0) {
		alert(wm);
		return false;
	}
	else return true;
}

function browserName() {
  // IE
  if (navigator.appName == "Microsoft Internet Explorer")
    return 1;

  // Netscape
  if (navigator.appName == "Netscape")
    return 2;

  // Andre browsere
  return 0;
}

function ValidateLoginForm(formular){
	if(!formular.navn.value) {
		alert("Hey hey! Husk at angive dit brugernavn. Ellers kan du ikke logge ind!");
		formular.navn.focus();
		return false;
	}
	if(!formular.password.value) {
		alert("Hmmm. Du skal huske at indtaste dit password!");
		formular.password.focus();
		return false;
	}
	return true;
}

function selectAll(formObj, isInverse) 
{
   for (var i=0;i < formObj.length;i++) 
   {
      fldObj = formObj.elements[i];
      if (fldObj.type == 'checkbox')
      { 
         if(isInverse)
            fldObj.checked = (fldObj.checked) ? false : true;
         else fldObj.checked = true; 
       }
   }
}

function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
   }
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
   }
}
function showHidden(id) {
	var tr = document.getElementById(id);
	var img = document.getElementById("img"+id);
	if ( (tr.tagName == "TR") && (tr.className == "hiderow") ) {
		if ( tr.style.display == "none" ) {
			tr.style.display = "";
			if (img && img.src) {
				img.src = "/images/minus_one.gif";
				img = null;
			}
		} else {
			tr.style.display = "none";
			if (img && img.src) {
				img.src = "/images/plus_one.gif";
				img = null;
			}
		}
	} else tr = null;
}
function pressedKey()
{
   if(event.keyCode==13)
   {
      /*document.getElementById("same as your submit button's id").focus();*/
      document.getElementById("vaelg").focus();
   }
}
