var xmlHttp;
var locvar;
var mclickrow;
var mwpid;
var menuobj;
function search(str,fm)
{
 document.form1.action ="search.aspx?q=" + str;
 document.form1.submit();
 

}
function showResults(str,fm)
{ 

//xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
 fm.action ="search.aspx?q" + str;
 fm.method = "post";
 fm.submit;
 
/*var url="search.aspx";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);*/
}
// Function to search the text firing statechanged
	function stateChanged() 
		{ 
			if (xmlHttp.readyState==4)
				{ 
				
					document.getElementById("div1").style.visibility = "visible";
					document.getElementById("div1").innerHTML="";
					var t = document.createElement('div');
					t.innerHTML = xmlHttp.responseText;
					document.getElementById("div1").appendChild(t);
							//document.getElementById("mydiv1").innerHTML=
				}
		}
		
// Getting the xml object		
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}  
function showDiv(obj,catid)
{
menuobj = obj;

document.getElementById("divHB").style.visibility= "hidden";
document.getElementById("divRF").style.visibility= "hidden";
document.getElementById("divSH").style.visibility= "hidden";
document.getElementById("divLC").style.visibility= "hidden";
document.getElementById("divRE").style.visibility= "hidden";
document.getElementById(obj).style.visibility= "visible";
fetchMenus(catid);
}
function hideDiv()
{

document.getElementById("divHB").style.visibility= "hidden";
document.getElementById("divRF").style.visibility= "hidden";
document.getElementById("divSH").style.visibility= "hidden";
document.getElementById("divLC").style.visibility= "hidden";
document.getElementById("divRE").style.visibility= "hidden";

}


function fetchMenus(obj)
{

var str;
str = obj;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getMenus.aspx";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedMenus;
xmlHttp.open("GET",url,true);

xmlHttp.send(null);
}

function stateChangedMenus() 
		{ 
		
		
		
			if (xmlHttp.readyState==4)
				{ 
				
				document.getElementById(menuobj).style.visibility= "visible";
//				document.getElementById(menuobj).style.visibility = "Visible";
					document.getElementById(menuobj).innerHTML="";
					var t = document.createElement('div');
					t.innerHTML = xmlHttp.responseText;
					document.getElementById(menuobj).appendChild(t);
							//document.getElementById("mydiv1").innerHTML=
				}
		}
