// JavaScript Document
var xmlHttp;
function ValidatePollVote(pollId){
 
 var objAnswerRadioButton = document.getElementsByName('RadAnswer');
 var totalRadio = objAnswerRadioButton.length;
 var isSelected = false;
 var selectedValue = "";
 for (var loop=0; loop<totalRadio; loop++){
    if (objAnswerRadioButton[loop].checked){
		isSelected=true;
		selectedValue = objAnswerRadioButton[loop].value
	     break;  
	}
 }
 if (isSelected==false){
   alert('please select one answer');
   return false;
 } else {
    var currentDate = new Date();
    var currentTime = currentDate.getTime();	  
    var url ;
	xmlHttp=getHTTPObject();
    url = "InsertUpdateAjax.php?CTime="+currentTime+"&AjaxState=PollVote&PollId="+pollId+"&Answer="+selectedValue
    xmlHttp.onreadystatechange=stateChanged_Vote;
  	xmlHttp.open("GET",url,true);
  	xmlHttp.send(null);
    return false;
 }
 
}
function stateChanged_Vote(){
	var objTd = document.getElementById('AjaxResponse');
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		objTd.innerHTML = "<b>"+xmlHttp.responseText+"</b>";
	}
	else{
          		
	} 
}

/*function slideSwitch() {
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 10000 );
});*/
