// Class names for interaction with CSS
	var hovertable 	= "hovertable"; // The class name to use when specifying tables with hover effect on rows
	var row1		= "row1";	// Alternating rows: uneven number
	var row2		= "row2";	// Alternating rows: even number
	var Alternate	= "Alternate";	// Class used to specify that the rows should alternate in colour
	var over		= "over";	// Hovertable: The class name assigned dynamically when the mouse hovers
	var noOver		= "noOver";	// do not assign dynamic mouse over to elements (and children) of this class)

// Variables used for the date-selection script. Do not use manually!
	var setFieldDate, initDate;

// Help element default settings

	var helpBackground 	= "yellow";
	var helpWidth		= 200;
	var helpBordercolor	= "green";

// debug mode. Set to true and call DebugMessage(msg) to show debug messages.
	var debug			= false;


// This function is used to create "hovertables" and alternate rows in tables.
function startList() {
	startDebug();
	AlternateRows();
	allTables = document.getElementsByTagName("table");
	for (k=0;k<allTables.length;k++) {
		navRoot = allTables[k];
		if (navRoot != null) {
			if (navRoot.className.match(hovertable) == null) { navRoot = null; }
		}
		if (navRoot != null) {
			for (i=0; i<navRoot.childNodes.length; i++) {
				level1node = navRoot.childNodes[i];
				for (j=0; j<level1node.childNodes.length; j++) {
					node = level1node.childNodes[j]
					if (node.nodeName == "TR") {
						element = node.childNodes[0];
						if (element != null) {
							if (element.nodeName == "TH") {
								element = null;
							}
						}
						if (element != null) {
							if (element.className != null) {
								if (element.className.indexOf(noOver) > 0) {
									element = null;
								}
							}
						}
						if (element != null) {
							node.onmouseover=function() {
								AddClassToAllChildElements(this, over, false);
								DebugMessage('onOvr, className: ' + this.className, ', r1: ' + this.row1);
							}
							node.onmouseout=function() {
								RemoveClassFromAllChildElements(this,over);
								DebugMessage('onOut, className: ' + this.className);
							}
						}
					}
				}
			}
		}
	}
}

function AlternateRows() {
	var allTRs = document.getElementsByTagName("tr");
	var str, strtemp;
	var index = 0;
	for(var i = 0; i < allTRs.length;i++){
		str = new String(allTRs[i].className);
		if ( str.match(Alternate)!= null) {
			if ((allTRs[i].style.display != "none!") && (allTRs[i].style.display!="none")) {
				if (++index % 2 == 0) {
					allTRs[i].className = allTRs[i].className.replace(" " + Alternate, "") + " " + row1;
					AddClassToAllChildElements(allTRs[i], row1, false);
				}else{
					allTRs[i].className = allTRs[i].className.replace(" " + Alternate, "") + " " + row2;
					AddClassToAllChildElements(allTRs[i],row2, false);
				}
			} else {
				allTRs[i].className =  allTRs[i].className.replace(" " + row1, "");
				allTRs[i].className =  allTRs[i].className.replace(" " + row2, "");
			}
		}
		str = null;
	}
}

// Adds only class if a class already exist - this behaviour is absolutely intended!
function AddClassToAllChildElements(parentElt, Eltclass, IncludeFormElements) {
	if ((parentElt != null)) {
		for (var chld=parentElt.firstChild;chld;chld=chld.nextSibling) {
			if (IncludeFormElements || ! IsFormElement(chld)) {
				if (chld.className != null && chld.className.indexOf('static') < 0) chld.className += " " + Eltclass;
				AddClassToAllChildElements(chld, Eltclass, IncludeFormElements);
			}
		}
	}
}

function RemoveClassFromAllChildElements(parentElt, Eltclass) {
	if ((parentElt != null)) {
		for (var chld=parentElt.firstChild;chld;chld=chld.nextSibling) {
			if (chld.className != null) {
				chld.className = chld.className.replace(" " + Eltclass,"");
				chld.className = chld.className.replace("" + Eltclass," ");
			}
			RemoveClassFromAllChildElements(chld, Eltclass);
		}
	}

}

function setFormFieldValue(formName, fieldName, fieldValue) {
	var formfield = getFormField(formName, fieldName);
	if (formfield != null) {
		var type = formfield.type.toLowerCase();
		if (type == "text" || type == "textarea" || type == "button" || type == "submit" || type == "hidden") {
			formfield.value = fieldValue;
		}
	}
}

