// View Story functions


// Allows user to flag an admin about inappropriate stories

function flagVideo(videoID)
{
	// do a synchronous AJAX call
	var fsAjax = newAjaxObject();
	if(fsAjax)
	{
		//ajaxRequest.onreadystatechange = resultFunction;
		fsAjax.open("GET", "flagstory.php?videoID=" + videoID + "&rand=" + Math.random(), false); // false = synchronous mode
		fsAjax.send(null);
		// info should be filled in at this point
		if(fsAjax.status == 200)
		{
			document.getElementById("Flag"+videoID).innerHTML="Flagged!";
		}
	}
	
}

// New Ajax object

function newAjaxObject()
{
	var ajaxRequest = false;
	try
	{
		ajaxRequest = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	} catch (failed)
	{
		ajaxRequest = false;
	}
	if (! ajaxRequest)
	{
		alert ("Error initializing XMLHttpRequest!");
	}
	return ajaxRequest;
}
