// 小さい“つ”が消えるマシーン JavaScript版

new function(){

	function addEvent(elm, evType, fn, useCapture) {
		if (elm.addEventListener) {
			elm.addEventListener(evType, fn, useCapture);
			return true;
		}
		else if (elm.attachEvent) {
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		}
		else {
			elm['on' + evType] = fn;
		}
	}

	function update_tu(){
		var input = document.getElementById("tu_input");
		var output = document.getElementById("tu_output");

		var text_in = input.value;
		var text_out = "";
		var i=0;
		for (i = 0; i < text_in.length; i++) {
			if( text_in.charAt(i).match(/っ|ッ/) == null ){
				text_out += text_in.charAt(i);
			}
		}
		
		output.value = text_out;
	}
	
	addEvent(window,"load",function(){ 
		var input = document.getElementById("tu_input");
		addEvent(input,"keyup",update_tu);
	});
	
}
