function newAjax(){
	var ajaxRequest;  // The variable that makes Ajax possible
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
		return ajaxRequest;
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return;
			}
		}
	}
}//end newAjax

//define process url
var url = 'process.php';

function deleteIr(irId) {
	ajaxRequest = new newAjax();
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			alert(ajaxRequest.responseText);
			window.location = "index.php";
		}//end if(ajaxRequest.readyState == 4)
		
	}//end ajaxRequest
	
	var params = 'removeIr='+irId;
	ajaxRequest.open("POST", url, true);
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest.setRequestHeader("Content-length", params.length);
	ajaxRequest.setRequestHeader("Connection", "close");
	ajaxRequest.send(params);
}//end function deleteIr(irId) {
	
function rateIr(irId,score) {
	var dispScore = document.getElementById('score-'+irId).innerHTML;
	var newScore = (parseInt(dispScore,10)+parseInt(score,10));
	ajaxRequest = new newAjax();
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//alert(ajaxRequest.responseText);
			document.getElementById('score-'+irId).innerHTML = newScore;
			document.getElementById('arrow-'+irId).innerHTML = '<img src="images/arrow-grey.png" style="padding:0px;margin:0px"/>';
			document.getElementById('arrowd-'+irId).innerHTML = '<img src="images/arrowd-grey.png" style="padding:0px;margin:0px"/>';
		}//end if(ajaxRequest.readyState == 4)
		
	}//end ajaxRequest
	
	var params = 'rateIr='+irId+'&score='+score;
	ajaxRequest.open("POST", url, true);
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest.setRequestHeader("Content-length", params.length);
	ajaxRequest.setRequestHeader("Connection", "close");
	ajaxRequest.send(params);
}//end function deleteIr(irId) {
	

//Send the proper header information along with the request


