function showAbout(version, edition) {
  alert("NOVUS " + edition + " Edition - version " + version + " - copyright 1999-2004 Laboremus Software Solutions AS")
}



function showAboutNew(form) {
  var strAbout;

  aboutWindow = open('','AboutWindow','dependent=yes,directories=no,hotkeys=no,height=300,width=300,location=no,menubar=no,personalbar=no,resizable=no,scrollbars=no,status=no,toolbar=no,resizable=no');

  aboutWindow.focus();
  aboutWindow.document.open('text/html','replace');

  strAbout = '<TITLE>Om novus</TITLE>\
	      <CENTER><FONT SIZE=-1>NOVUS\
	      <P>\
	      versjon <%= VERSION %> \
	      <P>&copy; 1999-2004 Laboremus Software Solutions AS \
	     ';

  aboutWindow.document.writeln(strAbout);
}


// This script goes and sets the value "Admin Test" for all text elements on a form
// and sets check boxes and radios to checked.
// if you have a 2 radios (yes + no0 with the same name, it will set them to "no"
//
// It is very useful if you have a lot of elements you need to test.
// enjoy! 
//
// instructions: Just put the script in the head tags, and copy the table somewhere under the body tag
//
// Copyright 2003 Dave Classick [dclassic@ucsc.edu]


function runAdmin(theForm){
  var els = theForm.elements; 
	for(i=0; i<els.length; i++){ 
		switch(els[i].type){
			case "select-one" :
				els[i].options[els[i].selectedIndex].value == ""
					els[i].selectedIndex = 1;
					break;
			case "text":
				els[i].value= "AdminTest";
				break;
			case "textarea":
				els[i].value= "AdminTest";
				break;

			case "checkbox":
				els[i].checked = true;
				break;
			case "radio":
				els[i].checked = true;
				break;
		}
	}
}




// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Forum
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------



// -----------------------------------------------------------------------------
// Search through source string and remove characters contained in 'exludeChars'
// -----------------------------------------------------------------------------
function filterExclude(source, excludeChars) {
 	var r = "";
	var s = source;
	var i, c;

	for (i = 0; i < s.length; i++) {
		c = s.charAt(i);
		if (excludeChars.indexOf(c) == -1) r += c;
	}
	return r;
}

// -----------------------------------------------------------------------------
// Check if input is empty or only contains blanks
// -----------------------------------------------------------------------------
function isBlank(el) {
	s = el.value;
	s = filterExclude(s, " ");
	return s.length <= 0;
}


// -----------------------------------------------------------------------------
// Check input fields of the message form
// -----------------------------------------------------------------------------
function checkMessageInputFields(form, language) {

        var alertMsg

	switch (language) {
	  case 1:
	    alertMsg = "You must complete the fields: \n";
	    break;
	  otherwise:
	    alertMsg = "Du må fylle ut feltene: \n";
	    break;
        }	 

	var valid = true;

	if (isBlank(form.msg_subject)) {
	     valid = false;
 	     alertMsg += "\n- " + form.msg_subject.title;
	}

	if (isBlank(form.msg_first_name)) {
	     valid = false;
 	     alertMsg += "\n- " + form.msg_first_name.title;
	}

	if (isBlank(form.msg_body)) {
	     valid = false;
 	     alertMsg += "\n- " + form.msg_body.title;
	}

	if (!valid) alert(alertMsg);

	return valid;
}
