function OpenWindow(url,scrol,w,h){
	posLeft = ( screen.width / 2) -  ( w / 2 );
	posTop = ( screen.height / 2 ) -  ( h / 2 );
	windowprops = "top=" + posTop + ",left=" + posLeft+",width=" + w + ",height=" + h + ",scrollbars=" + scrol;
	{var win = window.open(url, "popupPage", windowprops);win.focus();return false;}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function on_search()
{
	var xml = new XMLHttpRequest();
	xml.open("GET", "search.php?text=" + encodeURIComponent(document.getElementById("search-id").value), false);
	xml.send(null);
	if (xml.status == 200)
	{
		var ret = window.showModalDialog("searchresults.php", xml.responseText, "dialogWidth: 300px; dialogHeight: 190px; center: yes; resizable: yes;");
		if (ret != null) window.location = ret;
	}
	document.getElementById("search-id").value = document.getElementById("search-id").getAttribute("searchtext") + " ...";
}
function on_searchfocus()
{
	document.getElementById("search-id").value = "";
}
function on_searchblur()
{
	if (document.getElementById("search-id").nextSibling.getAttribute("hasfocus") == "0")
		document.getElementById("search-id").value = document.getElementById("search-id").getAttribute("searchtext") + " ...";
}
function on_searchbtfocus(evt)
{
	var element;
	if (evt && evt.target) element = evt.target;
	else element = window.event.srcElement;
	element.setAttribute("hasfocus", "1");
}
function on_searchbtblur(evt)
{
	var element;
	if (evt && evt.target) element = evt.target;
	else element = window.event.srcElement;
	element.setAttribute("hasfocus", "0");
}

