

 function checkNewPn()
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxCheckNewPn.php', true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = checkNewPn_callback;	
	} else
	  {
		xhttp.onload = checkNewPn_callback;
	  }

	xhttp.send(null);
 }


 function checkNewPn_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('neuePnBox').innerHTML = neuerInhalt;

	window.setTimeout('checkNewPn()', 3000);
 }


 // ================================================================================================================================


 function getLandName(neuerOrt)
 {
	if( !xhttp )
	{
		return;
	}

	neuePlz = encodeURIComponent(neuerOrt);

	xhttp.open('GET', 'ajaxOrtLand.php?ort='+neuerOrt, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = getLandName_callback;	
	} else
	  {
		xhttp.onload = getLandName_callback;
	  }

	xhttp.send(null);
 }


 function getLandName_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('landName').innerHTML = neuerInhalt;
 }


 function setLandName()
 {
	if( document.getElementById('landName') )
	{
		var neuePlz = document.getElementById('orteSelect').options[document.getElementById('orteSelect').selectedIndex].value
		if( neuePlz != '' )
		{
			var Woerter = neuePlz.split("|");
			document.getElementById('s_plz').value = Woerter[0];
			getLandName(Woerter[1]);
		}
	}
 }


 function sucheOrt()
 {
	if( !xhttp )
	{
		return;
	}

	var plz = document.getElementById('s_plz').value;
	    plz = encodeURIComponent(plz);

	if( plz.length < 3 )
	{
		document.getElementById('ortAuswahl').innerHTML = 'Keine Orte gefunden';
		return;
	}

	if( document.getElementById('orteSelect') )
	{
		document.getElementById('orteSelect').disabled = true;
	}

	xhttp.open('GET', 'ajaxSucheOrt.php?plz='+plz, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = sucheOrt_callback;	
	} else
	  {
		xhttp.onload = sucheOrt_callback;
	  }

	xhttp.send(null);
 }


 function sucheOrt_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('ortAuswahl').innerHTML = neuerInhalt;
 }


 // ================================================================================================================================


 // Gruppen  in Freundeliste ändern

 var aktiveGruppe = 0;

 function changeGroup(id)
 {
	aktiveGruppe = id;
 }

 function ajax_changeGroup(gid, kid)
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxChangeGroup.php?gid='+gid+'&kid='+kid, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = ajax_changeGroup_callback;	
	} else
	  {
		xhttp.onload = ajax_changeGroup_callback;
	  }

	xhttp.send(null);
 }

 function ajax_changeGroup_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	if( neuerInhalt != "" )
	{
		var chName = 'konGrp'+aktiveGruppe;
		document.getElementById(chName).innerHTML = '<b>'+neuerInhalt+'</b>';

		msgBox_main(0, aktiveGruppe, 0, 0, '');

		aktiveGruppe = 0;
	}
 }


 // Mitglied in Profilseite und Besucherliste adden

 var v_aktiveGruppe = 0;

 function v_changeGroup(id)
 {
	v_aktiveGruppe = id;
 }

 function ajax_addVisitor(gid, kid)
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxAddVisitor.php?gid='+gid+'&kid='+kid, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = ajax_addVisitor_callback;	
	} else
	  {
		xhttp.onload = ajax_addVisitor_callback;
	  }

	xhttp.send(null);
 }

 function ajax_addVisitor_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	if( neuerInhalt != "" )
	{
		var chName = 'v_konGrp'+v_aktiveGruppe;
		document.getElementById(chName).innerHTML = '<b>'+neuerInhalt+'</b>';

		msgBox_main(0, v_aktiveGruppe, 0, 0, '');

		v_aktiveGruppe = 0;
	}
 }


 // ==============================================================================================


 // Zeilen verkleinern
 function hideLine(cellNumber, lineName, lineNumber, hinweisName, hinweisText, hinweisNumber)
 {
	for( c = 1; c <= cellNumber; c++ )
	{
		var temp = lineName+lineNumber+'_'+c;
		document.getElementById(temp).innerHTML = '-';
		document.getElementById(temp).style.height = 20;
	}

	var schreibe = lineName+lineNumber+'_'+hinweisNumber;
	document.getElementById(schreibe).innerHTML = hinweisName+' '+hinweisText;
 }


 // ==============================================================================================


 function ajax_deleteContact(kid)
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxDeleteContact.php?kid='+kid, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = ajax_deleteContact_callback;	
	} else
	  {
		xhttp.onload = ajax_deleteContact_callback;
	  }

	xhttp.send(null);
 }


 function ajax_deleteContact_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }
 }


 function deleteContact(cellNumber, lineName, lineNumber, kid, hinweisName, hinweisText, hinweisNumber)
 {
	var Checkdelete = confirm("Möchtest Du "+hinweisName+" wirklich löschen?");
	if( Checkdelete != false )
	{
		// Ajax löschen
		ajax_deleteContact(kid);

		hideLine(cellNumber, lineName, lineNumber, hinweisName, hinweisText, hinweisNumber);
	}
 }


 // ==============================================================================================


 function ajax_blockContact(kid)
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxBlockContact.php?kid='+kid, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = ajax_blockContact_callback;	
	} else
	  {
		xhttp.onload = ajax_blockContact_callback;
	  }

	xhttp.send(null);
 }


 function ajax_blockContact_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }
 }


 function blockContact(cellNumber, lineName, lineNumber, kid, hinweisName, hinweisText, hinweisNumber)
 {
	var Checkdelete = confirm("Möchtest Du "+hinweisName+" wirklich ignorieren?");
	if( Checkdelete != false )
	{
		// Ajax löschen
		ajax_blockContact(kid);

		hideLine(cellNumber, lineName, lineNumber, hinweisName, hinweisText, hinweisNumber);
	}
 }


 function blockContactProfil(id, hinweisName)
 {
	var Checkdelete = confirm("Möchtest Du "+hinweisName+" wirklich ignorieren?");
	if( Checkdelete != false )
	{
		self.location.href = 'index.php?site=mitglied&action=ignorieren&id='+id;
	}
 }


 // ==============================================================================================


 function ajax_deleteBlock(kid)
 {
	if( !xhttp )
	{
		return;
	}

	xhttp.open('GET', 'ajaxdeleteBlock.php?kid='+kid, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = ajax_deleteBlock_callback;	
	} else
	  {
		xhttp.onload = ajax_deleteBlock_callback;
	  }

	xhttp.send(null);
 }


 function ajax_deleteBlock_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }
 }

 var tempJumpProfil;

 function deleteBlock(cellNumber, lineName, lineNumber, kid, hinweisName, hinweisText, hinweisNumber)
 {
	var Checkdelete = confirm("Möchtest Du "+hinweisName+" wirklich löschen?");
	if( Checkdelete != false )
	{
		// Ajax löschen
		ajax_deleteBlock(kid);

		hideLine(cellNumber, lineName, lineNumber, hinweisName, hinweisText, hinweisNumber);

		// Zum Profil weiterleiten
		tempJumpProfil = kid;
		window.setTimeout('jumpToProfil()', 3000);
	}
 }


 function jumpToProfil()
 {
	self.location.href = 'index.php?site=mitglied&id='+tempJumpProfil;
 }


 // ==============================================================================================


 var oldValue;

 function ajax_an()
 {
	if( subObject = document.getElementById('searchBlock') )
	{
		subObject.style.visibility = "visible";
	}

	if( subObject = document.getElementById('suggestBlock') )
	{
		subObject.style.visibility = "visible";
	}
 }


 function ajax_aus()
 {
	if( subObject = document.getElementById('searchBlock') )
	{
		subObject.style.visibility = "hidden";
	}

	if( subObject = document.getElementById('suggestBlock') )
	{
		subObject.style.visibility = "hidden";
	}
 }


 // ==============================================================================================


 var oldSearch;


 function searchList()
 {
	if( !xhttp )
	{
		return;
	}

	var q = document.getElementById('suchwort').value;
	if( q == oldSearch )
	{
		return;
	}
	if( q.length < 3 )
	{
		ajax_aus();
		return;
	}

	oldSearch = q;

	q = encodeURIComponent(q);

	xhttp.open('GET', 'ajaxSearchList.php?q='+q, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = searchList_callback;	
	} else
	  {
		xhttp.onload = searchList_callback;
	  }

	xhttp.send(null);
 }


 function searchList_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('searchBlock').innerHTML = neuerInhalt;

	ajax_an();
 }


 // ==============================================================================================


 function updateList()
 {
	if( !xhttp )
	{
		return;
	}

	var q = document.mainForm.wort.value;
	if( q == oldValue )
	{
		return;
	}
	if( q.length < 2 )
	{
		ajax_aus();
		return;
	}

	oldValue = q;

	q = encodeURIComponent(q);

	xhttp.open('GET', 'ajaxPnAn.php?q='+q, true);

	if( isIEBr == 1 )
	{
		xhttp.onreadystatechange = updateList_callback;	
	} else
	  {
		xhttp.onload = updateList_callback;
	  }

	xhttp.send(null);
 }


 function updateList_callback()
 {
	if( xhttp.readyState != 4 || xhttp.status != 200 )
	{
		return;
	}

	if( xhttp.responseText )
	{
		var neuerInhalt = xhttp.responseText;
	} else
	  {
		var neuerInhalt = xhttp.responseText;
	  }

	document.getElementById('suggestBlock').innerHTML = neuerInhalt;

	ajax_an();
 }


 function setPnAn(id, vorname, nachname, bild)
 {
	ajax_aus();

	document.getElementById('pb').src                       = bild;
	document.getElementById('userid').value                 = id;
	document.getElementById('anBlockJa').innerHTML          = vorname+' '+nachname+'&nbsp;<a href="#" onclick="javascript:deletePnAn();"><img src="images/loeschen.gif" border="0"></a>';

	document.getElementById('anBlockNein').style.display    = 'none';
	document.getElementById('anBlockNein').style.visibility = 'hidden';

	document.getElementById('anBlockJa').style.display      = 'block';
	document.getElementById('anBlockJa').style.visibility   = 'visible';
 }


 function deletePnAn()
 {
	document.getElementById('pb').src                       = 'images/spacer.gif';
	document.getElementById('userid').value                 = 0;

	document.getElementById('anBlockJa').style.display      = 'none';
	document.getElementById('anBlockJa').style.visibility   = 'hidden';

	document.getElementById('anBlockNein').style.display    = 'block';
	document.getElementById('anBlockNein').style.visibility = 'visible';

	initAjax();
 }

