function getXMLHttpRequestObject(){
	var ajax=false;
	if(window.XMLHttpRequest){
		ajax=new XMLHttpRequest();
	}else if(window.ActiveXObject) {
		try{
			ajax=new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				ajax=new ActiveXObject("Microsoft.XMLHTP");
			}catch(e){}
		}
	}
	return ajax;
}

function article_vote(yes_no, article_number)
{
	var ajax=getXMLHttpRequestObject();
	if(ajax){
		if(document.getElementById('columnBody')){
				var article_id=article_number;
				var vote=yes_no;
				ajax.open('get', 'http://www.student-subway.com/earth/article_vote.php?article_id=' + encodeURIComponent(article_id) + '&vote=' + encodeURIComponent(vote));
				ajax.onreadystatechange = function(){
					if(ajax.readyState==4){
							if((ajax.status==200) || (ajax.status==304)){
								var data=ajax.responseXML;
								var votingDiv=document.getElementById('vote_wrap' + article_id);
										
								var result=data.getElementsByTagName('result');
								for(var i=0; i<result.length; i++){
				
									if(result[i].firstChild.nodeValue=='Vote Locked In'){
										
										while(votingDiv.hasChildNodes()){
											votingDiv.removeChild(votingDiv.lastChild);	
										}
										var imgAgree=document.createElement('img');
										var imgDisagree=document.createElement('img');
										var votedP=document.createElement('p');
										votedP.setAttribute('class', 'locked_in');
										var articleBar=votingDiv.parentNode;
										imgAgree.setAttribute('alt', 'Agree');
										imgDisagree.setAttribute('alt', 'Disagree');
										votingDiv.setAttribute('style', 'float: left;');
										var voted_text = document.createTextNode("Vote Locked In");		
										var voted_space = document.createTextNode(" | ");		
										votedP.appendChild(voted_text);
										articleBar.appendChild(votedP);
										if(vote=="0"){
											imgAgree.setAttribute('src', 'http://www.student-subway.com/images/vote_agree_unselected.png');
											imgDisagree.setAttribute('src', 'http://www.student-subway.com/images/vote_disagree_selected.png');
										}else if(vote=="1"){
											imgAgree.setAttribute('src', 'http://www.student-subway.com/images/vote_agree_selected.png');
											imgDisagree.setAttribute('src', 'http://www.student-subway.com/images/vote_disagree_unselected.png');
										}
										
										votingDiv.appendChild(imgAgree);
										votingDiv.appendChild(voted_space);
										votingDiv.appendChild(imgDisagree);
									//	votingDiv.appendChild(voted_text);
								}else{
										
								//		var votedP=document.createElement('p');
									//	votedP.setAttribute('class', 'locked_in');
									//	votedP.setAttribute('id', 'locked_in_msg_' + article_id);
									//	var articleBar=votingDiv.parentNode;
									//	var para=document.getElementById('locked_in_msg_' + article_id);
									//	para.parentNode.removeChild(para);
									//	articleBar.removeChild();
										
										
									//	var voted_text = document.createTextNode(result[i].firstChild.nodeValue);		    						//		votedP.appendChild(voted_text);
								//		articleBar.appendChild(votedP);
								}
							}
						}else{
							
						}
					}
				}
				ajax.send(null);
			//	return false;
			
		}// end of DOM check - ZM
	}//end of ajax if - ZM	
	
}

function roll_over(img_name, img_src)
{
   document[img_name].src = img_src;
}