// tyny chat script for gal_tonkatsu

log = "";
dataSave();

function dataSave()
{
    log = document.fm1.word.value;

 document.getElementById("strID").innerHTML = log;

var pars = 'log=' + log;

		var myAjax = new Ajax.Updater(
			'strID', 
			'log.php', 
			{
				method: 'post', 
				parameters: pars
			});

    document.fm1.word.value = "";
}

//window.document.onkeydown = dataSave;

//firefox

document.onkeydown = new Function("e", "return keycheck(e,'fm1'.target)");

function keycheck(e,tgt) {
var execEvt = true;

try{
if (e.keyCode == 13) {
dataSave();
return false;
}
}catch(e){
//IE
if (event.keyCode == 13){
dataSave();
    }
}

if (execEvt ) return true;
if (e.cancelable) { e.preventDefault(); }
e.stopPropagation();
return false;
}
