function gid(o) {
	return document.getElementById(o);
}

function gv(o) {
	if (gid(o))	{	return gid(o).value;	}
	return '';
}

var loadXMLs=new Array();

function loadXMLDoc(url,id)
{	
	 var xmlhttp=null;

	 if (window.XMLHttpRequest)
	 {// code for Firefox, Opera, IE7, etc.
		  xmlhttp=new XMLHttpRequest();
	 }
	 else if (window.ActiveXObject)
	 {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	 }
	 if (xmlhttp!=null)	 {	 
		 	if (typeof(loadXMLs[id])=='object')	{	loadXMLs[id].abort();	}
		  
		 xmlhttp.onreadystatechange=function() {
	 	 if (xmlhttp.readyState==4)	 {
		  if (xmlhttp.status==200)		  {	
				try {	 if (id != 'undef') { 	 gid(id).innerHTML=xmlhttp.responseText; 
					
		document.onmousemove=getCursorXY;
				if (gid('rowcount')) {		gid(id).style.height=gv('rowcount')+'px';	}

				}	 }
				catch (err)
				{			alert("Error1:" + err);	
								gid(id).innerHTML='no data'; }
		 }
		  else  {		gid(id).innerHTML='no data';	  }
	 }	
	 }

		  xmlhttp.open("GET",url+randomString(50),true);
		  xmlhttp.send(null);
		  loadXMLs[id]=xmlhttp;
	 }
	 else
	 {
		  alert("This is a not supported browser / Az Ön böngészője nem támogatott! Please contact with the system administrator / Kérem konzultáljon a rendszergazdával!");
	 }
}

function randomString(string_length) {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return "&amp;rand="+randomstring;
}

var posx = 0;
var posy = 0;
var timer;
function getCursorXY(e) {
	if(!e) var e=window.event;
	if (e.pageX || e.pageY) {
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) {
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
}
function addTimer(a)
{
	timer = setTimeout("removechildtooltip('" + a + "')" ,500);
}
function stopTimer()
{
	clearTimeout(timer);
}
function tooltip(a, b, c){
	if(document.getElementById(a)){stopTimer(); removechildtooltip(a)}
	var tooltip = document.createElement('div');
	tooltip.id = a;
	document.onmousemove=getCursorXY;
	tooltip.style.position = 'absolute';
	tooltip.style.left = posx + "px";
	tooltip.style.top = posy + "px";
	tooltip.innerHTML = "<div class='"+a+"'>" + b + "</div>";
	tooltip.onmouseover = function(){stopTimer();};
	tooltip.onmouseout = function(){addTimer(a);};
	document.body.appendChild(tooltip);
}
function removechildtooltip(a){
	document.body.removeChild(document.getElementById(a));
}