// This function sets the selected value of a radio button to the value specified. It needs the name
// of the form as input  as well as the name of the radio button and the value.
function setRadioItem(formName, radioName, radioValue) {
	var radio = getFormField(formName, radioName);
	while (radio != null) {
		if (radio.type.toLowerCase() == "radio") {
			if (radio.value == radioValue) {
				radio.checked= true;
				radio = null;
				break;
			} else 	radio = getNextFormField(formName, radio);
		} else 	radio = null;
	}
}

function getRadioItem(formName, radioName) {
	var val = ""
	var radio = getFormField(formName, radioName);
	while (radio != null) {
		if (radio.type.toLowerCase() == "radio") {
			if (radio.checked == true) {
				val = radio.value;
				radio = null;
				break;
			} else 	radio = getNextFormField(formName, radio);
		} else 	radio = null;
	}
	return val;
}

// This function sets a checkbox according to the boolean expression "checked".
function setCheckBox(formName, checkName, checked) {
	var checkbox = getFormField(formName, checkName);
	if (checkbox != null) {
		if (checkbox.checked != null) checkbox.checked = checked;
	}
}

function getCheckBox(formName, checkName) {
	var checkbox = getFormField(formName, checkName);
	var checked = false;
	if (checkbox != null) {
		if (checkbox.checked != null) checked = checkbox.checked;
	}
	return checked;
}

// This function sets the value of a dropdown input field to the value specified. It needs the name
// of the form as input as well as the name of the dropdown and the value.
// Assumptions: None
// Side effects: If the value is found in the specified dropdown input field, the selected
//		 item is changed correspondingly.
function setSelect(formName,selectName,selectValue) {
	var select = getFormField(formName, selectName);
	if (select != null && select.options != null) {
		for (var j = 0; j < select.options.length; j++) {
			if (select.options[j].value == selectValue) {
				if (select.type.toLowerCase() == "select-one") {
					select.selectedIndex = j;
					break;
				}
			}
		}
	}
}

function setSelectText(formName,selectName,selectValue, selectText) {
	var select = getFormField(formName, selectName)
	if (select != null) {
		for (var j = 0; j < select.options.length; j++) {
			if (select.options[j].value == selectValue) {
				if (select.type.toLowerCase() == "select-one") {
					select.options[j].innerHTML = selectText;
					break;
				}
			}
		}
	}
}

// Adds an option to an existing Select in a form in the current document.
// If "selected" is true, the new option is selected.
function addSelectOption(formName, selectName, newText, newValue, selected) {

	var select = getFormField(formName, selectName);
	// get the element in the form
	if (select != null) {
		if (select.options == null) select = null;
	}
	if (select != null) {
		select.options[select.options.length] = new Option(newText, newValue);;
		select.options[select.options.length-1].selected = selected;
	}
}

// Clears all options from an existing Select in a form in the current document
function clearAllOptions(formName, selectName) {
	var select = getFormField(formName, selectName);
	// get the element in the form
	if (select != null) {
		for (var j = select.options.length-1; j >= 0;  j--) {
			select.options[j] = null;
		}
	}
}

// Denne funktion gør det muligt at lave javascript submit af forms OG samtidig
// trigge 'onSubmit' event'en.
function SubmitWithValidation(formName) {
	var form = document.forms[formName];
	if (form != null) {
		var target = form.target;
		if (target == null || target == "") target ="_";
		if (target.charAt(0) != "_") {
			// validate that the target exists - otherwise make the form target its own window
			if (ReturnFrame(form.target) == null) setTarget(form.name,'_self');
		}
		if (form.onsubmit != null) {
			if(form.onsubmit()) {
				form.submit();
			}
		} else {
			form.submit();
		}
	} else {
		alert("JavaScript error in SubmitWithValidation: Cannot find the specified form (" + formName + ")");
	}
}

// This function returns the input string in 'Title Case' or 'Proper Case'.
// Assumptions:
// Side effects: None
// NOTE:	Use the function WriteTitleCase to automatically write the result to the page
function TitleCase(InputString) {
	var Exceptions = new Array("II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX");

	var words = InputString.split(" ");
	var j;
	var conv;
	for(var i = 0; i< words.length; i++) {
		conv = (words[i].toUpperCase().valueOf() == words[i].valueOf()); // only convert if all is in uppercase
		j = 0;
		while ((j < Exceptions.length) && (conv == true)) { // Do not convert words from the exception list
			conv = (words[i].valueOf() != Exceptions[j].valueOf());
			j = j + 1;
		}
		if (conv) words[i]= words[i].charAt(0).toUpperCase() + words[i].substring(1).toLowerCase();
	}
	return words.join(" ");
	words = null;
}

