var updateInProgress = false;
  var rootDivs         = null;
  var divIndex         = -1;
  var ajaxReq          = null;
  var ajaxDoc          = null;
  var ajaxDiv          = null;  
  var aForumForm       = null;
  var IE;

function newWindow(mypage,myname,w,h,scroll) {
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
	win = window.open(mypage,myname,settings);
}



function choosedate () {
 window.open('/g/kalender_eng.html?searchform.dateselected','','menubar=0,titlebar=0,width=268,height=236');
 document.searchform.Interval.options[document.searchform.Interval.options.length-1].selected = true;
}
function ResetDate () {
 if (document.searchform.Interval.selectedIndex != (document.searchform.Interval.options.length-1))
 {
  document.searchform.dateselected.value = "";
 }
}

function DoPrint () {
 var f = document.searchform;
 f.action = "events?category=print";
 f.submit();
}

function EatCookie() {
document.cookie="usernamepassword=;Path=/"
document.cookie="UserRegID=;Path=/"
document.location="?RegLogout=1"
}

function newRequest() {
    IE = (navigator.appName=="Microsoft Internet Explorer");
    if (IE)  {
      return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
      return new XMLHttpRequest();
    }
   } // newRequest()
   
function processAjax() {
    if ((ajaxReq.readyState == 4) && (ajaxReq.status == 200)) {
      ajaxDoc = ajaxReq.responseText;
        for (var i = 0; i < rootDivs.length; i++) {
      rootDivs[i].innerHTML=ajaxDoc;
        }  
    }
  } // processAjax()  

function processPollMini(aUrl) {
    if (divIndex < rootDivs.length) {
      try {
        var pollminiURL         = aUrl;
        ajaxReq                    = newRequest();
        ajaxReq.onreadystatechange = processAjax;
        ajaxReq.open("GET", pollminiURL, true);
        ajaxReq.send(null);
    } catch(e) {
      alert(e);  
    }  
    } else {
      updateInProgress = false;
    }  
  } // processPollMini()
  
/* update all pollmini tags*/ 
  function updatePollMini(pollURL) {
    if (!updateInProgress) {
      updateInProgress = true;
      rootDivs         = document.getElementsByName("pollMini");

    if (rootDivs.length == 0) {
        rootDivs = new Array;
        var divs = document.getElementsByTagName('div');
        for (var i = 0; i < divs.length; i++) {
          if (divs[i].name == "pollMini") {
            rootDivs.push(divs[i]);
          }   
        }  
      }          
      if (rootDivs.length > 0) {
        divIndex = 0;
        processPollMini(pollURL);
      } else {
        updateInProgress = false;
      }
    }  
  } // updatePollMini()  
  
function processAjaxPollResult() {
    if ((ajaxReq.readyState == 4) && (ajaxReq.status == 200)) {
      ajaxDoc           = ajaxReq.responseText;
      ajaxDiv.innerHTML = ajaxDoc;
    }
  } // processAjaxPollResult()
  
  
    function processPollMiniResult(aURL, aDivTag, parameters) {
    try {
      ajaxDiv = aDivTag;
      ajaxReq = newRequest();
      ajaxReq.onreadystatechange = processAjaxPollResult;
      ajaxReq.open("POST", aURL, true);
      ajaxReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      ajaxReq.setRequestHeader("Content-length", parameters.length);
      ajaxReq.setRequestHeader("Connection", "close");      
      ajaxReq.send(parameters);
    } catch(e) {
      alert(e);  
    }  
  }  // processPollMiniResult()

  function checkForm(aFormId, aDivTagId) {   
     formErrors      = true;
     aForm           = document.getElementById(aFormId);
   aDivTagToUpdate = document.getElementById(aDivTagId);
     for (i=aForm.q1.length-1; i > -1; i--){
       if (aForm.q1[i].checked) {
          formErrors = false;
          break;
       }
     } 
     if (formErrors) {
        alert("You must choose an answer");
     } else {
    var getstr = '';
    for (i=0; i<aForm.childNodes.length; i++) {
       if (aForm.childNodes[i].tagName == "INPUT") {
          if (aForm.childNodes[i].type == "text") {
             getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";
          }
          if (aForm.childNodes[i].type == "checkbox") {
             if (aForm.childNodes[i].checked) {
                getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";
             } else {
                getstr += aForm.childNodes[i].name + "=&";
             }
          }
          if (aForm.childNodes[i].type == "radio") {
             if (aForm.childNodes[i].checked) {
                getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";
             }
          }
       }   
       if (aForm.childNodes[i].tagName == "SELECT") {
          var sel = aForm.childNodes[i];
          getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
       }
       if (aForm.childNodes[i].type == "hidden") {
         getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";       
       }
    }
    processPollMiniResult(aForm.PostUrl.value, aDivTagToUpdate, getstr);
     }
  }
  
  
/* functions for SAXO user and forum registration */
function validUsername(AField) {
				if (!loginTools.checkAvailable("EMail", AField.value)) {
					alert("Username is unavailable!");
					setTimeout("document.getElementById(\"uname\").focus();", 1);
					setTimeout("document.getElementById(\"uname\").select();", 1);
					return false;
				}
			}

function validNickname(AField) {
				if (!loginTools.checkAvailable("ForumNickName", AField.value)) {
					alert("Nickname is unavailable!");
					setTimeout("document.getElementById(\"nick\").focus();", 1);
					setTimeout("document.getElementById(\"nick\").select();", 1);
					return false;
				}
			}
    