function ajaxRequest(url,data) 
{
	var aj = new Ajax.Request(
		url, {
			method:'get',
			parameters: data,
			onLoading: function() { 
				var oResults = $('result' + storyNum)
//				oResults.style.border = "1px solid #ccc";
//				oResults.innerHTML = "<p><img src='indicator.gif' alt='loading' /> Casting Vote</p>";
			},
			onComplete: getResponse
		}
	);
}

/* ajax.Response */
function getResponse(oReq) 
{
	var oResults = $('result' + storyNum);
	oResults.style.border = "0";
	oResults.innerHTML = oReq.responseText;
	Effect.Pulsate('oResults'); //scriptaculous effect
}

var storyNum = 0;

/* Vote for the unique story */
function pwn(inputBoxId)
{
	var inputVal = document.getElementById(inputBoxId).value;
	storyNum = inputVal.split("-")[0];
	ajaxRequest('http://www.celebritypwn.com/parse.php', 'val=' + inputVal);
}

function pwn2(storyid, session)
{
	storyNum = storyid;
	ajaxRequest('http://www.celebritypwn.com/parse.php', 'val=' + session);
}