  var xml;
  
var max, min, hyper, mystates, iRow,hstart,rowTxt;

iRow = 0
hstart = false
rowTxt = ""

index = 0 
max = 10  // Modify this TO maximun number of Results Return from QUERY


	
	
    function LoadCache(page, container, alignObj, e) {  
           
		   var key;

            state = document.forms["searchForm"].elements["keyword"].value // change Form index (if different)
			key = (window.rhLightt)?rhLightt.keyCode:e.keyCode;		
			
		    if(key != 40 && key != 38) {
           
					if(window.XMLHttpRequest) { // Mozilla (Firefox, Netscape)
						xml = new XMLHttpRequest();						
					} else if(window.ActiveXObject) {  // IE Newer        
						xml = new ActiveXObject("Msxml2.XMLHTTP")
							if(!xml) {	// IE older
								xml = new ActiveXObject("Microsoft.XMLHTTP");	
							}						
					} else {
						return
					}
			
				xml.onreadystatechange = function() {process(container, alignObj);}
				url = page+"?rnd="+Math.random+"&CacheQuery="+state
				xml.open("GET", url, true)
				xml.send(null)
				
			
				return false;
			
			}
	

        

   }
		
		
	function process(id, alignObj) {
	
	        if( (xml.readyState==4) && (xml.status == 200) ) {
		         
			var ioutout = ""			
			var x,y
			
			iRow = 0
			hstart = false
			rowTxt = ""
			
			

			 var mystates = xml.responseText
			 ioutout = mystates 
				 if(mystates.length > 0) {				 
					
					x = getX(document.getElementById(alignObj)) - 5 + getIEv(7,"x", 10, null);
					y = getY(document.getElementById(alignObj))	- 27 + getIEv(7,"y", null, 14);
					
				 	document.getElementById(id).innerHTML = ioutout
					document.getElementById(id).style.left = x + "px"
					document.getElementById(id).style.top = y + "px"
					document.getElementById(id).style.visibility = "visible"
					//alert(document.getElementById(id).innerHTML)
					
					//rowHighlight(rhLightt);
				 	
		         }  else {
					document.getElementById(id).innerHTML = ""
		         }// for  mystates.length

		         
	        }
        }
		
  function xBrowser(x) {

	return x

    }
	
  function yBrowser(y) {

	return y

    }	


// Highlight Rows


function rowHighlight(e) {

 
 	if(document.getElementById("navi_auto")) {
 
		 var rows = document.getElementById("navi_auto").getElementsByTagName("tr")
		 var key;
		 key = (window.rhLightt)?rhLightt.keyCode:e.keyCode;
		
		
		 
		 if(key==40) {
		
			
			if(iRow < rows.length -1 && hstart) {
				iRow = iRow + 1
				rows[iRow].className = "rhLight"
				rowTxt = (document.all?rows[iRow].innerText:rows[iRow].textContent)
				resetAllRows(rows, iRow)
			} else { 
			
				if(!hstart) {
					
					rows[0].className = "rhLight";
					
					hstart = true
					rowTxt = (document.all?rows[0].innerText:rows[0].textContent)				
					
				}
			}



 	}

 }


	 if(key==38) {
	
		if(iRow > 0) {
			iRow = iRow - 1
			rows[iRow].className = "rhLight"	
			rowTxt = (document.all?rows[iRow].innerText:rows[iRow].textContent)
			resetAllRows(rows, iRow)
		}
		
	
	 }
	 
}



function resetAllRows(trows, current) {

  for(j=0; j<trows.length; j++) {

	if(j!= current) {
		trows[j].className = "odd"
	}
  }

}


function upSub(e) {
	var key,node
	 key = (window.rhLightt)?rhLightt.keyCode:e.keyCode;
	 if(key==13 && rowTxt.length > 2) {
		document.forms["searchForm"].elements["keyword"].value = rowTxt		
	 }
	
}

// end HighLight Rows
