//default javascript for pages

//anti-spam-scraper email JS function
function email(address, text, domain) {
	switch (arguments.length) {
		case 0:
			console.error("0 arguments to email function.");
			break;
		case 1:
			document.write('<a href="mailto:' + address + '@brandeis.edu">'
				+ address + '@brandeis.edu' + '<\a>');
			break;
		case 2:
			document.write('<a href="mailto:' + address + '@brandeis.edu">'
				+ text + '<\a>');
			break;
		case 3:
			document.write('<a href="mailto:' + address + '@' + domain + '">'
				+ text + '<\a>');
			break;
		default:
			console.error("Too many arguments to email function.");
			break;
	}
}

$(document).ready(function () {
	//login prompt (MUST MAKE THIS ACCESSIBLE TO NON-JS)
	$("#login-link").click(function () {
	    // Prompt user for the password ...
    	var pwd = prompt("Please enter your password:","");
    	// ... then set the browser location.
    	if (pwd) {
       		location.href = "http://people.brandeis.edu/~proscenium/?p=" + encodeURIComponent(pwd) + ".html";
       	}
		return false;
    });


});