function loadWebForm() {//Controls from cookie value, which topmenuitem is active	var cvalue = readCookie('activemenuitem');		if (cvalue != null){			//alert('Form onLoad '+cvalue);			setActive(cvalue);		}	var avalue = readCookie('maincolor');			if (avalue != null){			//alert('Form onLoad '+avalue);			setPageColour( avalue)			}}function setInactive(str) {	var li = 'menuitem' && str;        	document.getElementById(li).setAttribute('class','');}function setActive(str) {	var li = 'menuitem' + str;//	alert ('setActive '+li);	document.getElementById(li).setAttribute('class','active');	document.getElementById(li).className = 'active';}function setPageColour(str) {	document.getElementById('main').setAttribute('class',str+'-page');	document.getElementById('main').className = str+'-page';}function createCookie(name,value,days) {	if (days) {		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name) {	var nameEQ = name + "=";	var ca = document.cookie.split(';');	for(var i=0;i < ca.length;i++) {		var c = ca[i];		while (c.charAt(0) ==' ') c = c.substring(1,c.length);		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);	}	return null;}function eraseCookie(name) {	createCookie(name,"",-1);}function isActive(str, name) {	var cvalue = readCookie(name);	if (cvalue == str) {	return "active";}else{	return "";}}function popup (a) {	iwin = window.open(a, "iwin", "status=no, scrollbars=yes, toolbar=no, location=no,menu=no,width=425,height=425");}//==========================================================================================================//BELOW CODE IS FORMER JS HEADER ON SUBFORM SubTopHeader//==========================================================================================================function quick(str, dbPath) {	var newstr = str;	while (newstr != "" && newstr.charAt(0) == " ") newstr = newstr.substr(1);	while (newstr != "" && newstr.charAt(newstr.length - 1) == " ") newstr = newstr.substr(0, newstr.length - 1);	if (newstr == "") {		//window.alert("Du skal indtaste et navn i s\u00F8gefeltet");		return false;	} else {		createCookie('activemenuitem','1',1);		createCookie('maincolor','green',1);		var dbname = "/" +dbPath+ "/";		//***Old query before modifications		//***var query = "field campingplads contains " + newstr;				//***New query after modifications		var query = "field campingplads contains " + newstr + " or field by contains " + newstr + " or field stednavn contains " + newstr;		location = dbname + "vSearchData?SearchView&s=" + lang + "&Count=5000&SearchOrder=4&Query=" + escape(query);	};	// end if};	// end function function setInactive(str) {	var li = 'menuitem' && str;        	document.getElementById(li).setAttribute('class','');}function setActive(str) {	var li = 'menuitem' + str;//	alert ('setActive '+li);	document.getElementById(li).setAttribute('class','active');	document.getElementById(li).className = 'active';}function setPageColour(str) {	document.getElementById('main').setAttribute('class',str+'-page');	document.getElementById('main').className = str+'-page';}function createCookie(name,value,days) {	if (days) {		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name) {	var nameEQ = name + "=";	var ca = document.cookie.split(';');	for(var i=0;i < ca.length;i++) {		var c = ca[i];		while (c.charAt(0) ==' ') c = c.substring(1,c.length);		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);	}	return null;}function eraseCookie(name) {	createCookie(name,"",-1);}function isActive(str, name) {	var cvalue = readCookie(name);	if (cvalue == str) {	return "active";}else{	return "";}}function rightSearch(dbPath) {	var regStr = document.getElementById('Region1').value;	var stjStr = document.getElementById('Stjerner1').value;	var temStr = document.getElementById('Temaer1').value;		if (regStr == "x") {		var region = '';	} else if (regStr == "Sydsj\u00E6lland-Lolland-Falster-M\u00F8n") {		var region = "(field webregion=Sydsj\u00E6lland | field webregion=Lolland-Falster-M\u00F8n)";	} else {		var region = "field webregion=" + regStr;	};	// end if	if (stjStr == "x") {		var stjerner = '';	} else if (stjStr.length == 1) {		var stjerner = "field Klassificering=" + stjStr;	} else {		var stjerner = "field Klassificering>=" + String(stjStr).substring(0,1);	};	// end if		if (temStr == "x") {		var temaer = '';	} else if (temStr == "") {		var temaer = '';	} else {		var temaer = "field T_NUMBER1=" + temStr;	};	// end if		var arr=new Array();		arr[0]=region;		arr[1]=stjerner;		arr[2]=temaer;		arr = trim(arr);		createCookie('activemenuitem','1',1);		createCookie('maincolor','green',1);		var dbname = "/" +dbPath+ "/";		var query = arr.join("&");		location = dbname + "vSearchData?SearchView&s=" + lang + "&Count=5000&SearchMax=5000&SearchOrder=4&Query=" + escape(query);//alert (query);};	// end function function regionSearch(regStr, dbPath) {		if (regStr == "Sydsj\u00E6lland-Lolland-Falster-M\u00F8n") {		var region = "field webregion=Sydsj\u00E6lland | field webregion=Lolland-Falster-M\u00F8n";	} else {		var region = "field webregion=" + regStr;	};	// end if		createCookie('activemenuitem','1',1);		createCookie('maincolor','green',1);		var dbname = "/" +dbPath+ "/";		var query = region;		location = dbname + "vSearchData?SearchView&s=" + lang + "&Count=5000&SearchMax=5000&SearchOrder=4&Query=" + escape(query);};	// end function function trim(a){	var tmp=new Array();	for(j=0;j<a.length;j++)		if(a[j]!='')			tmp[tmp.length]=a[j];	a.length=tmp.length;	for(j=0;j<tmp.length;j++)		a[j]=tmp[j];	return a;}function Left(str, n){	if (n <= 0)	    return "";	else if (n > String(str).length)	    return str;	else	    return String(str).substring(0,n);}function Right(str, n){    if (n <= 0)       return "";    else if (n > String(str).length)       return str;    else {       var iLen = String(str).length;       return String(str).substring(iLen, iLen - n);    }}function doQuickSearch(e) {	var ENTER_KEY = 13;	var code = "";	var urlpart = String(location.pathname).split('.nsf/');	var dbname = String(urlpart[0]) + ".nsf";      		if (window.event) // IE		{    		code = e.keyCode;		}		else if (e.which) // Netscape/Firefox/Opera		{    		code = e.which;		}		if (code == ENTER_KEY) {    			//alert('location.pathname: ' + dbname);    			alert('this.Kvik.value: ' + String(this.Kvik.value));    			quick(this.Kvik.value, dbname); 			return false;		}}function getSelectedCheckbox(buttonGroup) {   // Go through all the check boxes. return an array of all the ones   // that are selected (their position numbers). if no boxes were checked,   // returned array will be empty (length will be zero)   var retArr = new Array();   var lastElement = 0;   if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)      for (var i=0; i<buttonGroup.length; i++) {         if (buttonGroup[i].checked) {            retArr.length = lastElement;            retArr[lastElement] = i;            lastElement++;         }      }   } else { // There is only one check box (it's not an array)      if (buttonGroup.checked) { // if the one check box is checked         retArr.length = lastElement;         retArr[lastElement] = 0; // return zero as the only array value      }   }   return retArr;} // Ends the "getSelectedCheckbox" functionfunction getSelectedCheckboxValue(buttonGroup) {   // return an array of values selected in the check box group. if no boxes   // were checked, returned array will be empty (length will be zero)   var retArr = new Array(); // set up empty array for the return values   var selectedItems = getSelectedCheckbox(buttonGroup);   if (selectedItems.length != 0) { // if there was something selected      retArr.length = selectedItems.length;      for (var i=0; i<selectedItems.length; i++) {         if (buttonGroup[selectedItems[i]]) { // Make sure it's an array            retArr[i] = buttonGroup[selectedItems[i]].value;         } else { // It's not an array (there's just one check box and it's selected)            retArr[i] = buttonGroup.value;// return that value         }      }   }   return retArr;} // Ends the "getSelectedCheckBoxValue" functionfunction getCampPics() {	var rplname="campresults";	var cmphits = document.getElementsByTagName("DIV");	var len = cmphits.length;	for (var i = 0; i < len; i++) {		if (cmphits[i].id == rplname) {              	//alert (cmphits[i].innerHTML);			cmphits[i].innerHTML = replaceSubstring(cmphits[i].innerHTML,'**dbReplResource**',dbRU);			//alert (cmphits[i].innerHTML);		}     }   }function replaceSubstring(inputString, fromString, toString) {   // Goes through the inputString and replaces every occurrence of fromString with toString   var temp = inputString;   if (fromString == "") {      return inputString;   }   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)      while (temp.indexOf(fromString) != -1) {         var toTheLeft = temp.substring(0, temp.indexOf(fromString));         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);         temp = toTheLeft + toString + toTheRight;      }   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop      var midStrings = new Array("~", "`", "_", "^", "#");      var midStringLen = 1;      var midString = "";      // Find a string that doesn't exist in the inputString to be used      // as an "inbetween" string      while (midString == "") {         for (var i=0; i < midStrings.length; i++) {            var tempMidString = "";            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }            if (fromString.indexOf(tempMidString) == -1) {               midString = tempMidString;               i = midStrings.length + 1;            }         }      } // Keep on going until we build an "inbetween" string that doesn't exist      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string      while (temp.indexOf(fromString) != -1) {         var toTheLeft = temp.substring(0, temp.indexOf(fromString));         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);         temp = toTheLeft + midString + toTheRight;      }      // Next, replace the "inbetween" string with the "toString"      while (temp.indexOf(midString) != -1) {         var toTheLeft = temp.substring(0, temp.indexOf(midString));         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);         temp = toTheLeft + toString + toTheRight;      }   } // Ends the check to see if the string being replaced is part of the replacement string or not   return temp; // Send the updated string back to the user} // Ends the "replaceSubstring" functionfunction getFieldValue(field){   switch(field.type)   {      case "text" :      case "textarea" :      case "password" :      case "hidden" :         return field.value;      case "select-one" :         var i = field.selectedIndex;         if (i == -1)   return "";         else   return (field.options[i].value == "") ? field.options[i].text : field.options[i].value;      case "select-multiple" :         var allChecked = new Array();         for(i = 0; i < field.options.length; i++)            if(field.options[i].selected)               allChecked[allChecked.length] = (field.options[i].value == "") ? field.options[i].text : field.options[i].value;         return allChecked;      case "button" :      case "reset" :      case "submit" :         return "";      case "radio" :      case "checkbox" :         if (field.checked) { return field.value; } else { return ""; }      default :         if(field[0].type == "radio")         {            for (i = 0; i < field.length; i++)               if (field[i].checked)                  return field[i].value;            return "";         }         else if(field[0].type == "checkbox")         {            var allChecked = new Array();            for(i = 0; i < field.length; i++)               if(field[i].checked)                  allChecked[allChecked.length] = field[i].value;            return allChecked;         }         else            var str = "";            for (x in field) { str += x + "\n"; }            alert("I couldn't figure out what type this field is...\n\n" + field.name + ": ???\n\n\n" + str + "\n\nlength = " + field.length);         break;   }      return "";}