// JavaScript Document

var xmlHttp;


function stateChanged() { 
	if (xmlHttp.readyState==4) { 
		document.getElementById("mr_adosucher").innerHTML=xmlHttp.responseText;
	}
	reloadAvatar();
}


function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		xmlHttp=new XMLHttpRequest();
  	}
	catch (e) {
		try {
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
  		catch (e) {
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
  	}
	return xmlHttp;
}


function bubble_change(id) {
	xmlHttp=GetXmlHttpObject();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET","incl_mrsucher/messages.inc.php?id=" + id,true);
	xmlHttp.send(null);
}


function bubble_search() {
	xmlHttp=GetXmlHttpObject();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET","incl_mrsucher/search.inc.php?query=" + document.getElementById('bubble_query').value,true);
	xmlHttp.send(null);
}

function bubble_ask() {
	xmlHttp=GetXmlHttpObject();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET","incl_mrsucher/faq.inc.php?query=" + document.getElementById('bubble_askquery').value,true);
	xmlHttp.send(null);
}

function bubble_viewresponse(id) {
	xmlHttp=GetXmlHttpObject();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET","incl_mrsucher/faq_response.inc.php?id=" + id,true);
	xmlHttp.send(null);
}

function reloadAvatar() {
    var now = new Date();
    if (document.images) {
        document.images.avatar.src = 'images/mrsucher.gif?' + now.getTime();
	}
}
