function ajax(){

	var ajaxRequest;  // The variable that makes Ajax possible!

	

	try{

		// Opera 8.0+, Firefox, Safari

		ajaxRequest = new XMLHttpRequest();

	} catch (e){

		// Internet Explorer Browsers

		try{

			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

		} catch (e) {

			try{

				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

			} catch (e){

				// Something went wrong

				alert("Your browser broke!");

				return false;

			}

		}

	}

	return ajaxRequest;

}



function enrollForEvent(event, user, name){

    var ajaxR;

    ajaxR = ajax();

    var addressDiv;

    eventinfo = document.getElementById("eventinfo_" + event);

    ajaxR.onreadystatechange = function(){

      if(ajaxR.readyState == 4){ //Making sure the ajax function is ready for action

        eventinfo.innerHTML = "- Du er tilmeldt <b>" + name + "</b>";

      }  

    }

    ajaxR.open("GET", "../core.php?module=event&cmd=enroll&id=" + event + "&uid=" + user, true);

    ajaxR.send(null);

}


function editEnrolledMember(cmd, uid, id) {

  var url = "core.php?module=event&cmd=" + cmd + "&uid=" + uid + "&id=" + id;

  var ajaxR;

  ajaxR = ajax();

    ajaxR.onreadystatechange = function(){

      if(ajaxR.readyState == 4){ //Making sure the ajax function is ready for action

        alert(ajaxR.responseText);
		tdid = "#" + uid + "_paid";
		if(cmd == 'confirm') {
			$(tdid).html("<img src='gfx/icons/accept22.png' class='icon' />");
		}

      }  

    }

  ajaxR.open("GET", url, true);

  ajaxR.send(null);

}

function editEnrolledNonMember(cmd, email, id) {
  var url = "core.php?module=event&cmd=" + cmd + "&email=" + email + "&id=" + id;
  var ajaxR;
  ajaxR = ajax();
    ajaxR.onreadystatechange = function(){
      if(ajaxR.readyState == 4){ //Making sure the ajax function is ready for action
        alert(ajaxR.responseText);
      }  
    }
  ajaxR.open("GET", url, true);
  ajaxR.send(null);
}



function deleteEvent(id) {

  var url = "core.php?module=deleteevent&id=" + id;

  var ajaxR;

  ajaxR = ajax();

    ajaxR.onreadystatechange = function(){

      if(ajaxR.readyState == 4){ //Making sure the ajax function is ready for action

        window.location.reload(true);

      }  

    }

  ajaxR.open("GET", url, true);

  ajaxR.send(null);

}



function deleteNews(id) {

  var url = "core.php?module=deletenews&id=" + id;

  var ajaxR;

  ajaxR = ajax();

    ajaxR.onreadystatechange = function(){

      if(ajaxR.readyState == 4){ //Making sure the ajax function is ready for action

        window.location.reload(true);

      }  

    }

  ajaxR.open("GET", url, true);

  ajaxR.send(null);

}



function deleteGuestBookRow(id) {

  var url = "core.php?module=deleteguestbookrow&id=" + id;

  var ajaxR;

  ajaxR = ajax();

    ajaxR.onreadystatechange = function(){

      if(ajaxR.readyState == 4){ //Making sure the ajax function is ready for action

        window.location.reload(true);

      }  

    }

  ajaxR.open("GET", url, true);

  ajaxR.send(null);

}



function printYearId(form, year) {

  var div = document.getElementById("yeardiv");

  var year = form.year.value;

  div.style.display = "inline";  

  div.innerHTML = year;

  var string = 'hep';

  request.open("GET", "mailhandler.php?string=" + string, true);

}



function mailPreviewPopup(url) {

	newwindow=window.open(url,'name','height=500,width=800');

	if (window.focus) {newwindow.focus()}

	return false;

}

