Q:

facebook login and like button javascript conflicting

This Is Login javascript used here 
<script> logInWithFacebook = function() {
FB.login(function(response) {
  if (response.authResponse) {
    alert('You are logged in & cookie set!');
    // Now you can redirect the user or do an AJAX request to
    // a PHP script that grabs the signed request from the cookie.
  } else {
    alert('User cancelled login or did not fully authorize.');
  }
});
return false;
};
 window.fbAsyncInit = function() {
FB.init({
  appId: '1166049000075578',
  cookie: true, // This is important, it's not enabled by default
  version: 'v2.4'
});
};

(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
//Onclick for fb login
jQuery(document).ready(function($) {
$('#facebook1').click(function(e) {
FB.login(function(response) {
  if(response.authResponse) {
      parent.location ='Someurl'; //redirect uri after closing the facebook popup
  }
 },{scope:'email,public_profile,user_friends'}); //permissions for facebook
 });

 });</script>

Now this is the facbook Like button script used
<script>(function(d, s, id) {
 var js, fjs = d.getElementsByTagName(s)[0];
 if (d.getElementById(id)) return;
 js = d.createElement(s); js.id = id;
 js.src =    "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4&appId=1166049000075578   ";
 fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));</script>

The login script and the like button script both needs to be present on the same page if am only using like button javacript and html code then is working fine
But using both script(login and like) on a same page creating problem
The problem started when I upgraded to Facebook SDKv5 Website where it is used

A:

This set of code is repeated twice 
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src =    "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4&appId=1166049000075578   ";
fjs.parentNode.insertBefore(js, fjs);
(document, 'script', 'facebook-jssdk'));</script>

