document.write('<style type=\'text/css\'>\n.pe_multiple_choice_poll_92595.peWidget table, .pe_multiple_choice_poll_92595.peWidget caption, .pe_multiple_choice_poll_92595.peWidget tbody, .pe_multiple_choice_poll_92595.peWidget tfoot, .pe_multiple_choice_poll_92595.peWidget thead, .pe_multiple_choice_poll_92595.peWidget tr, .pe_multiple_choice_poll_92595.peWidget th, .pe_multiple_choice_poll_92595.peWidget td {\n	margin: 0;\n	padding: 0;\n	border: 0;\n	outline: 0;\n	font-size: 100%;\n	vertical-align: baseline;\n	background: transparent;\n}\n.pe_multiple_choice_poll_92595.peWidget table{\n  border-collapse: collapse;\n	border-spacing: 0;\n}\n.pe_multiple_choice_poll_92595.peWidget{\n  background: #ffffff;\n  color: #000000;\n  font-family: \'Lucida Grande\', \'Lucida Sans Unicode\', \'sans-serif\';\n  padding: 0;\n  margin: 0;\n  width: 300px;\n}\n  .pe_multiple_choice_poll_92595.peWidget a{\n    color: #3399ff;\n  }\n  .pe_multiple_choice_poll_92595 img, .pe_multiple_choice_poll_92595 div{\n    padding: 0;\n    margin: 0;\n  }\n  .pe_multiple_choice_poll_92595.peWidget table{\n    border: none;\n  }\n  .pe_multiple_choice_poll_92595.peWidget td{\n    padding: 0;\n    border: none;\n  }\n  \n  .pe_multiple_choice_poll_92595.peWidget .peDialog{\n    padding: 1em;\n    border: none;\n    line-height: 1.5em;\n  }\n  \n  .pe_multiple_choice_poll_92595.peWidget .peHeader{}\n    .pe_multiple_choice_poll_92595.peWidget .peHeader .peTitle{\n      font-size: 1.2em;\n      font-weight: bold;\n      padding: 1em 1em 0;\n      text-align: center;\n    }\n    .pe_multiple_choice_poll_92595.peWidget .peHeader .peStatus{\n      text-align: center;\n      padding-top: 1em;\n      font-size: 0.9em;\n    }\n  .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peBody{}\n    .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peOptions {\n      padding: 1em 0;\n    }\n      .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peOptions .peOption{\n        padding: 1em; \n      }\n      .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peOptions a.peOption {\n        display: block;\n        color: #3399ff;\n      }\n      .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peOptions a.peOption:hover{\n        background: #3399ff;\n        color: #ffffff;\n      }\n  .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peChart{\n    padding: 1em;\n  }\n    .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peChart table{\n      width: 100%;\n    }\n    .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peChart table tr td{\n      vertical-align: middle;\n      padding: 0.5em 0.25em;\n    }\n    .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peChart .peChartBar{\n      background: #3399ff;\n      color: #ffffff;\n      padding: 0.75em 0.25em;\n      -moz-border-radius: 0.25em;\n      -webkit-border-radius: 0.25em;\n    }\n    .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peChart .peChartBar{\n      background: #3399ff;\n      color: #ffffff;\n      padding: 0.75em 0.25em;\n    }\n    .pe_multiple_choice_poll_92595.peWidget .peMultipleChoicePoll .peChart .peChartBar.peChartBlankBar{\n      background: #ffffff;\n      color: #3399ff;\n    }\n  .pe_multiple_choice_poll_92595.peWidget.peBranded{\n    border: 3px solid #036;\n  }\n  .pe_multiple_choice_poll_92595.peWidget.peBranded .peBranding{\n    background: #036;\n    text-align: center;\n    padding: 5px;\n  }\n  .pe_multiple_choice_poll_92595.peWidget.peBranded .peBranding a img{\n    border: 0;\n  }\n<\/style>\n<iframe height=\'0\' src=\'http://www.polleverywhere.com/sessions/MTI3MTM1MzIx.hapi\' style=\'visibility: hidden;\' width=\'0\'><\/iframe>\n<div class=\'peBranded peWidget pe_multiple_choice_poll_92595\' id=\'pe_multiple_choice_poll_92595\'>\n<div class=\'peClosed peMultipleChoicePoll\'>\n<div class=\'peHeader\'>\n<div class=\'peTitle\'>Las competencias docentes<\/div>\n<div class=\'peStatus\' style=\'display: none;\'><\/div>\n<\/div>\n<div class=\'peBody\'>\n<div class=\'peDisabled\'>\n<div class=\'peOptions\'>\n<div class=\'peOption\'>\nDeben ir orientadas al uso de TIC en el aula\n<\/div>\n<div class=\'peOption\'>\nDeben orientarse al uso del web\n<\/div>\n<div class=\'peOption\'>\nLas dos anteriores\n<\/div>\n<\/div>\n<\/div>\n<div class=\'peVote\' style=\'display: none;\'>\n<div class=\'peOptions\'>\n<a class=\'peOption\' data-answer-id=\'277697\' href=\'#\'>\nDeben ir orientadas al uso de TIC en el aula\n<\/a>\n<a class=\'peOption\' data-answer-id=\'277698\' href=\'#\'>\nDeben orientarse al uso del web\n<\/a>\n<a class=\'peOption\' data-answer-id=\'277699\' href=\'#\'>\nLas dos anteriores\n<\/a>\n<\/div>\n<\/div>\n<div class=\'peChart\' style=\'display: none;\'>\n<div class=\'peChartPlotArea\'>\n<table>\n<colgroup class=\'peValue\'><\/colgroup>\n<colgroup class=\'peResponses\' style=\'width: 100%;\'><\/colgroup>\n<thead style=\'display:none;\'>\n<tr>\n<th>Value<\/th>\n<th>Responses<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\nDeben ir orientadas al uso de TIC en el aula\n<\/td>\n<td>\n<div class=\'peChartBar peChartBlankBar\' style=\'width: 0%;\'>\n<div class=\'peChartDataLabel\'>\n0%\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td>\nDeben orientarse al uso del web\n<\/td>\n<td>\n<div class=\'peChartBar peChartBlankBar\' style=\'width: 0%;\'>\n<div class=\'peChartDataLabel\'>\n0%\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td>\nLas dos anteriores\n<\/td>\n<td>\n<div class=\'peChartBar peChartBlankBar\' style=\'width: 0%;\'>\n<div class=\'peChartDataLabel\'>\n0%\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n<\/div>\n<div class=\'peMaxedOut\' style=\'display: none;\'>\n<div class=\'peDialog\'>This poll has received that maximum number of votes.<\/div>\n<\/div>\n<div class=\'peEnableWeb\' style=\'display: none;\'>\n<div class=\'peDialog\'>\nWeb voting is currently disabled for this poll. If you created this poll,\n<a href=\"http://www.polleverywhere.com/multiple_choice_polls/MTI3MTM1MzIx/edit\">enable web voting<\/a>,\nthen refresh this page.\n<\/div>\n<\/div>\n<div class=\'peStopped\' style=\'display: none;\'>\n<div class=\'peDialog\'>\nThis poll is stopped and not accepting responses. If you created this poll,\n<a href=\"http://www.polleverywhere.com/multiple_choice_polls/MTI3MTM1MzIx\">start the poll<\/a>,\nthen refresh this page.\n<\/div>\n<\/div>\n<\/div>\n<div class=\'peFooter\'>\n<div class=\'peBranding\'>\n<a href=\"http://www.polleverywhere.com/\" alt=\"Poll Everywhere was used to create this poll.\" target=\"_parent\" title=\"Poll Everywhere was used to create this poll.\"><img alt=\"Logo_widget\" src=\"http://www.polleverywhere.com/images/logo_widget.gif\" /><\/a>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n');
/* Load javascript in 'harsh' environments like third party websites, etc.

scripts('http://www.google.com/script.js').include(function(){
  Do some stuff here w/ this callback
}); 

*/

