function getxmlhttp ()
{
//Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;

	//Check if we are using IE.
	try 
	{
		//If the javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		//If not, then use the older active x object.
		try 
		{
			//If we are using Internet Explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (E) 
		{
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function processajax (serverPage, obj, getOrPost)
{
	xmlhttp = getxmlhttp ();
	if (getOrPost == "get" )
	{
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() 
		{
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
			{
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
	else
	{
		xmlhttp.open("POST", serverPage, true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		xmlhttp.onreadystatechange = function() 
		{
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
			{
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);	
	}
}
function showEvent(eventID)
{
	var showinfo = document.getElementById("event" + eventID);
	var detailButton = document.getElementById("eventbutton" + eventID);
	processajax ("getEvent.php?event=" + eventID, showinfo, "get");
	if ( showinfo.style.display == 'block' )
	{
		showinfo.style.display = 'none';
		detailButton.innerHTML = 'Click for<br />More Details';
	}
	else
	{
		showinfo.style.display = 'block';
		detailButton.innerHTML = 'Click to<br />Hide Details';
	}
}

function deletePhoto(photoID)
{
	var photoDiv = document.getElementById("photo" + photoID);
	var deleteButton = document.getElementById("delete" + photoID);
	processajax ("deletePhoto.php?photo=" + photoID, photoDiv, "get");
	deleteButton.style.display = 'none';
}

function ConfirmDelete(delMsg)
{
	if (confirm(delMsg))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function newsticker()
{
	var xmlfile="includes/newsticker.php" //path to ticker txt file on your server.
	//ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot)
	new ajax_ticker(xmlfile, "ajaxticker1", "someclass", 7000, "fade")
}

