var displaySave = null;

function showUp() {
	var display = document.getElementById("vote");
	displaySave = display.innerHTML;
	display.innerHTML = '<font color="#009933">This line got me IN!</font>';
	}

function showDown() {
	var display = document.getElementById("vote");
	displaySave = display.innerHTML;
	display.innerHTML = '<font color="#FF3300">This line got me slapped</font>';
	}
	
function goBack() {
	var display = document.getElementById("vote");
	display.innerHTML = displaySave;
	}
	

function vote(id, vote, user) {
	
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 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("Unexpected Error, Try Again.!");
				return false;
			}
		}
	}
		
	var ajaxDisplay = document.getElementById("voter");
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 1) {
			ajaxDisplay.innerHTML = '<span id="vote">Loading..' + '</span></span><span id="yesvote"><span class="inactive">&nbsp;</a></span><span id="novote"><span class="inactive">&nbsp;</a></span>';
			}
		if(ajaxRequest.readyState == 4){
			ajaxDisplay.innerHTML = ajaxRequest.responseText;	
		}
	} 
	
	ajaxRequest.open("GET", "http://www.iexcuseme.com/scripts/vote.php?id=" + id +"&vote=" + vote +"&user=" + user + "&saved=0", true);
	ajaxRequest.send(null);
	
}

function vote_r(id, vote, user) {
	
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 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("Unexpected Error, Try Again.!");
				return false;
			}
		}
	}
		
	var ajaxDisplay = document.getElementById("voter");
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 1) {
			ajaxDisplay.innerHTML = '<span id="yesvote"><span class="inactive">&nbsp;</a></span><span id="novote"><span class="inactive">&nbsp;</a></span>';
			}
		if(ajaxRequest.readyState == 4){
			ajaxDisplay.innerHTML = ajaxRequest.responseText;	
		}
	} 
	
	ajaxRequest.open("GET", "http://www.iexcuseme.com/scripts/vote.php?r_id=" + id +"&vote=" + vote +"&user=" + user , true);
	ajaxRequest.send(null);
	
}


