
function login(current)
{
	if(!current)
		current = window.location.href;

	var attributes = "alwaysRaised=yes,\
					  screenX=100,\
					  left=100,\
					  screenY=100,\
					  top=100,\
					  width=300,\
					  height=250,\
					  resizable=no,\
					  titlebar=no,\
					  status=yes";
	var title = "Login";
	var loginWindow = window.open("https://secure.computer.org/persagen/doLogin.jsp?location=" + current, title, attributes);
	loginWindow.focus();
}

function logout()
{
	var current = window.location.href;
	var home = current.substring(0, current.indexOf("/ana/") + 5);
	window.location.href = "http://csdl2.computer.org/persagen/logout/doLogout.jsp?location=" + home;
}

function isLoggedIn() {
	return (hasCookie("LDAP_SN") && hasCookie("LDAP_CN"));
}

function hasCookie(cookieName) {
	if (document.cookie.length > 0)
		return (document.cookie.indexOf(cookieName) > -1);
	else
		return false;
}
