
/*
 Basic operation
---------------------------------------------------------------------- */
window.onload = function() {
	var objForm;
	var i;


	//Delete focus for anchor
	objForm = document.getElementsByTagName('a');
	for (i=0 ; i<objForm.length ; i++) objForm[i].onfocus = function() {this.blur();}


	//Delete focus
	//Text all select
	objForm = document.getElementsByTagName('input');
	for (i=0 ; i<objForm.length ; i++) {
		switch (objForm[i].type) {
			case 'text':     objForm[i].onfocus = function() {this.select();};break;
			case 'password': objForm[i].onfocus = function() {this.select();};break;
			case 'checkbox': objForm[i].onfocus = function() {this.blur();};break;
			case 'radio':    objForm[i].onfocus = function() {this.blur();};break;
			case 'button':
				objForm[i].onfocus     = function() {this.blur();};
				objForm[i].onmouseover = function() {this.className = this.className.replace(/_a/, '_b');}
				objForm[i].onmouseout  = function() {this.className = this.className.replace(/_b/, '_a');}
				break;
			case 'submit':
				objForm[i].onfocus     = function() {this.blur();};
				objForm[i].onmouseover = function() {this.className = this.className.replace(/_a/, '_b');}
				objForm[i].onmouseout  = function() {this.className = this.className.replace(/_b/, '_a');}
				break;
			case 'reset':
				objForm[i].onfocus     = function() {this.blur();};
				objForm[i].onmouseover = function() {this.className = this.className.replace(/_a/, '_b');}
				objForm[i].onmouseout  = function() {this.className = this.className.replace(/_b/, '_a');}
				break;
			default: break;
		}
	}
	objForm = document.getElementsByTagName('textarea');
	for (i=0 ; i<objForm.length ; i++) {
		objForm[i].onfocus = function() {this.select();};
	}
}


/*
 Open window
---------------------------------------------------------------------- */
function show_window(url, name, width, height) {
	//Get center point
	var x = (screen.width  - width)  / 2;
	var y = (screen.height - height) / 2;

	//Open
	window.open(url, name, 'width=' + width + ', height=' + height + ', left=' + x + ', top=' + y + ', scrollbars=yes', 'replace=false')
}


/*
 Check password
---------------------------------------------------------------------- */
function check_password(target_01, target_02, button) {
	if (target_01.value == target_02.value) {
		if ((!target_01.value) || (!target_02.value)) {
			button.disabled = true;
			button.className = 'button_02_c';
		} else {
			button.disabled = false;
			button.className = 'button_02_a';
		}
	} else {
		button.disabled = true;
		button.className = 'button_02_c';
	}
}


/*
 Reset form
---------------------------------------------------------------------- */
function reset_contact() {
	document.getElementById('f_01').value = '';
	document.getElementById('f_02').value = '';
	document.getElementById('f_03').value = '';
	document.getElementById('f_04').value = '';
	document.getElementById('f_05').value = '';
}
