var fslist=0;

function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

var xmlhttp = getXmlHttp();



function absPosition(obj) {
var x = y = 0;
while(obj) {
x += obj.offsetLeft;
y += obj.offsetTop;
obj = obj.offsetParent;
}
return {x:x, y:y};
}



function TableActivate(tblid,clra,clrp) {
var tbl=document.getElementById(tblid);

tbl.onmouseover=tbl.onmouseout=function(e)
{
if (!e) e = window.event;
var elem = e.target || e.srcElement;
while (!elem.tagName || !elem.tagName.match(/td|table/i)) elem=elem.parentNode;
if (!elem.tagName.match(/td/i)) return true;
var row = elem;
if (e.type=="mouseover") {row.style.backgroundColor=clra;} else {row.style.backgroundColor=clrp;}
};

tbl.onclick=function(e)
{
if (!e) e = window.event;
var elem = e.target || e.srcElement;
while (!elem.tagName || !elem.tagName.match(/td|table/i)) elem=elem.parentNode;
if (!elem.tagName.match(/td/i)) return true;
if (elem.id.length>0) {document.location.href="http://"+document.location.hostname+"/index.php?p=item&id="+elem.id;}
};

}


function GoReq(inpobj,slobj) {
if (inpobj.value.length<1) {
slobj.style.display='none';
return false;
}
xmlhttp.open('GET', '/fsrch.php?search='+encodeURIComponent(inpobj.value), true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {

if (xmlhttp.responseText.length>0) {
var aaa=absPosition(inpobj);
aaa.x+=2;
aaa.y+=20;
slobj.style.left=aaa.x+'px';
slobj.style.top=aaa.y+'px';
slobj.innerHTML=xmlhttp.responseText;
slobj.style.display='block';
TableActivate("tbltbl","#e0e0ee","#ffffff");
} else {
slobj.style.display='none';
}

}
}
};
xmlhttp.send(null);
return true;
}

