function fmrlogin() {
	$.ajax({
		url: '/src/service/fmrauthsession.php',
		data: "Login=1&Email=" + $('input#LoginEmail').val() + "&Password=" + $('input#LoginPass').val() + "&returnUrl=" + $('input#ReturnURL').val(),
		type: "POST",
		success: function(rc) {
			errorMatch = new RegExp("^error:");
			if (rc.match(errorMatch)) {
				$('#LoginError').html(rc);
			} else {
				window.location = rc;
			}
		}
	});
}

function popAndDim(id, pop) {
	if (pop) {
		$('#' + id).show();
		$('#SuperWrap').addClass('dim');
	} else {
		$('#' + id).hide();
		$('#SuperWrap').removeClass('dim');
	}
	return false;
}

function hideAndRemember(divId) {
	$("#" + divId).hide("normal");
	setCookie('hide_' + divId, '1', 6, '', '', '');
}

function setCookie(name, value, expires, path, domain, secure) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	if (expires) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function bookmarkpage(title, url) {
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}