// JavaScript Document

	function getCheckedValue(radioObj) {
		if(!radioObj)
			return "";
		var votes = '';
		var radioLength = radioObj.length;
		if(radioLength == undefined)
			if(radioObj.checked)
				votes += radioObj.value + ',';
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				//return radioObj[i].value;
				votes += radioObj[i].value + ',';
			}
		}
		return votes;
	}
	function castVote(){
		
		var frm = window.document.frmPoll;
		var votes = getCheckedValue(frm.pollopt);
		if (votes==''){
			alert('You must select an option before voting!');	
			return ;
		}
		var pid = frm.pollid.value
		makeLoading('divPoll');
		var url = '/vote-results.php?pid='+pid+'&pvotes='+votes;
		xmlhttpPost(url,'poll');
		
	}
	function resPoll(resp){
		document.getElementById('divPoll').innerHTML=resp;
	}

