$(document).ready(function(){
	function getChoice(rdoObj)
		{
			if(!rdoObj)
				return false;
			
			var radioLength = rdoObj.length;
			
			for(var i=0; i<radioLength; i++){
				if(rdoObj[i].checked){
					return rdoObj[i].value;
				}
			}
		
			return false;
		}
		
	function validate(){
		var choice = getChoice(document.forms['frm_vote'].elements['choice']);
		
		return choice;
	}

	
	$("#btn_flavorvote").click(function(){
		var choice = validate();
		
		if(choice){
			//alert(choice);
			var surveyId = 500000019;
			var surveyComplete = true;
			
			var resp = Tremor.Ajax.Call('survey','submit',{ surveyId:surveyId, surveyComplete:surveyComplete, q500000417:choice},{sync:true});
			//setTimeout("window.location='flavorvote_thanks.html';",2000);
			window.location="flavorvote_thanks.html";
		}
		else{
			$("#msg").html("Please select a product then click 'Vote!'");
			$("#msg").addClass("msg_error");
			return false;
		}
		
	});
});
// JScript File
