﻿var showPlaceVoteBtn = false;
var showBackToVoteBtn = false;

function ReceiveServerData(resultFromServer)
{
    document.getElementById(divContent).innerHTML = resultFromServer;
    document.getElementById(placeVote).style.display= showPlaceVoteBtn ? "" : "none";
}
function RaiseCallback(actionID)
{
    
	var pollItemOptions = document.getElementsByName(clientID);
    var checkedOptionId = "";
    
    for (i=0; i<pollItemOptions.length; i++)
    {
        if (pollItemOptions[i].checked == true)
        {
            checkedOptionId = pollItemOptions[i].value;
        }
    }
//    if (checkedOptionId == "")
//    {
//        alert(alertText);
//        return;
//    }
    showPlaceVoteBtn = false;
    CallServer(checkedOptionId);
}

( function($) {
    // we can now rely on $ within the safety of our “bodyguard” function
    $(document).ready(  function()
				  {
                    //show poll				  
   				     $("#opaque").css("visibility", "visible");  
                    $("#opaque").fadeTo(200, 0.4);
				    $("#module_poll").css("display", "inline");	
				    
				    /* position absolute centre */
                    $.fn.center = function () {     
                        this.css("position","absolute");     
                        this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");     
                        this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");     
                       return this; } 
                    
                    $("#module_poll").center();
                    
                    $(window).resize(function() {
                         $("#module_poll").center();
                     })
				    
				    $("span#closePoll").click
                    (
                    
                         function()
                        {		
				            
                             $("#module_poll").css("display", "none");	
                            $("#opaque").css("visibility", "hidden");    
                            $("#opaque").fadeTo(100, 0);      
                            //send dummy vote
                            CallServer('00000000-0000-0000-0000-000000000000');  
                           
                             
                        }
//                        ,            
//                        function()
//                        {
//                            hideOpaque();
//                        }
          
				      )
				  }
				  );
} ) ( jQuery );

//$(document).ready(
//				  function()
//				  {
//                    //show poll				  
//   				    showOpaque();
//				    $("#module_poll").css("display", "inline");	
//				    
//				    $("span#closePoll").click
//                    (
//                    
//                         function()
//                        {		
//				            
//                             
//                        
//                            $("#module_poll").css("display", "none");	
//                            hideOpaque();        
//                        }
////                        ,            
////                        function()
////                        {
////                            hideOpaque();
////                        }
//          
//				      )
//				  }
//				  )

