//
// File: fbconnect_login.js
// Description: javascript functions for Harris Connect Facebook Connect Login
// 		This must be placed within the HEAD tag
//



//
// Function: facebook_onlogin
// If no destination passed in, go to default destination as coded
// Usually, this occurs when login page is called directly
//
function facebook_onlogin( destination ) {
	
	// we call My Page as the default
	// this destination can be overridden here
	//
	var defaultDestination = "/olc/membersonly/BUF/mypage.jsp";
	
	// we will go to the special Facebook page for Facebook Connect
	// to determine if user is linked or not
	//
	var redirectUrl = "http://apps.facebook.com/buffalo-alumni/connect-login.jsp";

	// initialize to the destination (url) that may have been passed in 
	//
	var theReferer = destination;

	// make sure we redirect to somewhere
	//
	if( theReferer == "")
		theReferer = defaultDestination;

	// now do the redirect to the special Facebook, passing the destination (referer) url
	//
	if (theReferer != "")
		redirectUrl = redirectUrl + "?referer=" + theReferer;
	else
		redirectUrl = redirectUrl + "?referer=" + "/olc/pub/BUF/login/loginsuccess.html";

	// do the actual redirect
	//
	location.href = redirectUrl;
}
