window.onload = setFacebookLogin;

function setFacebookLogin() {
  jQuery('.facebook.login').click(function(e) {
      var domain = window.location.href.match(/:\/\/(.[^/]+)/)[1];
      var url = "https://www.facebook.com/dialog/oauth/?scope=user_checkins,read_stream,user_status,user_location,friends_location,email,user_birthday,user_interests,publish_stream,user_hometown,offline_access,user_photos&client_id=191925760824391&redirect_uri=http://www.ajungo.com/auth/facebook/callback&response_type=code&state=travel_show&display=popup";
      popupCenter(url, 600, 400, "authPopup");
      e.preventDefault();
  });
}

function popupCenter(url, width, height, name) {
  var left = (screen.width/2)-(width/2);
  var top = (screen.height/2)-(height/2);
  return window.open(url, name, "menubar=no,toolbar=no,status=no,width="+width+",height="+height+",toolbar=no,left="+left+",top="+top);
}
