/* Scripts fuer frisbeeshop.de */

   // xmlHttpRequest Objektinstanz
   var xhttp;

   function init_ajaxconnection() {
   
     if (window.ActiveXObject){
         try{
            //Internet Explorer 6.x
             xhttp = new ActiveXObject("Msxml2.XMLHTTP");
         }catch(e){
             //IE 5.x
             try{
                 xhttp = new ActiveXObject("Microsoft.XMLHTTP");
             }catch(e){
                 xhttp = false;
             }
         }
     } else if(window.XMLHttpRequest) {
         // F?r Mozilla, Opera und Safari
         try{
             xhttp = new XMLHttpRequest();
         }catch(e){
             xhttp = false;
         }
     }
  }
  
  function setCallbackFunction(callbackfunction) {
  	if (callbackfunction == 'parseXML_function') {
       xhttp.onreadystatechange=parseXML_function;
  	} else if (callbackfunction == 'parseMyXML_function') {
       xhttp.onreadystatechange=parseMyXML_function;
  	} else {
       xhttp.onreadystatechange=insertHTML_function;
  	}
  }
  
  function request_ajaxconnection(method, url, params) {
  	request_ajaxconnection(method, url, params, '');
  }

  function request_ajaxconnection(method, url, params, callbackfunction) {
		processing_ajaxrequest("start");
    if(xhttp) {
    	if (method == 'POST') {
       xhttp.open("POST", url);
       setCallbackFunction(callbackfunction);
       xhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			 xhttp.send(params);
			} else if (method == 'GET') {
       xhttp.open('GET', url, true);
       setCallbackFunction(callbackfunction);
       xhttp.send('');
			} else if (method == 'HEAD') {
       xhttp.open("HEAD", "/");
       setCallbackFunction(callbackfunction);
       xhttp.send('');
			}
    } else {
			processing_ajaxrequest("error");
    }
	}
  
  function processing_ajaxrequest(action) {
		var p = MM_findObj("AJAXProcessing");
		var d = MM_findObj("ResponseData");
  	if (action == 'start') {
		 d.innerHTML = '';
		 p.innerHTML = '<br><br><br><img src="/images/loading.gif"> Loading...<br><br><br><br><br>';
		} else if (action == 'stop') {
		 p.innerHTML = '';
		} else if (action == 'error') {
			p.innerHTML = '<span class="errortxt">Not supported browser!</span>';
		}
	}
	
	function insertHTML_function() {
  	if (xhttp.readyState==4) {
			processing_ajaxrequest("stop");
	    var d = MM_findObj("ResponseData");
			d.innerHTML = xhttp.responseText;
    //} else { xhttp.abort();
    }
  }
	function parseXML_function() {
  	if (xhttp.readyState==4) {
			processing_ajaxrequest("stop");

			// ...
    }
  }
	