// Wrapper function for "TitleCase".
// Assumptions:	 Same as "TitleCase".
// Side effects: Writes the result to the page.
function WriteTitleCase(InputString) {
	document.write(TitleCase(InputString));
}

// This function removes the specified class from a range of elements
// in the document.
// Assumption: 	The elements searched all have ID's with a specified prefix
//		and a consequtive number, beginning with 1.
//		Also, all child elements are searched
function ClearClasses(prefix, classToClear) {
	var index = 1;
	var finito = false;
	var node;
	var elementID;
	while (finito == false) {
		elementID = prefix + index++;
		node = getElt(elementID);
		finito = (node == null)
		if(finito == false) {
			RemoveClassFromAllChildElements(node, classToClear);
			if (node.className != null) {
				node.className = node.className.replace(" " + classToClear, "");
				node.className = node.className.replace("" + classToClear, " ");
			}
		}
	}
}

function ClearClass(elementID, classToClear) {
	var node;
	node = getElt(elementID);
	if(node != null) {
		for (var i=0; i < node.childNodes.length; i++) {
			if (node.childNodes[i].className != null) {
				node.childNodes[i].className = node.childNodes[i].className.replace(" " + classToClear, "");
			}
		}
		if (node.className != null) {
			node.className = node.className.replace(" " + classToClear, "");
		}
	}
}

// This function adds a class to the element with id=ID.
function AddClass(elementID, classToAdd) {
	var node = getElt(elementID);

	if (node != null) {
		if (node.className != null) {
			node.className+= " " + classToAdd;
		} else {
			node.className = " " + classToAdd;
		}
		for (var i=0; i < node.childNodes.length; i++) {
			if (node.childNodes[i].className != null) {
				node.childNodes[i].className+= " " + classToAdd;;
			} else {
				try {	node.childNodes[i].className = " " + classToAdd;}
				catch(err) {break; } // Ignore the error
			}
		}
	}
}

// This functions places the focus in the first input field on the page.
// The search continues until either no more forms are on the page, or until
// a button or an input field is found.
function placeFocus() {
	var found = false;
	for (var j = 0; j< document.forms.length; j++) {
		var field = document.forms[j];
		for (var i = 0; i < field.length; i++) {
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
				document.forms[j].elements[i].focus();
				found = true;
				break;
			}
		}
		if (found) break;
	}
}

// Do not use this function unless absolutely necessary! The implementation
// follows the old-school browser-hack approach to cross-functionality,
// and the function should be rewritten if it one day is used in prod!
function getDocumentWidth() {
	var docwidth = 0;
	//opera Netscape 6 Netscape 4x Mozilla
	if (window.innerWidth || window.innerHeight){
		docwidth = window.innerWidth;
		//docheight = window.innerHeight;
	}
	//IE Mozilla
	if (document.body.clientWidth || document.body.clientHeight){
		docwidth = document.body.clientWidth;
		//docheight = document.body.clientHeight;
	}
	return docwidth;
}

function toggleDisplay(elementtype, classname) {
	var tmp = document.getElementsByTagName(elementtype);
	for (var i=0;i<tmp.length;i++) {
 		if (tmp[i].className == classname) tmp[i].style.display = (tmp[i].style.display == 'none' || tmp[i].style.display == '') ? 'block' : 'none';
	}
}


// This function changes the class of the specified element to "selected" - used in menu.
// NOTE! Maybe it should be replaced with a more generic function?
function setSelected(elementID) {
	AddClass(elementID, "selected");
}

function Pad(post, inputValue, minLength, padString) {
	var tmp = inputValue.toString();
	if (inputValue.length < minLength) {
		if ((padString == null) || (padString.length == 0)) padString = ".";
		if (post) {
			while (tmp.length < minLength) { tmp+= padString;	}
		} else {
			while (tmp.length < minLength) { tmp = padString + tmp;	}
		}
	}
	return tmp;
}

