
(function() {(function() {var l = document.createElement("link");l.rel = "stylesheet";l.type = "text/css";l.href = "http:\/\/civicscience-widgets.s3.amazonaws.com\/cheezburger\/i-can-has-main-v3.css";(document.getElementsByTagName('head')[0] || document.documentElement).appendChild(l);})();var init = 
(function(widgetElementId, widgetHtml, widgetCallback) {var DMODE_DESKTOP = "click";var DMODE_MOBILE = "touch";var JQUERY_VERSION = "1.10.2";var PAGE_URL = "";(function() {var w;for (w = window; w.parent != w; w = w.parent);try {PAGE_URL = w.location.href;} catch (e) {}})();var $ = window.jQuery;function requestJSONP(url, handler) {$.ajax({url: url,
dataType: "jsonp",
crossDomain: true,
jsonp: "responseHandler"
})
.done(function(resp) {handler(resp.data);});}var Widget = function(containerElt) {var THIS = this;var $container = $(containerElt);var deviceMode = $container.find("div:first").hasClass(DMODE_MOBILE)
? DMODE_MOBILE
: DMODE_DESKTOP;this.getDeviceMode = function() {return deviceMode;};var $body = $container.find(".poll_body");this.$getBody = function() {return $body;};var $progress = $container.find(".ballotbox");this.setProgress = function(current, total) {$.each(
$progress[0].className.split(/\s+/),
function(i, c) {if (/^(question|total)_/.test(c)) {$progress.removeClass(c);}});if (current >= 0 && total >= 0) {$progress
.addClass("question_" + current)
.addClass("total_" + total);}};this.setBodyIsLoading = function(loading) {$body.toggleClass("loading", !!loading);};this.getQuestionsUrl = "";this.getResultsUrl = "";this.putResponsesUrl = "";this.isOptOutUser = false;var receivedQidList = [];this.getReceivedQidList = function() {return receivedQidList;}; function receivedQuestion(qid) {receivedQidList.unshift(qid);var i;for (i = 1; i < receivedQidList.length; i++) {if (receivedQidList[i] == qid) { receivedQidList.splice(i--, 1);}}if (receivedQidList.length > 30) {receivedQidList.pop();}} var LOCAL_NAME = "__iqpbb";function getLocalId() {var id = null;if (!THIS.isOptOutUser) {try {if ("localStorage" in window) {var storage = window["localStorage"];if (storage != null) {id = storage.getItem(LOCAL_NAME);if (id == null) {function r() {return Math.floor(Math.random() * 4294967296);}id = r() + "." + r();storage.setItem(LOCAL_NAME, id);}}}} catch (e) {}}return id;} function start() {var params = [];var id = getLocalId();if (id) {params.push("al=" + encodeURIComponent(id));}if (PAGE_URL) {params.push("pgurl=" + encodeURIComponent(PAGE_URL));}params.push("elth=" + Math.round($container.height()));params.push("elty=" + Math.round($container.offset().top));params.push("winh=" + Math.round($(window).height()));params.push("winy=" + Math.round($(window).scrollTop()));if (params.length > 0) {THIS.getQuestionsUrl
+= (THIS.getQuestionsUrl.indexOf("?") == -1 ? "?" : "&")
+ params.join("&");}var qp = new QuestionPager(THIS);qp.addReceivedQuestionListener(receivedQuestion);qp.addFinishListener(showResults);qp.run();} var isRunning = false;this.run = function() {if (isRunning) {return;}isRunning = true;start();}; this.restart = function() {if (isRunning) { var qurl = this.getQuestionsUrl;qurl += qurl.indexOf("?") == -1 ? "?" : "&";qurl += "restart=1";this.getQuestionsUrl = qurl;this.getResultsUrl = "";this.putResponsesUrl = "";start();}}; var showResults = function() {if (THIS.getResultsUrl) {var url = THIS.getResultsUrl;THIS.setBodyIsLoading(true);requestJSONP(url, function(response) {THIS.setBodyIsLoading(false);if (response.results) {var pobjList = response.results.pages;if (pobjList) {var first = null;var prev = null;var i;for (i = 0; i < pobjList.length; i++) {var pobj = pobjList[i];if (pobj.html) {var prev = new ResultsPage(THIS, pobj.html, prev);if (first == null) {first = prev;}}}if (first == null) {$body.empty();} else {first.show();}}}});}}; };var QuestionPager = function(widget) {var THIS = this;var MAX_PAGE_SIZE = 1;var qobjList = [];var qobjIndex = 0;var askedList = [];var isVoting = false;var receivedQuestionListeners = [];this.addReceivedQuestionListener = function(f) {if (typeof f == "function") {receivedQuestionListeners.push(f);}}; var run = function() {var origIndex = qobjIndex;widget.$getBody().empty();askedList = [];while (qobjIndex < qobjList.length) {var qobjMax = Math.min(qobjList.length, qobjIndex + MAX_PAGE_SIZE);var asked = false;while (qobjIndex < qobjMax) {var qobj = qobjList[qobjIndex++];var question = null;switch (qobj.type) {case "radio":question = new RadioQuestion(widget, THIS, qobj.html);break;}if (question != null) {if (MAX_PAGE_SIZE == 1) {widget.setProgress(qobjIndex, qobjList.length);}question.ask();askedList.push(question);}}if (askedList.length > 0) {isVoting = false;return;}}if (MAX_PAGE_SIZE == 1) {widget.setProgress(-1, -1);}if (origIndex == 0 && qobjList.length != 0) {finish();} else if (widget.getQuestionsUrl) {var url = widget.getQuestionsUrl;var xqids = widget.getReceivedQidList();if (xqids.length > 0) {url += url.indexOf("?") == -1 ? "?" : "&";url += "xq=." + xqids.join(".");}widget.setBodyIsLoading(true);requestJSONP(url, function(response) {widget.setBodyIsLoading(false);qobjList = response.questions || [];if (response.session) {widget.getQuestionsUrl = response.session.getQuestionsUrl;widget.getResultsUrl = response.session.getResultsUrl;widget.putResponsesUrl = response.session.putResponsesUrl;}if (qobjList.length == 0) {finish();} else {var i;for (i = 0; i < receivedQuestionListeners.length; i++) {var j;for (j = 0; j < qobjList.length; j++) {receivedQuestionListeners[i](qobjList[j].id);}}qobjIndex = 0;run();}});}}; this.run = run;var vote = function() {if (!isVoting && widget.putResponsesUrl) {var params = "";var i;for (i = 0; i < askedList.length && askedList[i].isVotable(); i++) {if (params) {params += "&";}params += askedList[i].getUrlParams();}if (i == askedList.length) {var url = widget.putResponsesUrl;if (params != "") {url += url.indexOf("?") == -1 ? "?" : "&";url += params;}requestJSONP(url, function(response) {if (response.ok) {if (response.session) {widget.getQuestionsUrl = response.session.getQuestionsUrl;widget.getResultsUrl = response.session.getResultsUrl;widget.putResponsesUrl = response.session.putResponsesUrl;}run();} else {isVoting = false;}});isVoting = true;}}}; this.vote = vote;var finishListeners = [];this.addFinishListener = function(f) {if (typeof f == "function") {finishListeners.push(f);}};var finish = function() {var i;for (i = 0; i < finishListeners.length; i++) {finishListeners[i].apply(THIS, []);}}; }; var Question = function(widget, pager, html) {var $root = $("<div>").html(html);this.$getRoot = function() {return $root;};this.getUrlParams = function() {return "";};this.isVotable = function() {return false;};this.ask = function() {widget.$getBody().append($root);};}; var RadioQuestion = function(widget, pager, html) {Question.apply(this, [widget, pager, html]);var $root = this.$getRoot();var $radio = $root.find("input[type='radio']");var $submit = $root.find("input[type='button'].submit");if (widget.getDeviceMode() == DMODE_MOBILE) {$submit = $submit.add($radio);}$submit.click(function() {pager.vote();});this.getUrlParams = function() {var $r = $radio.filter(":checked");return $r.length == 0
? ""
: $r.val();};this.isVotable = function() {return $radio.filter(":checked").length > 0;};}; var ResultsPage = function(widget, html, prevPage) {var THIS = this;this.prevPage = prevPage;this.nextPage = null;if (prevPage != null) {prevPage.nextPage = this;} else {ResultsPage.questionTotal = 0;}var $root = $("<div>").html(html);this.questionIndex = -1;(function() {if ($root.find(".question_text").length) {var p = prevPage;for ( ; p != null && p.questionIndex == -1; p = p.prevPage);if (p == null) {THIS.questionIndex = 1;} else {THIS.questionIndex = p.questionIndex + 1;}ResultsPage.questionTotal = THIS.questionIndex;}})();this.show = function() {widget.$getBody().empty().append($root);if (ResultsPage.questionTotal && this.questionIndex >= 0) {widget.setProgress(this.questionIndex, ResultsPage.questionTotal);} else {widget.setProgress(-1, -1);}};$root.find(".previous").click(function() {if (THIS.prevPage) {$root.detach();THIS.prevPage.show();}});$root.find(".next").click(function() {if (THIS.nextPage) {$root.detach();THIS.nextPage.show();} else {widget.restart();}});}; function ensureJQuery(callback) {if ($ == undefined || $.fn.jquery != JQUERY_VERSION) {(function() {var done = false;var s = document.createElement("script");s.src = "/" + "/ajax.googleapis.com/ajax/libs/jquery/" + JQUERY_VERSION + "/jquery.min.js";s.onload = s.onreadystatechange = function() {if (!done) {var r = this.readyState;if (!r || r == "complete" || r == "loaded") {done = true;$ = window.jQuery.noConflict(true);callback();}}};(document.getElementsByTagName('head')[0] || document.documentElement).appendChild(s);})();} else {callback();}}ensureJQuery(function() {$(document).ready(function() {var $container = $("#" + widgetElementId);if ($container.length) {$container.html(widgetHtml);widgetCallback(new Widget($container[0]));}});});});;init(
"83080ba5-9180-73e4-f59c-6a072f0c7cb9",
"<div class=\"civicscience ballotbox click\">\n    <div class=\"header\"><\/div>\n    <div class=\"poll_body\"><\/div>\n    <div class=\"progress_bar\"><\/div>\n    <div class=\"footer\"><\/div>\n<\/div>",
function(widget) {widget.isOptOutUser = false;widget.getQuestionsUrl = "https:\/\/www.civicscience.com\/widget\/jspoll\/getQuestions?tgt=2065&device=click";widget.run();});})();