	function voteSurvey(survey){		
		var http = GetXmlHttpObject();

		if (http == null){
			alert("Your browser does not support AJAX!");
			return;
		} 

		vote	= selectVote(survey);

		if(vote == 0){
			alert('Please vote.');
			return ;
		}

		var url;
		var params;

		url		= "programs/vote.php";
		params = "vote=" + vote;
		params+= "&submit=1";

		http.open("POST", url, true);

		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http.setRequestHeader("Content-length", params.length);
		http.setRequestHeader("Connection", "close");

		http.onreadystatechange = function() {//Call a function when the state changes.
			if(http.readyState == 4) {
				alert(http.responseText);
				var url = window.location.search;

				if(url.search('points') != "-1"){
					window.location.reload();
				}
				else{
					refreshPoll('survey_'+survey,5000); 
				}
			}
		}

		http.send(params);
	}

	function selectVote(survey){
		

		var vote = 0;
		for(var i = 0; i < document.getElementById("surveyform"+survey).elements.length; i++){
			var votes	= document.getElementById("surveyform"+survey).elements[i];
			var type	= votes.type;

			if(type == "radio"){
				if(votes.checked == true){
					vote	= votes.value;
					break;
				}
			}
		}

		return vote;
	}

	function queryString(key){
		var page = new PageQuery(window.location.search); 
		return unescape(page.getValue(key)); 
	}