function WritePrePad(inputValue,minLength, padString) {
	document.write(Pad(false,inputValue,minLength, padString));
}

function WritePostPad(inputValue,minLength, padString) {
	document.write(Pad(true,inputValue,minLength,padString));
}

function MaxLength(str,maxLen,post) {
	var strtemp = str;
	if (post == null) post = "";
	if (str.length > maxLen + post.length) {
		strtemp = str.substring(0,maxLen) + post;
	} else {
		strtemp = str;
	}
	return strtemp;
}

function WriteMaxLength(str,len,post) {
	document.write(MaxLength(str,len,post));
}

// ********************************************************************************* //
// *** MakeValidTime takes as input a form and a field, and ensures the time is  *** //
// *** valid in structure, i.e. in the form xx:xx:xx.                            *** //
// *** NOTE! Only the structure of the input is tested - not the actual values   *** //
// ********************************************************************************* //
function MakeValidTime(formName, fieldName) {
	var formfield = getFormField(formName, fieldName)
	if (formfield != null) {
		// first replace all separators with ':'
		var temp = formfield.value;
		temp = temp.split('-').join(':');
		temp = temp.split('.').join(':');
		temp = temp.split(',').join(':');
		// split the string into an array
		var temparray= temp.split(":")
		if(temparray.length == 1) {
			temparray[1] = "00";
		}
		if(temparray.length == 2) {
			temparray[2] = "00";
		}
		if(temparray.length == 3) {
			for(var j = 0; j < 3; j++) {
				if(temparray[j] == "") 	temparray[j] = "00";
				if(temparray[j].length == 1) temparray[j] = "0" + temparray[j];
				if(temparray[j].length >  2) temparray[j] = temparray[j].substring(0,2);
			}
			formfield.value = temparray.join(":");
		}
	}
}

function WriteTimeNoSec(time) {
	if (time == "00.00.00" || time == "00:00:00") time = "";
	if (FormatIsHhMmSsOrHhMm(time)) {
		document.write(time.substring(0,5));
	} else {
		document.write(time);
	}
}

function WriteDateNoYear(date) {
	if (FormatIsMmDdYyyy(date)) {
		document.write(date.substring(0,5));
	} else {
		document.write(date);
	}
}

function WriteYyyyMmDdNoYear(date) {
	if (FormatIsYyyyMmDd(date)) {
		document.write(date.substring(5,10));
	} else {
		document.write(date);
	}
}

function WriteDdMmYyyyToYyyyMmDd(date) {
	document.write(DdMmYyyyToYyyyMmDd(date));
}

function YyyyMmDdToDdMmYyyy(date) {
	if (FormatIsYyyyMmDd(date)) {
		var temp;
		temp = date.substring(8,10);
		temp += "-" + date.substring(5,7);
		temp += "-" + date.substring(0,4);
	} else {
		temp = date;
	}
	return temp;
}

function DdMmYyyyToYyyyMmDd(date) {
	if (FormatIsMmDdYyyy(date)) {
		var temp;
		temp =  date.substring(6,10);
		temp += "-" + date.substring(3,5);
		temp += "-" + date.substring(0,2);
	} else {
		temp = date;
	}
	return temp;
}

function FormatIsYyyyMmDd(date) {
	var success = (date.length == 10);
	var temp;
	if (success) {
		temp = date.split("-");
		success = (temp.length == 3);
	}
	if (success) {
		success = (temp[0].length == 4) && (temp[1].length == 2) && (temp[2].length == 2);
	}
	if (success) {
		success = (!isNaN(temp[0]) && !isNaN(temp[1]) && !isNaN(temp[2]));
	}
	return success;
}

function FormatIsMmDdYyyy(date) { // accept only the format mm-dd-yyyy
	var success = (date.length == 10);
	var temp;
	if (success) {
		temp = date.split("-");
		success = (temp.length == 3);
	}
	if (success) {
		success = (temp[0].length == 2) && (temp[1].length == 2) && (temp[2].length == 4);
	}
	if (success) {
		success = (!isNaN(temp[0]) && !isNaN(temp[1]) && !isNaN(temp[2]));
	}
	return success;
}

