var xmlHttp = null;
// Mozilla, Opera, Safari sowie Internet Explorer 7
if (typeof XMLHttpRequest != 'undefined') {
	try{
		xmlHttp = new XMLHttpRequest();
	}catch(e){
		xmlHttp=null;
	}
}
if (!xmlHttp) {
    // Internet Explorer 6 und älter
	if(window.ActiveXObject){
		try {
			xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				xmlHttp  = null;
				document.getElementById('NOTE').innerHTML='no AJAX support detected!!!';
				//dbg(e);
			}
		}
	}
}

//if(xmlHttp)alert("ajax engine initialized");
//else alert("ERROR initializing ajax engine!");

function getRequest(url,elem){
	if (xmlHttp) {
		//try{
			xmlHttp.open('GET', url, true);
			xmlHttp.onreadystatechange = function () {
				if (xmlHttp.readyState == 4) {
					//alert(xmlHttp.responseText);
					elem.innerHTML=xmlHttp.responseText;
				}
			};
			xmlHttp.send(null);
			return true;
		//}catch(e){
			//return false;	
		//}
	}
}

function findPosY(obj) {
	var posTop = 0;
	while (obj.offsetParent) {
		posTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return posTop;
}
function findPosX(obj) {
	var posLeft = 0;
	while (obj.offsetParent) {
		posLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return posLeft;
}

function addEvent(obj,type,func){
	if(obj.addEventListener){
		obj.addEventListener(type,func,true);
	}else{ //for IE
		//if(obj == document) obj=document.body;
		//var elem=eval('obj.on'+type+'=function(){alert(\'ok\');};');
		document.onclick=func;
	}
}

function test(){
	alert('test');
}

function getElem(id){
	return document.getElementById(id);
}
