function getXmlHttpRequestObject(){
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new 
                ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
    @else
        xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}


function findPosX(obj, width) {
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	
	return curleft;
}
function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	return curtop;
}
function showAdvHint (url, obj)
{
	x = findPosX(obj, 200);
	y = findPosY(obj);
	document.getElementById('hint').innerHTML = "Загрузка";
	document.getElementById('hint').style.display = 'block';
	document.getElementById('hint').style.left = x+35;
	document.getElementById('hint').style.top = y+35;	
	
	loadExtData(url, 'hint');
}
function showAdvHint1 (url, obj)
{
	x = findPosX(obj, 200);
	y = findPosY(obj);
	document.getElementById('hint').innerHTML = "Загрузка";
	document.getElementById('hint').style.display = 'block';
	document.getElementById('hint').style.left = x+35;
	document.getElementById('hint').style.top = y+35;	
	
	loadExtData(url, 'hint');
}
function showAdvHint2 (url, obj)
{
	x = findPosX(obj);
	y = findPosY(obj);
	document.getElementById('hint').innerHTML = "Загрузка";
	document.getElementById('hint').style.display = 'block';
	document.getElementById('hint').style.left = x+35;
	document.getElementById('hint').style.top = y+35;	
	
	loadExtData(url + '&type=1', 'hint');
}
function hideHint ()
{
	document.getElementById('hint').style.display = 'none';
}

var httpRequester = new Array();
var processingRequest = false;

function loadExtData (url, to)
{
	 url = '/?module=view&id=' + url;
     var curDateTime = new Date();
     httpRequester[curDateTime] = getXmlHttpRequestObject();
     if (!processingRequest && httpRequester[curDateTime]) {
          processingRequest = true;

          httpRequester[curDateTime].open("GET", url, true);
		  
		  
          httpRequester[curDateTime].onreadystatechange = function ()
          {
               if (httpRequester[curDateTime].readyState == 4 ) {
                    processingRequest = false;
					document.getElementById(to).innerHTML = httpRequester[curDateTime].responseText;
               }
          }

          processingRequest = false;
          httpRequester[curDateTime].send(null);
     }
}
