 var pmobject = null;
 var adress = null;
 var element = null;

 try 
		 {
    pmobject = new XMLHttpRequest();
   } 
		catch (versuchmicrosoft) 
		 {
    try 
				{
     pmobject = new ActiveXObject("Msxml2.XMLHTTP");
    } 
				catch (anderesmicrosoft) 
				{
    try 
				{
     pmobject = new ActiveXObject("Microsoft.XMLHTTP");
    } 
			catch (fehlschlag) 
			{
			   pmobject = null;
     }
    }
  }
	
	function display($message){
	 post = document.getElementById(element);
	 post.innerHTML = $message +"<br/>";
		}
	
	function display_clear(element){
	 post = document.getElementById(element);
		post.innerHTML =  "&nbsp;";
		}
	
	function handle_search(){
	 if(pmobject.readyState == 4){
		 if(pmobject.status == 200){ 
		 try{
			   display(pmobject.responseText);
					}
					catch(error_element){
				 
					alert(error_element.toString());
					//mist
					}
				}
			}
		}
	function suchen($obj){
	 element = $obj;
		 if(pmobject){
			 try
				{ 
				 if($obj == 'search_bar'){
					adress = "include/functions/pm_menu.php?pm=search_bar";
					}
					
					else if($obj == 'search_user') {
					var search_user_input = document.getElementById("nick_suche").value;
					adress = "include/functions/pm_menu.php?pm=search_user&msg_nick_suche=" + search_user_input;
					}
					else if($obj == 'insert_user') {
					var search_user_input = document.getElementById("nick_auswahl").value;
					adress = "include/functions/pm_menu.php?pm=insert_user&msg_nick_name=" + search_user_input;
					}
					else if($obj == 'search_all') {
					adress = "include/functions/pm_menu.php?pm=search_user&msg_nick_suche=";
					}
					else if($obj == 'check_user') {
					
					var search_user_input = document.getElementById("msg_rep").value;
					adress = "include/functions/pm_menu.php?pm=check_user&username=" + search_user_input;
					}
					pmobject.open("GET",adress, true);
					pmobject.onreadystatechange = handle_search;
					pmobject.send(null);
				}
				catch(e)
				{
					 alert("Fehler beim Abruf!");
				}
			}
		}
		
 function fill_in($value)
{
 	document.new_topic.msg_replicator.value=$value;
 display_clear('search_user');
 display_clear('search_bar');
 }

//Alte Java Funktionen, voher in der profile

function Goto(){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL}

function SmilieEinfuegen(Smilie)
{
	document.new_topic.text.value+=Smilie+" ";
	document.new_topic.text.focus();
	}
function SmilieEinfuegen(Smilie)
{
	document.new_topic.text.value+=Smilie+" ";
	document.new_topic.text.focus();
}
