if (typeof SvD == 'undefined') {
	var SvD = {};
}

if (typeof jQuery != 'undefined') {

	/*** Dagens Fråga-funktioner ***/
	SvD.poll = function ($) {

		var container;

		return  {

			init : function () {
				container = $("#pollcontainer");
				if (container.length === 0) { return; }
				this.animateBars();
				this.insertLinks();
			},
			animateBars : function () {
				container.find("span.bar").each(function() {
					var w = $(this).width();
					var wp = $(this).css("width");
					$(this).width(0).animate({width: w }, 500, function() {
						$(this).width(wp);
					});
				});
			},
			insertLinks : function () {
				var links = '<ul><li><a class="readmore" href="javascript:window.location.reload();">Uppdatera</a></li><li><a class="readmore" href="javascript:window.close();">Stäng fönstret</a></li></ul>';
				container.find("div.footer").append(links);
			}
		};
	}(jQuery);
}

if (typeof jQuery != 'undefined') {
	jQuery(document).ready(function() {
		SvD.poll.init();
	});
}
