ShadyAsFuck BrainFuck converter

Converts between those two languages.

HTML

<textarea id="programSAF" style="width:100%;height:100px;border-width:1px;border-color:black;">insert SAF code</textarea>
<textarea id="programBF" style="width:100%;height:100px;border-width:1px;border-color:black;">insert BF code</textarea>
<!--
<textarea id="input" style="width:100%;height:100px;border-width:1px;border-color:black;">n/a</textarea>
<textarea id="output" style="width:100%;height:100px;border-width:1px;border-color:black;">n/a</textarea>
-->

JavaScript

setup();
function setup(){
	programSAF = document.getElementById("programSAF");
	programBF = document.getElementById("programBF");
	//input = document.getElementById("input");
	//output = document.getElementById("output");

	programSAF.onkeyup = function(){   
		programBF.value = table.SAF2BF(programSAF.value);
	};
	
	programBF.onkeyup = function(){
		programSAF.value = table.BF2SAF(programBF.value);
	};
}

var table = {
    tabarr:[['P','O','s','h','a','d','y','_','+'],
            ['0','M','A','S','f','u','c','k','-'],
            ['n','G','L','x','Y','p','Q','J','<'],
            ['g','m','o','R','1','e','U','2','>'],
            ['j','3','b','z','{','(','I','V','['],
            ['W','E','B','=',')','}','Z','T',']'],
            ['t','H','i','N','K','!',';','C',','],
            ['F','l','4','w','r','X','D',':','.']],
    
    keys: '+-<>[],. ',
    
    
    SAF2BFchar : function(chr){
        var i,j;
        for(i = 0; i < this.tabarr.length; i++){
        	for(j = 0; j < this.tabarr[0].length; j++){
            	if(this.tabarr[i][j] == chr){
					if(j==8){
						return this.keys[i];
					} else {
						return this.keys[i] + this.keys[j];
					}
                }
            }
        }
        return "";
    },
    
    SAF2BF : function(str){
		var outputBF="";
        for(var i=0;i<str.length;i++){
            outputBF += this.SAF2BFchar(str[i]);
        }
    	return outputBF;    
    },
	
	findBFindex: function(chr){
		var i=this.keys.indexOf(chr);
		if(i==8){i=-1;}
		return i;
	},
	
	BF2SAF : function(str){
		var k=0;
		var l=1;
		var outputSAF="";
		while(k<str.length){
			console.log("starting while "+l+","+k);
			while(k<str.length && this.findBFindex(str[k])==-1){k++};
			l=k+1;
			while(l<str.length && this.findBFindex(str[l])==-1){l++};
			
			if(k>=str.length){ //we processed the whole string
				break;
			} else { //k<str.length
				if (l>= str.length) { //there is just a single character left
					outputSAF += str[k];	
				} else { //we have...