function filterTour(url)
{
	xmlHttp2=GetXmlHttpObject();
	if (xmlHttp2==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	xmlHttp2.onreadystatechange=function()
	{
		if(xmlHttp2.readyState==4)
		{
			document.getElementById("tour_display").innerHTML=xmlHttp2.responseText;
			var currPage=parseInt(document.getElementById("curr_page").innerHTML);
			var numPages=parseInt(document.getElementById("pages").innerHTML);
			if(currPage>1)
			{
				document.getElementById("prev_tour_page").innerHTML="<a href='javascript:void(0);' onClick='navTour(-1,"+level+")'>&laquo; prev</a> ";
			}
			if(numPages>currPage)
			{
				document.getElementById("next_tour_page").innerHTML=" <a href='javascript:void(0);' onClick='navTour(1,"+level+")'>next &raquo;</a>";
			}			
		}
	}
	var country=document.getElementById("country").value;
	var month=document.getElementById("month").value;
	var year=document.getElementById("year").value;
	var artist=document.getElementById("artist").value;
	var page=document.getElementById("curr_page").innerHTML;
	if (!url)
	{
		var url; 
		var level="2";
	}
	else
	{ var level="2"; }
	url=url+"filter_tour.php?country="+country;
	if(country=="USA") { url=url+"&state="+document.getElementById("state").value; }
	url=url+"&month="+month+"&year="+year+"&artist="+artist+"&page="+page+"&level="+level;
	xmlHttp2.open("GET",url,true);
	xmlHttp2.send(null);
}

function navTour(dir,level)
{
	document.getElementById("curr_page").innerHTML=parseInt(document.getElementById("curr_page").innerHTML)+dir;
	if (level==2)
	{ filterTour(''); }
	else if (level==3)
	{ filterTour('../../tour/'); }
}

function resetPage()
{
	document.getElementById("curr_page").innerHTML="1";
	document.getElementById("pages").innerHTML="1";
	filterTour('');
}

function filterCountry(country)
{
	xmlHttp1=GetXmlHttpObject();

	if (xmlHttp1==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	xmlHttp1.onreadystatechange=function()
	{
		if(xmlHttp1.readyState==4)
		{
	   		document.getElementById("loc_filter_div").innerHTML=xmlHttp1.responseText;
			resetPage();
		}
	}
	var url="filter_country.php?country="+country;
	xmlHttp1.open("GET",url,true);
	xmlHttp1.send(null);
}

function hideInfo()
{
	document.getElementById("info").style.display="none";
}

function showInfo(artist,year,month,day,level)
{
	xmlHttp1=GetXmlHttpObject();

	if (xmlHttp1==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	xmlHttp1.onreadystatechange=function()
	{
		if(xmlHttp1.readyState==4)
		{
			document.getElementById("info").style.display="block";
			document.getElementById("tour-content-here").innerHTML=xmlHttp1.responseText;
		}
	}
	var url;
	if(level=="2")
	{ url="../"; }
	else if(level=="3")
	{ url="../../"; }
	url=url+"tour/info.php?artist="+artist+"&year="+year+"&month="+month+"&day="+day;

	xmlHttp1.open("GET",url,true);
	xmlHttp1.send(null);
}

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;
}