function voteUp(id) { 
    var a = new articlevote(); 
    a.setCallbackHandler(displayCheck); 
    a.setForm('articleForm'+id); 
    a.voteUp(id) 
	getArticleCount(id)
} 
function voteDown(id) { 
    var a = new articlevote(); 
    a.setCallbackHandler(displayCheck); 
    a.setForm('articleForm'+id); 
    a.voteDown(id) 
    getArticleCount(id)
} 
function displayCheck(res) { 
	var artid;
	if (res < 0) { 
	 artid =  res * -1;
        document.getElementById('message'+artid).innerHTML = 
            '<span style="color:red">Thumbs<br />Down</span>'; 
    } else { 
        document.getElementById('message'+res).innerHTML = 
            'Thumbs<br />Up'; 
} 
} 
function getArticleCount(id) { 
    var a = new articlevote(); 
    a.setCallbackHandler(displayCount); 
    a.getCount(id); 
} 
//function displayCount(res) { 
function displayCount(votes) { 
   // alert(votes[2]); 
	var total;
	
	
	document.getElementById('upvotes'+votes[2]).innerHTML = 
            '+'+votes[0]; 
	document.getElementById('downvotes'+votes[2]).innerHTML = 
            '- '+votes[1]; 
			total = votes[0] - votes[1];
			if (total > 0) {
	document.getElementById('total'+votes[2]).innerHTML = 
            '<span style="color:#23a45d">+'+total+'</span>'; 
						document.getElementById('thumbs'+votes[2]).innerHTML = 
				'<img src="/images/temp/bigthumbsup.gif" alt="thumbs up" width="32" height="38" />';

			}
			else
			{
				if (total == 0 )
				{	document.getElementById('total'+votes[2]).innerHTML = 
				'<span style="color:#000">'+total+'</span>';
								document.getElementById('thumbs'+votes[2]).innerHTML = 
				'<img src="/images/temp/even.gif" alt="even" width="32" height="38" />';

					}
				else{
						document.getElementById('total'+votes[2]).innerHTML = 
				'<span style="color:red">'+total+'</span>';
								document.getElementById('thumbs'+votes[2]).innerHTML = 
				'<img src="/images/temp/bigthumbsdown.gif" alt="thumbs down" width="32" height="38" />';

				}
			}
			
} 