(function(fun){
  
  // Loads one external javascript and fires off a few callbacks x-browser
  var script = function script(src, options){
    if(options.loading) { options.loading.call(this); }
    var el = document.createElement("script");
    el.setAttribute("type", "text/javascript");
    el.setAttribute("src", src);
    if(options.loaded) {
      el.onload = options.loaded;           // FF, Safari, & Modern browsers.
      el.onreadystatechange = function() {  // IE
        if (this.readyState === 'loaded') {
          options.loaded();
        }
      };
    }
    document.getElementsByTagName("head")[0].appendChild(el);
    return el;
  };
  
  // Manages the loading of multiple scripts and takes care of potential
  // race conditions.
  var scripts = function scripts(src){
    
    // We're gonna hang a global off of window for other widgets that might
    // be loading up the same js in the window.
    var global = (function global(){
      if(typeof window.sandBox === 'undefined'){
        window.sandBox = {
          scripts: {}
        };
      }
      return window.sandBox.scripts;
    })();
    
    var scriptController = function(src){
      var callbacks = [];
      var loaded = false;
      
      script(src, {
        loaded: function(){
          loaded = true;
          for(i = 0; i < callbacks.length; i++){
            callbacks[i].call();
          }
        }
      });
      
      return {
        include: function(callback){
          if(loaded){
            callback.call();
          }
          else{
            callbacks.push(callback);
          }
        }
      };
    };
    
    // Initialize a stinkin' script in the glob
    if (typeof global[src] === 'undefined') {
      global[src] = scriptController(src); 
    }
    
    return global[src];
  };
  
  var sandBox = {
    js: {
      include: function(src, apply, closure){
        if(!closure) {
          closure = apply;
          apply = null;
        }
        
        scripts(src).include(function(){
          if(apply){
            apply(closure);
          }
          else{
            closure();
          }
        });
      }
    }
  };
  
  fun(sandBox);
  
})(function($sb){
  
  $sb.js.include("http://www.polleverywhere.com/javascripts/jquery-1.4.2.min.js", function(closure){ 
    closure(jQuery.noConflict());
  }, function($){
    $sb.js.include('http://www.polleverywhere.com/javascripts/jquery.polleverywhere.js', function(){

      var poll_permalink = "MTI3MTM1MzIx";

      var poll = $.pe.polls.mcp('http://www.polleverywhere.com/multiple_choice_polls/MTI3MTM1MzIx',{
        data: {"type":"multiple_choice_poll","web_enabled":false,"mobile_site":"http://poll4.com","shortcode":null,"direct_enabled":false,"session_keyword":null,"sms_enabled":true,"options":[{"results_percentage":"0","value":"Deben ir orientadas al uso de TIC en el aula","keyword":null,"id":277697,"results_count":0},{"results_percentage":"0","value":"Deben orientarse al uso del web","keyword":null,"id":277698,"results_count":0},{"results_percentage":"0","value":"Las dos anteriores","keyword":null,"id":277699,"results_count":0}],"flash_options":{"chartLabelScale":0.65,"headerScale":0.65,"IsDefault":{"headerScale":false,"chartLabelScale":false,"IsDefault":true,"headerLogoUrl":false,"bgImageOpacity":false,"chartType":false,"messageBGColor":false,"leaderboardLength":false,"chartBarColor":false,"rememberToken":false,"headerBGColorTop":false,"headerTitleColor":false,"showInstructions":false,"chartKeywordColor":false,"displayMode":false,"headerInstructionColor":false,"headerLogoPlacement":false,"messageShowShadow":false,"bgPrimaryTextColor":false,"bgImageUrl":false,"bgColor":false,"bgImagePlacement":false,"showPercentages":false,"onlyShowPercent":false,"bgSecondaryTextColor":false,"headerInstructionScale":false,"showTitle":false,"showKeywords":false,"leaderboard":false,"chartPrimaryTextColor":false,"headerBGColorBottom":false,"showLogo":false},"bgImageOpacity":1.0,"headerLogoUrl":"","chartType":"bar","rememberToken":"","chartBarColor":7525,"leaderboardLength":-1,"messageBGColor":16185078,"chartKeywordColor":0,"showInstructions":true,"headerTitleColor":7525,"headerBGColorTop":16777215,"displayMode":"barchart","messageShowShadow":true,"headerLogoPlacement":"left","headerInstructionColor":0,"bgImageUrl":"","bgPrimaryTextColor":7525,"onlyShowPercent":false,"showPercentages":true,"bgImagePlacement":"centered","bgColor":16777215,"chartPrimaryTextColor":7525,"leaderboard":false,"showKeywords":true,"showTitle":true,"headerInstructionScale":1.0,"bgSecondaryTextColor":0,"showLogo":true,"headerBGColorBottom":16777215},"show_branding":true,"title":"Las competencias docentes","twitter_enabled":false,"max_votes":1,"permalink":"MTI3MTM1MzIx","twitter_keyword":"@poll","state":"closed","question":"Las competencias docentes","results_count":0,"participation_verb":"vote"}
      });


      poll.alreadyVoted = function() {
        return (document.cookie.indexOf('__pe_' + poll_permalink) !== -1);
      };
      
      poll.setAsVoted = function() {
        var expiresAt = new Date();
        expiresAt.setDate(expiresAt.getDate() + 365);
        document.cookie = '__pe_' + poll_permalink + '=true; expires=' + expiresAt.toUTCString() + '; path=/';
      }
      
      // Grab the widget and add some randomness at the end of the ID 
      // so the page can support multiple instances of a widget
      var widget = (function widget(){
        var el = $('#pe_multiple_choice_poll_92595');
        return el.attr("id", el.attr("id") + '_' + Math.random()*9999);
      })();
      
      widget.updateChart = function(data) {
        widget.find('.peChart').html(data);
      };
      
      widget.installHandlers = function() {
        $('#' + poll_permalink + '_results').unbind("click");
        $('#' + poll_permalink + '_vote').unbind("click");
        
        $('#' + poll_permalink + '_results').click(function(e) {
          e.preventDefault();
          var link = $(widget.find('.peStatus a'));
          link.text('Vote again');
          link.attr('id', poll_permalink + '_vote');
          widgetController.action('chart');
          setTimeout(function () { widget.installHandlers(); }, 130); 
          return false;
        });
        $('#' + poll_permalink + '_vote').click(function(e) {
          e.preventDefault();
          var link = $(widget.find('.peStatus a'));
          link.text('View results');
          link.attr('id', poll_permalink + '_results');
          widgetController.action("vote");
          setTimeout(function () { widget.installHandlers(); }, 130); 
          return false;
        });
      };
      
      var notice = function(message){
        var el = $(widget).find('.peStatus').get().pop();
        
        if(message && message.length > 0){
          $(el).show().html(message);
        }
        else{
          $(el).hide();
        }
      };
      
      var controller = function(actions){
        var hide = function hide(action){
          (action.hide) && (action.hide.call(action.view));
          action.view.hide();
        };
        
        var show = function show(action){
          (action.show) && (action.show.call(action.view));
          action.view.show();
        };
        
        var action = function action(action){
          $.each(actions, function(a){
            (action === a) ? show(actions[a]) : hide(actions[a]);
          });
        };
        
        return {
          actions: actions,
          action: action
        };
      };
      
      var widgetController = controller({
        chart: {
          view: widget.find('.peChart'),
          show: function() {
            if (poll.acceptsMultipleResponses() && poll.alreadyVoted()) {
              notice('<a href="#" id="'+poll_permalink+'_vote">Vote again</a>');
              setTimeout(function () { widget.installHandlers(); }, 130); 
            }
          }
        },
        vote: {
          view: widget.find('.peVote'),
          show: function(){
            $(this).find('.peOption').unbind('click');
            $(this).find('.peOption').click(function(e){
              e.preventDefault();
              poll.vote($(this).attr('data-answer-id'), {
                success: function(){
                  widget.updateChart(this.view);
                  widgetController.action('chart');
                  var noticeText = 'You chose ' + this.result.value;
                  if (poll.acceptsMultipleResponses()) {
                    noticeText += '<br><a href="#" id="'+poll_permalink+'_vote">Vote again</a>';
                  }
                  notice(noticeText);
                  setTimeout(function () { widget.installHandlers(); }, 130); 
                  poll.setAsVoted();
                },
                error: function(){
                  notice(this.errors.pop());
                }
              });
              return true;
            });
          },
          hide: function(){}
        },
        maxed_out: {
          view: widget.find('.peMaxedOut')
        },
        disabled: {
          view: widget.find('.peDisabled')
        },
        stopped: {
          view: widget.find('.peStopped')
        },
        enable_web: {
          view: widget.find('.peEnableWeb')
        }
      });
      // Initialize the correct state of the widget.

      if (poll.alreadyVoted()) {
        widgetController.action('chart');
      } else {
        switch(poll.state()){
          case 'opened':
            widgetController.action(poll.webEnabled() ? 'vote' : 'enable_web');
            break;
          case 'closed':
            widgetController.action('stopped');
            break;
          case 'maxed_out':
            widgetController.action('maxed_out');
            break;
        }
      }


    });
  });

});