<div id="fb-root">
    {% if is_https %}<script src="https://connect.facebook.net/en_US/all.js"></script>{% else %}<script src="http://connect.facebook.net/en_US/all.js"></script>{% endif %}
</div>
<script>
  // initialize the library with the API key
  FB.init({ apiKey: '{{ facebook_api_key }}', status: true, cookie: true, xfbml: true});

  function facebookConnect(form){
      function handleResponse(response){
          form.submit();
      }
      FB.login(handleResponse/*,{perms:'publish_stream,sms,offline_access,email,read_stream,status_update,etc'}*/);
  }

</script>

<div id="fb-root">
    {% if is_https %}
	<script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script>
	{% else %}
	<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
	{% endif %}
</div>
<script type="text/javascript" >
  // initialize the library with the API key
  FB.init({ apiKey: '{{ facebook_api_key }}', status: true, cookie: true, xfbml: true});

  function facebookConnect(form){
      function handleResponse(response){
          form.submit();
      }
      FB.login(handleResponse/*,{perms:'publish_stream,sms,offline_access,email,read_stream,status_update,etc'}*/);
  }

</script>

Correct script tags for Facebook JS
Correct script tags for Facebook JS
