/*  --------------------------------------------
    CREATE AJAX OBJECT
    -------------------------------------------- */

function ajaxRequest(){
	var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; /* activeX versions to check for in IE */
 	if (window.ActiveXObject){ /* Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) */
  		for (var i=0; i<activexmodes.length; i++){
   			try{
    			return new ActiveXObject(activexmodes[i]);
   			} catch(e){
    			/* suppress error */
   			}
  		}
 	} else if (window.XMLHttpRequest) { /* if Mozilla, Safari etc */
  		return new XMLHttpRequest();
 	} else {
  		return false;
  	}
}

/* --------------------------------------------
   FUNCTIONS
   -------------------------------------------- */

function response_quote(idx) {
  	if (http.readyState == 4) {
  		if (http.status == 200) {
			var element = "form-show-add-comment-"+idx;
			/* document.getElementById(element).style.visibility = "hidden"; */
			/* document.getElementById(element).innerHTML = "test"; */
			document.getElementById(element).value = http.responseText;
		} else {
			/* error */ 
		}
  	} 
}

function req_quote(idx,typ) {
	if(idx !==""){
		var php_file = '/article/get_quote.php?idx=' + escape(idx) + '&typ=' + escape(typ);
		/* alert("PHP File: "+php_file); */
		http.open('get', php_file ,true);
		http.onreadystatechange = function() { response_quote(idx); };
		
		http.send(null);
	} else {
		/* document.getElementById("antwort").style.visibility = "hidden"; */
	}
}


/* --------------------------------------------
   RUN
   -------------------------------------------- */

/* We create the HTTP Object */
var http = ajaxRequest(); 