function FormatIsHhMmSsOrHhMm(time) { // accept only hh:mm:ss or hh:mm
	var success = true;
	var temp;
	if (success) {
		time = time.split(".").join(":");
		temp = time.split(":");
		success = (temp.length == 3) || (temp.length == 2);
		if (temp.length == 2) temp[2] = "00";
	}
	if (success) {
		success = (temp[0].length == 2) && (temp[1].length == 2) && (temp[2].length == 2);
	}
	if (success) {
		success = (!isNaN(temp[0]) && !isNaN(temp[1]) && !isNaN(temp[2]));
	}
	return success;
}

// This function sets the target of the specified form. //
function setTarget(formName, newTarget) {
	if (document.forms[formName] != null) {
		document.forms[formName].target = newTarget;
	} else {
		alert("JavaScript error in setTarget: Cannot find form (" + formName + ")");
	}
}

// ******************************************************************************************** //
// ***	This function is a workaround to the "Mixed content" warning when in SSL-mode,      *** //
// ***  see: http://support.microsoft.com/default.aspx?scid=kb;EN-US;269682                 *** //
// ******************************************************************************************** //
function onClickHandler(){
	var el=null;
	var flag=true;
	el = event.srcElement;
	// Do the While loop to find out if any of the parent elements
	// are an A HREF.
	// This is necessary because in Internet Explorer 4.x, you can
	// receive events of any element including the <B> tag.
	while (flag && el)
	{
		if (el.tagName == "A"){
			flag=false;
			if (el.protocol == "javascript:"){
				execScript(el.href, "javascript");
				// A window.event.returnValue=false is performed so that the
				// default action does not happen - which in case of an HREF
				// will be navigating to a link.
				window.event.returnValue = false;
			}
			if (el.protocol == "vbscript:")	{
				execScript(el.pathname, "vbscript");
				window.event.returnValue = false;
			}
		} else {
			el = el.parentElement;
		}
	}
}


function getFormField(formName, formField) {
	var form = document.forms[formName];
	var field = null;
	if (form != null) {
		for (var i = 0; i < form.length; i++) {
			if (form.elements[i].name == formField) {
				field = form.elements[i];
				break;
			}
		}
	}
	return field;
}

function getNextFormField(formName, thisField) {
	var form = document.forms[formName];
	var field = null;
	var index = 0;
	if (form != null) {
		for (var i = 0; i < form.length; i++) {
			if (form.elements[i] == thisField) {
				index = i;
				break;
			}
		}
		for (var i = index+1; i < form.length; i++) {
			if (form.elements[i].name == thisField.name) {
				field = form.elements[i];
				break;
			}
		}
	}
	return field;
}


// CER: Tilføj flere, der skal oversættes efter behov
function UnUrl(streng) {
	var str = streng.split('&quot;').join('"');
	return str;
}

function ReturnFrame(framename, CurrentFrame) {
	var result = null;
	if (CurrentFrame == null && (top.frames != null)) {
		CurrentFrame = top.frames[0];
	}
	if (CurrentFrame != null) {
		// child frames - go search them!
		if (CurrentFrame.name == framename) {
			return CurrentFrame; // The first frame with the specified name has been found!
		} else {
			// Search first all children, then any siblings
			if (CurrentFrame.frames != null) {
				for (var i = 0; i < CurrentFrame.frames.length; i++) {
					result = ReturnFrame(framename, CurrentFrame.frames[i]);
					if (result != null) {
						break;
					}
				}
				if (result == null) {
					// get the next sibling
					var framelist = CurrentFrame.parent;
					var index = -1;
					if (framelist != null) {
						if (framelist.frames != null) {
							for (var i = 0; i < framelist.frames.length; i++) {
								if (framelist.frames[i] == CurrentFrame) {
									if (framelist.frames[i+1] != null) index = i+1;
									break;
								}
							}
						}
					}
					if (index != -1) {
						result = ReturnFrame(framename, framelist.frames[index]);
					}
				}
			}

		}
	}
	return result;
}

function PrintThis() {
	if (window.print) {
		window.focus();
		window.print();
	} else {
		alert("Your browser does not support script based printing - use the built-in print functionality instead.");
	}
}

function disableFormField(formName, fieldName) {
	var formfield = getFormField(formName, fieldName);
	if (formfield != null) {
		formfield.disabled = true;
	}
}

function enableFormField(formName, fieldName) {
	var formfield = getFormField(formName, fieldName);
	if (formfield != null) {
		formfield.disabled = false;
	}
}

function UpperCaseFormField(formName, fieldName) {
	var formfield = getFormField(formName, fieldName);
	if (formfield != null) {
		formfield.value = formfield.value.toUpperCase();
	}
}

