'; html += '
'; html += '
'; }); html += '
'; }); html += '
Share this Poll
'; $('#poll-3429630-3 div.poll-content').html(html); } }; var getResults = function(evt) { data = { "sid": '3429630' , "rid": '3' , "slugs": '4' , "get_results": "yes" , "multiple-questions": "true" , "new": "true" }; data['slugs-' + 4] = 'p-1910,p-1920,p-1930,p-1940,p-1950,p-1960,p-1970,p-1980,p-1990'; $.get('/ajax/record_poll.php', data, displayData); }; var submitPoll = function(evt) { $.post('/ajax/record_poll.php', $(this).serialize(),function(data,status,xhr) { ans = {}; $.each(poll['3429630-3'].keys,function(i,v) { checked = $('#poll-3429630-3 li.vote input.q' + v + ':checked'); if (checked.length == 1) aans = checked.val(); else { aans = []; checked.each(function(i,v) { aans.push(v.value); }); } ans['q'+v] = aans; }); d = new Date(); d.setDate(d.getDate() + 30); exp = d.toUTCString(); displayData(data); }); evt.preventDefault(); }; var displayPoll = function() { html = ""; $.each(poll['3429630-3'].keys,function(i,qid) { q = poll['3429630-3']['q'+qid]; qn = 'q' + qid; html += ''; if (q.question) html += '
' + q.question + '
'; html += '
- '; $.each(q.answers, function(slug,answ) { html += '
- '; html += ''; html += '
'; }); html += '
'; }); html += '
'; html += '
'; $('#poll-3429630-3 div.poll-content').html(html); }; $(document).ready(function(evt) { $('#poll-3429630-3 .poll-submit').live('click',function(evt) { $('#poll-3429630-3 div.error, #poll-3429630-3 div.message').text(""); }); $('#revote-3429630-3').live('click',displayPoll) $('#fbshare-3429630-3').live('click',postToFBFeed) $('#get-poll-3429630-3').live('click',getResults); $('#poll-3429630-3').submit(submitPoll); }); })(jQuery)

