﻿
var Authentication = new Class({

	initialize: function(site) {
		this.site = site;
	},

	LogOut: function() {

		this.http = new Request({
			method: 'post',
			url: 'Handlers/AuthenticationHandler.ashx',
			data: 'method=LogOut',
			onSuccess: this.LogOutSucceeded.bind(this),
			onFailure: this.LogOutFailed.bind(this)
		}).send();
	},

	LogOutSucceeded: function() {

		var reply = this.http.response.text;
		if (reply == "OK") {
			document.location.href = this.site;
		}
		else {
			alert("Error contacting server");
		}
	},

	LogOutFailed: function() {
		alert('LogOutFailed');
	}
});