// JavaScript Document
var newdisplay
var display
var theclass

function changeButtons(id)
{
	//theclass = document.getElementById(thenewclass);
	if(id == 'buttonOne')
	{
		var catTab = document.getElementById(id);
		catTab.src = "/images/btn_sel_categories.png";
		catTab.style.zIndex = '2';

		var retTab = document.getElementById('buttonTwo');
		retTab.src = "/images/btn_stores.png";
		retTab.style.zIndex = '1';
		
		action = document.getElementById("action");
		action.value = "getCategory";
		
		checkAJAX();
		var url = "/Scripts/Ajax/quickSearch.ajax.asp";
		url += "?action=getCategory";
		xmlHttp.onreadystatechange = UpdateClose;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
	if(id == 'buttonTwo')
	{
		var retTab = document.getElementById(id);
		retTab.src = "/images/btn_sel_stores.png"
		retTab.style.zIndex = '2'
		
		var catTab = document.getElementById('buttonOne');
		catTab.src = "/images/btn_categories.png"
		catTab.style.zIndex = '1'
		
		action = document.getElementById("action")
		action.value = "getStores"
		
		checkAJAX();
		var url = "/Scripts/Ajax/quickSearch.ajax.asp";
		url += "?action=getStores";
		xmlHttp.onreadystatechange = UpdateClose;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}

function Update()
{
	newdisplay = xmlHttp.responseText;
	display = document.getElementById('populateSearch');
	display.innerHTML = newdisplay;
	var control = document.getElementById('expandView');
	control.innerHTML = "<a href='javascript:void(0)' onClick='closeQuickSearch()'>Close</a>";
}

function expandQuickSearch()
{
	action = document.getElementById("action").value
	checkAJAX();
	var url = "/Scripts/Ajax/quickSearch.ajax.asp";
	url += "?action="+action;
	url += "&expand=true";
	xmlHttp.onreadystatechange = Update;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function closeQuickSearch()
{
	action = document.getElementById("action").value
	checkAJAX();
	var url = "/Scripts/Ajax/quickSearch.ajax.asp";
	url += "?action="+action;
	url += "&expand=false";
	xmlHttp.onreadystatechange = UpdateClose;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function UpdateClose()
{
	newdisplay = xmlHttp.responseText;
	display = document.getElementById('populateSearch');
	display.innerHTML = newdisplay;
	var control = document.getElementById('expandView');
	control.innerHTML = "<a href='javascript:void(0)' onClick='expandQuickSearch()'>Expand View</a>";
}