// JavaScript Document

var LoginBox, LoginForm, LoginBtn, handle;

LoginBox = document.getElementById('LoginBox');
LoginForm = document.getElementById('LoginForm');
LoginSubmit = document.getElementById('LoginSubmit');

if (LoginBox) {
	LoginBox.inputs = LoginBox.getElementsByTagName('INPUT');

	if (LoginBox.inputs) for (i=0; i < LoginBox.inputs.length; i++) {
		handle = LoginBox.inputs.item(i);
		if (handle.className!='txt') continue;
		handle.value = '';
		
		handle.onfocus = function() {
			this.select();
			if (!this.parentNode.className.match(/edit|focus/)) this.parentNode.className += ' focus';
		}
		
		handle.onkeydown = function(event) {
			if (isIE) event = window.event;
			if (event.keyCode == 27) {
				LoginBox_reset(this);
				window.focus();
			}
		}
		
		handle.onkeyup = function() {
			this.parentNode.className = (this.value)? this.parentNode.className.replace(/focus/,'edit') : this.parentNode.className.replace(/edit/,'focus');
		}
		
		handle.onblur = function() {
			if (this.value == '') {
				this.parentNode.className = this.parentNode.className.replace(/\sfocus|\sedit/,'');
			}
		}
		
	}
}

LoginBox_reset = function(obj) {
	obj.form.reset();
	obj.form.elements.L1.parentNode.className = obj.form.elements.L1.parentNode.className.replace(/\sfocus|\sedit/,'');
	obj.form.elements.L2.parentNode.className = obj.form.elements.L2.parentNode.className.replace(/\sfocus|\sedit/,'');
}



LoginBtn = document.getElementById('LoginBtn');

if (LoginBtn) {
	LoginBtn.onclick = function() {
		this.blur();
		return false;
	}
	LoginBtn.onmousedown = function() {
		this.className = 'ovr';
	}
	LoginBtn.onmouseup = function() {
		this.className = '';
	}
	LoginBtn.onmouseout = function() {
		this.className = '';
	}
}



