function Spinner(id) {
	this.id = id;
	this.browser = this.getBrowser();
	this.windowSize = this.getWindowSize();
	this.css = {
		position: "absolute",
		width: "136px",
		height: "136px",
		background: "url('/memo/img/spinner.gif') #fff no-repeat 20px 20px",
		border: "1px dotted #f90"
	};
	this.center = this.getCenter();
}

// $B%V%i%&%6$N<oN`$r<hF@(B
Spinner.prototype.getBrowser = function() {
	var str = navigator.appName;
	// Netscape, Firefox, Safari
	if (str.match(/netscape/i)) { return "ns"; }
	// Internet Explorer
	else if (str.match(/explorer/i)) { return "ie"; }
	// Opera
	else if (str.match(/opera/i)) { return "op"; }
	else { return false; }
}

Spinner.prototype.getWindowSize = function() {
	switch(this.browser) {
		case "ns":
			return { width: window.innerWidth, height: window.innerHeight };
			break;
		case "ie":
			return { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };
			break;
		case "op":
			return { width: document.body.clientWidth, height: document.body.clientHeight };
			break;
		default:
			break;
	}
}

Spinner.prototype.getCenter = function() {
	return { width: this.windowSize.width >> 1, height: this.windowSize.height >> 1 }
}

Spinner.prototype.getSpinner = function() {
	var spinner = document.createElement("div");
	spinner.setAttribute("id", this.id);
	spinner.style.position = this.css.position;
	spinner.style.left = parseInt(this.center.width) - (parseInt(this.css.width) >> 1) + "px";
	spinner.style.top = parseInt(this.center.height) - (parseInt(this.css.height) >> 1) + "px";
	spinner.style.width = this.css.width;
	spinner.style.height = this.css.height;
	spinner.style.background = this.css.background;
	spinner.style.border = this.css.border;

	return spinner;
}