function getFormFieldValue(formName, fieldName) {
	var formfield = getFormField(formName, fieldName);
	if (formfield != null) {
		return formfield.value;
	} else {
		return "";
	}

}

function NumberOfConsonants(str) {
	str = str.toLowerCase();
	var count = 0;
	var consonants = "bcdfghjklmnpqrstvwxz"
	for (var i = 0; i <= str.length; i++) { //>
		if (consonants.indexOf(str.charAt(i)) > 0) count++;
	}
	return count;
}

function maxNumber() {
	var args = maxNumber.arguments;
	var noArgs = args.length;
	var max;
	if (args.length > 0)
		max = args[0]
	 else
	 	 max = "";
	for (var i = 0; i < args.length; i++ ) {
		if (!isNaN(args[i])) {
			if (max < args[i]) max = args[i];
		}
	}
	return max;
}


function AddHelpElement(elementID) {
	var helpElt = document.createElement('div');
	helpElt.id = elementID;
	helpElt.className = elementID;
	helpElt.style.position = "absolute";
	helpElt.style.display = "none";
	helpElt.style.border = "solid";
	helpElt.style.width = helpWidth;
	helpElt.style.backgroundColor = helpBackground;
	helpElt.style.zIndex = 2;
	helpElt.style.borderColor = helpBordercolor;
	helpElt.innerHTML = "";
	document.body.appendChild(helpElt);
}

function startDebug() {
	if (debug) {
	   	var test = document.createElement('div');
	   	var body = document.createElement('div');
		body.id = "content";
		body.className = "debug";
		test.id = 'debug';
		test.className = 'debug';
		test.style.position = "absolute";
		test.style.border = "solid";
		test.style.width = 400;
		test.style.backgroundColor = helpBackground;
		test.style.zIndex = 2;
		test.style.borderColor = helpBordercolor;
		body.innerHTML = document.body.innerHTML;
		test.innerHTML = "";

		document.body.innerHTML = "";
		document.body.appendChild(test);
		document.body.appendChild(body);
	}
}

function DebugMessage(msg) {
	if (debug)	setEltText(getElt('debug'), msg);
}

function IsFormElement(elt) {
	if (elt && elt.type) {
		return ( elt.type == 'text' || elt.type == 'button' || elt.type == 'radio' || elt.type == 'hidden' || elt.type == 'textarea' || elt.type.toString().charAt(0) == 's');
	} else {
		return false;
	}
}

function FormToString(formName) {
	var form = document.forms[formName];
	var field = null, strtemp = "";

	if (form != null) {
		strtemp += 'Name: ' + formName + "\n";
		if (form.target != null) strtemp += 'target: ' + form.target + "\n";
		if (form.onsubmit != null) strtemp += form.onsubmit + "\n";
		for (var i = 0; i < form.length; i++) {
			strtemp += form.elements[i].name + "= " + form.elements[i].value + "\n";
		}
	}
	return strtemp;
}

// Used together with the newSelectDate.htm file to select a date to a field
function DateScript(fieldid) {
	var datewin;
	setFieldDate = new Function("fieldval","getElt('" + fieldid + "').value = fieldval;");
	// assume the date is of the format dd/mm/yyyy or dd-mm-yyyy
	// If the date is illegal today is used instead
	var strtemp = getElt(fieldid).value;
	var inttemp;
	if (strtemp.length == 10) {
		try {
			initDate = new Date(strtemp.substring(6,10), eval(strtemp.substring(3,5)-1), strtemp.substring(0,2))
		}
		catch (err) {
			initDate = new Date();
		}
	} else {
		initDate = new Date();
	}
	datewin = window.open('/newSelectDate.htm','','scrollbars=no,menubar=no,height=300,width=250,resizable=no,toolbar=no,location=no,status=no');
}

function FormToString(formName) {
	var form = document.forms[formName];
	var field = null, strtemp = "";

	if (form != null) {
		strtemp += 'Name: ' + formName + "\n";
		if (form.target != null) strtemp += 'target: ' + form.target + "\n";
		if (form.onsubmit != null) strtemp += form.onsubmit + "\n";
		for (var i = 0; i < form.length; i++) {
			strtemp += form.elements[i].name + "= " + form.elements[i].value + "\n";
		}
	}
	return strtemp;
}