var http_request = false;
function makeReq(url, parameters, which) {
   http_request = false;
   if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
      if (http_request.overrideMimeType) {
      	// set type accordingly to anticipated content type
         //http_request.overrideMimeType('text/xml');
         http_request.overrideMimeType('text/html');
      }
   } else if (window.ActiveXObject) { // IE
      try {
         http_request = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
         try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (e) {}
      }
   }
   if (!http_request) {
//      alert('Cannot create XMLHTTP instance');
      return false;
   }
   http_request.onreadystatechange = function() {alertContent(http_request,which);};
   http_request.open('GET', url + parameters, true);
   http_request.send(null);
}

function alertContent(http_request,which) {
   if (http_request.readyState == 4) {
      if (http_request.status == 200) {
        //alert(http_request.responseText);
        result = http_request.responseText;
		if (document.getElementById('servicebox_'+which)) {
            document.getElementById('servicebox_'+which).innerHTML = result;
        } else {
			div = document.createElement('div');
			div.id = 'servicebox_'+which;
			div.className = 'servicebox1';
			text = document.createTextNode(' ');
			div.appendChild(text);

			if (which == 'merken' && document.getElementById('servicebox_buchen')) {
				document.getElementById('service').insertBefore(div,document.getElementById('servicebox_buchen').nextSibling);
			} else {
				if (document.getElementById('astrosuchbox')) {
					document.getElementById('service').insertBefore(div,document.getElementById('suchmaske').nextSibling);				
				} else {				
					document.getElementById('service').insertBefore(div,document.getElementById('service').firstChild);
				}
			}

			document.getElementById('servicebox_'+which).innerHTML = result;
		}
		if (result == '') {
			document.getElementById('service').removeChild(document.getElementById('servicebox_'+which));
		}
      } else {
//         alert('There was a problem with the request.');
      }
   }
}

function clearcomment() {
    if(document.getElementById('kommentar').onfocus) {document.getElementById('kommentar').value='';};
}

function checkzahlungsmethode() {
    myform = document.forms['buchung'];	
    if (myform['agb'].checked==false) {alert('Bitte akzeptieren Sie unsere Allgemeinen Geschäftsbedingungen.'); return false;};
    if (myform['zahlungsmethode'].selectedIndex==0) { alert('Bitte wählen Sie ein Zahlungsmethode.'); return false;};
    return true;
}

