
//Global XMLHTTP Request object
var XmlHttp;
var XmlHttp1;

function CreateXmlHttp1()
{
	//Creating object of XMLHTTP in IE

	try
	{
		XmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp1 = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp1 && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp1 = new XMLHttpRequest();
	}
}

//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
function CreateXmlHttp()
{
	//Creating object of XMLHTTP in IE

	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
}
function getFeaturedProduct()
{
	var requestUrl = "ajaxserver.aspx?method=getFeaturedProduct";
	
	CreateXmlHttp();
	
	if(XmlHttp)
	{
	
		XmlHttp.onreadystatechange = showFeaturedData;

		XmlHttp.open("GET", requestUrl, true);
		
		XmlHttp.send(null);		
	}
}
function showFeaturedData()
{

	if(XmlHttp.readyState == 4)
	{
		if(XmlHttp.status == 200)
		{	
			if (XmlHttp.responseText.length >0)
				document.getElementById("FeaturedDivContent").innerHTML =XmlHttp.responseText
				
		    document.getElementById('FeaturedDivContent').style.display='block';
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

/*
function getProductInfo(val)
{

	var requestUrl = "ajaxserver.aspx?method=getProductinfo&type=" + val;
	
	CreateXmlHttp1();
	
	if(XmlHttp1)
	{
		XmlHttp1.onreadystatechange = HandleResponse;
		
		XmlHttp1.open("GET", requestUrl, true);
		
		XmlHttp1.send(null);		
	}
}
*/
function getProductInfo(categoryId)
{

	var requestUrl = "ajaxserver.aspx?method=getProductinfo&catId=" + categoryId;
	
	CreateXmlHttp1();
	
	if(XmlHttp1)
	{
		XmlHttp1.onreadystatechange = HandleResponse;
		
		XmlHttp1.open("GET", requestUrl, true);
		
		XmlHttp1.send(null);		
	}
}

function HandleResponse()
{

	if(XmlHttp1.readyState == 4)
	{
		if(XmlHttp1.status == 200)
		{	
		    //document.getElementById("topbar_topbar_divContent").innerHTML =XmlHttp.responseText
		    //document.getElementById('topbar_topbar_divContent').style.display='block';
		    if (XmlHttp1.responseText.length >0)
				document.getElementById("topbar_topbar_divContent").innerHTML =XmlHttp1.responseText
				
		    document.getElementById('topbar_topbar_divContent').style.display='block';
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}


