offen = new Array();

function c_read(id) {

	clean_all();
    Knoten = "comment_"+id;
	document.getElementById(Knoten).style.display = "block";

}

function clean_all() {

	for (j = 0; j < offen.length; j++){
		temp = "com_"+offen[j];

		ChildTest		= document.getElementById(temp).hasChildNodes();
		Knoten			= document.getElementById(temp).firstChild;
		
        if (ChildTest == true ){
			document.getElementById(temp).removeChild(Knoten);
        } //end if

    } //end for


} //end function clean_all


function close_one(id) {

		com_id = "com_"+id;
		Knoten			= parent.document.getElementById(com_id).firstChild;		
		parent.document.getElementById(com_id).removeChild(Knoten);

} //end function

function resize_one(id) {
   
	com_id = "com_"+id;
	
	feld 				= parent.document.getElementById(com_id).firstChild;
	feld.setAttribute("height", "55");

} //end function resize


///////////////////////////////////////
//Like
///////////////////////////////////////

var gevotet; // globale Variable

function like(id) {
  if (http) {

	var url = "/dictionairle/like.php?id=" + id;
	http.open("GET", url, true);
	http.send(null);

	Knoten = "like"+id;
    if (gevotet!=1) likes = Number(document.getElementById(Knoten).innerHTML)+1;
    document.getElementById(Knoten).innerHTML = likes;
	
	gevotet = 1;

  }
}

///////////////////////////////////////
//Suche
///////////////////////////////////////

function sendQ(q) {
  if (http) {
	var url = "/dictionairle/suche_sayt.php?q=" + escape(q);
	http.open("GET", url, true);
	http.onreadystatechange = ersetzen;
	http.send(null);
  }
}

///////////////////////////////////////
// Neu
///////////////////////////////////////

function send_new(q) {
  if (http) {
	var url = "/dictionairle/neu_sayt.php?schwab=" + escape(q);
	http.open("GET", url, true);
	http.onreadystatechange = ersetzen_neu;
	http.send(null);
  }
}

function ersetzen_neu() {
	if (http.readyState == 1) {
	  document.getElementById("drunter").innerHTML =
		 "<img src=\"/images/ajax-loader.gif\">";
	}
	if (http.readyState == 4) {
	  document.getElementById("drunter").innerHTML =
		 http.responseText;
	}
}


///////////////////////////////////////
// mehr
///////////////////////////////////////

function mehr(anzahl_max) {
  if (http) {
	var url = "/dictionairle/schwaebisch.php?anzahl_max=" + anzahl_max;
	http.open("GET", url, true);
	http.onreadystatechange = ersetzen_mehr;
	http.send(null);
  }
  
 pageTracker._trackEvent('mehr', 'mehr', 'anzahl_max');

}

function ersetzen_mehr() {
	if (http.readyState == 1) {
	  document.getElementById("mehr").innerHTML =
		 "<img src=\"/images/ajax-loader.gif\">";
	}
	if (http.readyState == 4) {
	  document.getElementById("content").innerHTML =
		 http.responseText;
	}
}


///////////////////////////////////////
// Test
///////////////////////////////////////

function weiter(jetzt,richtig_ges,richtig,zufall) {
//	alert("jetzt: "+jetzt+" richtig: "+richtig);

  if (http) {
	var url = "/schwabisch-test/test.php?j=" + jetzt +"&r="+ richtig_ges +"&l="+ richtig +"&zf="+ zufall; //l = lezte Frage
	http.open("GET", url, true);
	http.onreadystatechange = ersetzen;
	http.send(null);
  }

 pageTracker._trackEvent('Schwabisch Test', 'jetzt', 'richtig');

}


///////////////////////////////////////
//Ersetzten des Inhalts
///////////////////////////////////////

function ersetzen() {
	if (http.readyState == 1) {
	  document.getElementById("content").innerHTML =
		 "<h2>Suche</h2><br/><img src=\"/images/ajax-loader.gif\">";
	}
	if (http.readyState == 4) {
	  document.getElementById("content").innerHTML =
		 http.responseText;
	}
}


///////////////////////////////////////
// HTTP - AJAX
////////////////////////////////////////
var isWorking = false;

function getHTTPObject() {
  var xmlhttp;

 /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

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

