 //########################################################################## 
 //# salesystems/doit24 XMLHttpLib - Ajax-library                           #
 //# version: 1.0.1                                                         #
 //# last-updated: 2008-04-15                                               #
 //#                                                                        #
 //# this is a "loader" for the xmlhttp Component for IE6 and older         # 
  
 /*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) 
 function XMLHttpRequest() { return new ActiveXObject('Microsoft.XMLHTTP') } 
 @end @*/ 
 //########################################################################### 
  
  
function getData(the_url, the_div) {
	div_obj = document.getElementById(the_div);
	//div_obj.innerHTML = '<b>es wird geladen...</b>';
	
	GE('DocumentBody').style.cursor = 'wait';
	
	var xmlHttp = new XMLHttpRequest(); 
	//xmlHttp.setRequestHeader('Content-Type', 'text/html; charset=utf8');
	xmlHttp.open('GET', the_url, true); 
	xmlHttp.onreadystatechange = function () { 
		if (xmlHttp.readyState==4) {
			rt = xmlHttp.responseText
			
			div_obj.innerHTML = rt; 
			
			//the_script = rt.substring((rt.indexOf("<script>")+8), rt.indexOf("</script>"));
			//try {eval(the_script);} catch(e) {}
			
			i = 0, bis = 0;
			while (rt.indexOf("<script", bis)>-1) {
				//### quit after max. 100 script-blocks to prevent endless-loop ###
				if (i>=100) break;
				
				von = rt.indexOf(">", rt.indexOf("<script", bis))+1;
				bis = rt.indexOf("</script>", von);
				the_script = rt.substring(von, bis);
				
				//alert(the_script);
				try {eval(the_script);} catch(e) {}
				
			i++;
			}
			
		}
    }; 
 
    xmlHttp.send(null); 
    

	GE('DocumentBody').style.cursor = '';
}  
 
 //### short command for getData() ###
function GD(url, div) {getData(url, div);}

  
function runData(the_url) { 
	var xmlHttp = new XMLHttpRequest(); 
	xmlHttp.open('GET', the_url, true); 
	xmlHttp.onreadystatechange = function () { 
		if (xmlHttp.readyState==4) eval(xmlHttp.responseText);
	}; 
	xmlHttp.send(null); 
}
 
 
function postData(the_url, the_div, values) {
 	 div_obj = document.getElementById(the_div);
	 div_obj.innerHTML = '<b>es wird geladen...</b>';
	 
 	 var xmlHttp = new XMLHttpRequest(); 
     xmlHttp.open('POST', the_url, true); 
     xmlHttp.onreadystatechange = function () { 
          if (xmlHttp.readyState==4) {
		  	rt = xmlHttp.responseText
			
		  	div_obj.innerHTML = rt; 
			
			//the_script = rt.substring((rt.indexOf("<script>")+8), rt.indexOf("</script>"));
			//try {eval(the_script);} catch(e) {}
			
			i = 0, bis = 0;
			while (rt.indexOf("<script", bis)>-1) {
				//### quit after max. 100 script-blocks to prevent endless-loop ###
				if (i>=100) break;
				
				von = rt.indexOf(">", rt.indexOf("<script", bis))+1;
				bis = rt.indexOf("</script>", von);
				the_script = rt.substring(von, bis);
				
				//alert(the_script);
				try {eval(the_script);} catch(e) {}
				
			i++;
			}
			
		  }
     }; 
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
     xmlHttp.send(values); 
}
 

function submForm(url) {
	values = "";
	
	sels = document.getElementsByTagName("select");
	for (i=0; i<sels.length; i++) {
		values += sels[i].name + "=" + sels[i].options[sels[i].selectedIndex].value + "&";
	}
	
	
	obs = document.getElementsByTagName("input");
	for (i=0; i<obs.length; i++) {
		if ((obs[i].type=='radio' || obs[i].type=='checkbox') && !obs[i].checked) continue;
		
		values += obs[i].name + "=" + obs[i].value + "&";
	}
	
	tas = document.getElementsByTagName("textarea");
	for (i=0; i<tas.length; i++) {
		values += tas[i].name + "=" + tas[i].value + "&";
	}
	
	values = encodeURI(values);
	postData(url, 'anzeige', values);
}