/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


var pol_id;
var rat_id;

function setVal(x,y){
    //alert(x+y);
    pol_id=x;
    rat_id=y;

}

function formActionPoll()
{
    var err="<font color=\"red\">Please, Select a rating value!</font>";
   
    if(pol_id==null || rat_id==null){
        //alert('You do not select a valid taring!!')
        // document.getElementById("alert_message").innerHTML="Please, Select a rating value!";
        $("#div_poll_feedback").html(err);
        // show_alert();
        return;
    }
    //var url="poll_rating/pol_save.jsp?Poll_ID=" + pol_id + "&Pol_Option="+rat_id;
    var msg_loading = "Sending ...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
    $("#div_poll_feedback").html(msg_loading);

    $.ajax({
        type: "GET",
        url: "poll_rating/pol_save.jsp",
        data: "Poll_ID=" + pol_id+"&Pol_Option="+rat_id ,
        success:   function(msg){
            $("#div_poll_feedback").html(msg);
        }
    });
    pol_id=null;
    rat_id=null;

}

function rating(poll_cat_id)
{

    $.ajax({
        type: "GET",
        url: "poll_rating/rating.jsp",
        data: "poll_cat=" + poll_cat_id ,
        success:   function(msg){
            var result=$.trim(msg);
            $("#div_rating").html(result);

        }
    });


}
