var code=-1;
var pcode=-1;


function getkey(){
	pcode=code;
	code=event.keyCode;
	//document.getElementById('str').innerHTML="KeyCode:"+code+"["+event.keyCode+"]";
	return code;
}
function getkeyex(kc){
	pcode=code;
	code=kc;
	//document.getElementById('str').innerHTML="KeyCode:"+code+"["+kc+"]";
	return code;
}
function delkey(){
	pcode=code;
	code=-1;
	//document.getElementById('str').innerHTML="KeyCode:"+code+"["+event.keyCode+"]";
	return code;
}

function setimg(id,src){
	document.getElementById(id).src=src;
	return true;
}

function initcv(mode){
	var ctx=new Canvas('buf',480,320,'2d');
	if(!ctx){
		return false;
	}
	ctx.beginPath();
	ctx.fillStyle='#ffffff';
	ctx.strokeStyle='#000000';
	if(mode){
		ctx.fillStyle='#000000';
		ctx.strokeStyle='#ffffff';
	}
	ctx.fillRect(0, 0, 480, 320);
	
	return ctx;
}
