<!--
window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=15; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}


function gotoPage(fullUrl,urlTitle,winWidch,winHeight)
{

      if (window.screen) {
          var thisWinTop = (window.screen.height - winHeight)/2;
          var thisWinLeft = (window.screen.width - winWidch)/2;
          window.open(fullUrl,urlTitle,'width='+winWidch+',height='+winHeight+',resizable,scrollbars=yes,screenx='+thisWinLeft+',screeny='+thisWinTop+',left='+thisWinLeft+',top='+thisWinTop+',directories=no,location=no,menubar=no,toolbar=no,status=no')
          } else {
            window.open(fullUrl,urlTitle,'width='+winWidch+',height='+winHeight+',resizable,scrollbars=yes,screenx=50,screeny=50,left=50,top=50,directories=no,location=no,menubar=no,toolbar=no,status=no')
            }
}

var until = "<h3><img src='./images/loading.gif' /> Изисква данни от сървъра ...</h3>";
function GetXmlHttpObject(handler) {
	var objXmlHttp = null
	if (navigator.userAgent.indexOf("Opera") >= 0) {
		alert("Този пример не работи в Opera")
		return

	}
	if (navigator.userAgent.indexOf("MSIE") >= 0) {
		var strName = "Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5") >= 0) {
			strName = "Microsoft.XMLHTTP"
		}
		try {
			objXmlHttp = new ActiveXObject(strName)
			objXmlHttp.onreadystatechange = handler
			return objXmlHttp
		} catch (e) {
			alert("Error. Scripting for ActiveX might be disabled")
			return

		}
	}
	if (navigator.userAgent.indexOf("Mozilla") >= 0) {
		objXmlHttp = new XMLHttpRequest()
		objXmlHttp.onload = handler
		objXmlHttp.onerror = handler
		return objXmlHttp
	}
}

function liveSearch(str,url,place) {
	var divLiveSearchID = 'livesearch';
	if (place.length > 0) {
		divLiveSearchID = place;
		document.getElementById('LiveSearchResults').style.display = 'block';
	}
	if (str.length == 0) {
		document.getElementById(divLiveSearchID).innerHTML = "";
		document.getElementById(divLiveSearchID).style.border = "0px";
		HideSearchResults();
		return;
	}

	this.handleHttpResponse = function() {
		var targetObj = document.getElementById(divLiveSearchID);
		targetObj.innerHTML = until;
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200) {
				try {
					targetObj.innerHTML = xmlHttp.responseText;
				} catch (e) {
					alert("Грешка при прочитене на отговора: " + e.toString());
				}
			} else {
				alert("Има проблем при извличането на данните:\n"
				+ xmlHttp.statusText);
			}
		}
	}

	var myRandom = parseInt(Math.random() * 99999999); // cache buster
	xmlHttp = GetXmlHttpObject(this.handleHttpResponse);

	xmlHttp.open("GET", url +"&key=" + str + "&" + myRandom, true);
	// xmlHttp.setRequestHeader("Content-Type","text/html;charset=");
	xmlHttp.send(null);

}

function HideSearchResults() {
	document.getElementById('LiveSearchResults').style.display = 'none';
}

function ClearLiveSearchResults() {
	document.getElementById('LiveSearchResults').innerHTML = '';
}
//-->
