function spot_details(videourl,details_div)
{
	document.getElementById(details_div).innerHTML = "";

	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		//xmlhttp.open("GET","http://www.stashmedia.tv/online/spot_details.ajax.php?" + videourl, false);
		xmlhttp.open("GET","spot_details.ajax.php?" + videourl, false);
		xmlhttp.send(null);
		document.getElementById(details_div).innerHTML = xmlhttp.responseText;
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function play_all(videourl,details_div,arg)
{
	document.getElementById(details_div).innerHTML = "";

	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		//xmlhttp.open("GET","http://www.stashmedia.tv/online/spot_details.ajax.php?" + videourl, false);
		xmlhttp.open("GET","spot_details.ajax.php?" + videourl + "&playall=" + arg, false);
		xmlhttp.send(null);
		document.getElementById(details_div).innerHTML = xmlhttp.responseText;
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function bonusmusic(mylink, windowname)
{
	window.open(mylink,windowname,'width=650,height=800');
}

function showVote()
{

// Ian's Changes
	var proj = document.getElementById('voteproject').value;
	var clip = document.getElementById('voteclip').value;

// FOR TESTING
//	alert(proj + " " + clip);
	
	document.getElementById('addvote').innerHTML = "";
	
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","addvote.ajax.php?voteproject=" + proj + "&voteclip=" + clip, false);
		xmlhttp.send(null);
		document.getElementById('addvote').innerHTML = xmlhttp.responseText;
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function addVote()
{
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","http://www.stashmedia.tv/online/addvote.php?project=" + document.getElementById('voteproject').value + "&clip=" + document.getElementById('voteclip').value, false);
		xmlhttp.send(null);
		closeVote();
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function closeVote()
{
	document.getElementById('addvote').innerHTML = "";
}

function showaddPL()
{
	document.getElementById('addplaylist').innerHTML = "";
	
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","favselect.ajax.php", false);
		xmlhttp.send(null);
		document.getElementById('addplaylist').innerHTML = xmlhttp.responseText;
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function closePL()
{
	document.getElementById('addplaylist').innerHTML = "";
}

function showpubPL(fid)
{
	document.getElementById('pubplaylist'+fid).innerHTML = "";
	
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","pubpl.ajax.php?fid=" + fid, false);
		xmlhttp.send(null);
		document.getElementById('pubplaylist'+fid).innerHTML = xmlhttp.responseText;
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function closepubPL(fid)
{
	document.getElementById('pubplaylist'+fid).innerHTML = "";
}

function showpubSRCH(sid)
{
	document.getElementById('pubsearch'+sid).innerHTML = "";
	
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","pubsrch.ajax.php?sid=" + sid, false);
		xmlhttp.send(null);
		document.getElementById('pubsearch'+sid).innerHTML = xmlhttp.responseText;
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function closepubSRCH(sid)
{
	document.getElementById('pubsearch'+sid).innerHTML = "";
}

function newfavPL()
{
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","http://www.stashmedia.tv/online/addfav2pl.php?project=" + document.getElementById('favproject').value + "&clip=" + document.getElementById('favclip').value + "&newfav=" + document.getElementById('newfav').value.replace(/ /gi, '%20'), false);
		xmlhttp.send(null);
		closePL();
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function existfavPL(cid)
{
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","http://www.stashmedia.tv/online/addfav2pl.php?project=" + document.getElementById('favproject').value + "&clip=" + document.getElementById('favclip').value + "&existfav=" + cid, false);
		xmlhttp.send(null);
		closePL();
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function pubfavPL(fid)
{
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","http://www.stashmedia.tv/online/publish.php?fid=" + fid + "&favtitle=" + document.getElementById('favtitle').value.replace(/ /gi, '%20') + "&curator=" + document.getElementById('curator').value.replace(/ /gi, '%20') + "&comments=" + document.getElementById('comments').value.replace(/ /gi, '%20'), false);
		xmlhttp.send(null);
		closepubPL(fid);
		window.location.reload();
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function pubfavSRCH(sid)
{
	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","http://www.stashmedia.tv/online/publishsrch.php?sid=" + sid + "&srchtitle=" + document.getElementById('srchtitle').value.replace(/ /gi, '%20') + "&curator=" + document.getElementById('curator').value.replace(/ /gi, '%20') + "&comments=" + document.getElementById('comments').value.replace(/ /gi, '%20'), false);
		xmlhttp.send(null);
		closepubSRCH(sid);
		window.location.reload();
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

function movie_format(format)
{

	alert(format);

	xmlhttp=null;
	
	if (window.XMLHttpRequest)
	{// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null)
	{
		xmlhttp.open("GET","movie_format.ajax.php?format=" + format, false);
		alert(xmlhttp.responseText);
		window.location.reload();
	}
	else
	{
		alert("Your browser does not support XMLHTTP.");
	}
}

