function showtag(id1) {
	opener.document.getElementById('infotext').style.display = 'none';
	var charList="0123456789abcdefghijklmnopqrstuvwxyz";

	var v1 = document.getElementById('row'+id1).value;
	var l1 = v1.length;
	var htmtext = '';
	for(i=0; i<l1; i++) {
		var v2 = v1.substr(i,1);
		var v3 = charList.indexOf(v2);
		if(v3 >= 0) htmtext += '<img src="images/tags/'+v2+'.jpg" width="8" height="12">';
		else htmtext += '<img src="images/tags/'+jpgRef(v2)+'.jpg" width="8" height="12">';
	}
	 document.getElementById('text'+id1).innerHTML = htmtext;
	 opener.document.getElementById('text'+id1).innerHTML = htmtext;
	 opener.document.getElementById('htext'+id1).value = v1;
}

function ch_align(id1, id2) {
		if(id2 == 'L') {
			document.getElementById('text'+id1).className='spec';
			opener.document.getElementById('text'+id1).className = 'spec';
			opener.document.getElementById('align'+id1).value=id2;
		} else if(id2 == 'C') {
			document.getElementById('text'+id1).className='spec1';
			opener.document.getElementById('text'+id1).className = 'spec1';
			opener.document.getElementById('align'+id1).value=id2;
		} else if(id2 == 'R') {
			document.getElementById('text'+id1).className='spec2';
			opener.document.getElementById('text'+id1).className = 'spec2';
			opener.document.getElementById('align'+id1).value=id2;
		}

		/*if(opener.document.getElementById('row'+id1).value != '') opener.document.getElementById('align'+id1).value=id2;*/
}

function closeme() {
	for(i=1; i<=5; i++) {
		m1 = opener.document.getElementById('align'+i).value;
		m2 = opener.document.getElementById('htext'+i).value;
		if((m1 == '') && (m2 != '')) opener.document.getElementById('align'+i).value = 'L';
	}
	self.close();
}

function jpgRef(c) { 
  var inChar = c.toString();
  inChar = inChar.toUpperCase();
  if (inChar == " ")  { return "sp";     } 
  if (inChar == "_")  { return "under";  } 
  if (inChar == "-")  { return "dash";   } 
  if (inChar == "\"") { return "quote";  }
  if (inChar == "\(") { return "lparen"; }
  if (inChar == "\)") { return "rparen"; }
  if (inChar == "\^") { return "up";     }
  if (inChar == "\<") { return "lkarot"; }
  if (inChar == "\>") { return "rkarot"; }
  if (inChar == "\*") { return "star";   }
  if (inChar == "\?") { return "ques";   }
  if (inChar == "\#") { return "hash";   }
  if (inChar == "\'") { return "apos";   } 
  if (inChar == "\&") { return "amp";    } 
  if (inChar == "\@") { return "at";     } 
  if (inChar == "\!") { return "bang";   } 
  if (inChar == "\%") { return "percent";} 
  if (inChar == "\$") { return "dollar"; } 
  if (inChar == "\/") { return "slash";  } 
  if (inChar == "\:") { return "colon";  } 
  if (inChar == "\;") { return "semi";   } 
  if (inChar == "\+") { return "plus";   } 
  if (inChar == "\=") { return "equal";  } 
  if (inChar == "\.") { return "dot";    } 
  if (inChar == "\,") { return "comma";  } 
  if (validChar(inChar)) { return inChar.toLowerCase(); }
  return "sp";
}

function validChar(inChar) {
  var charList="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  var inChar = inChar.toString();
  inChar = inChar.toUpperCase();
  var cindex = charList.indexOf(inChar);
  if (cindex>=0) { return true; }
  return false;
}
function gethtml1(v1, lcr, id1) {
	document.getElementById('infotext').style.display = 'none';
	var charList="0123456789abcdefghijklmnopqrstuvwxyz";
	var htmtext = '';

	for(i=0; i<v1.length; i++) {
		var v2 = v1.substr(i,1);
		if(charList.indexOf(v2) >= 0) htmtext += '<img src="images/tags/'+v2+'.jpg" width="8" height="12">';
		else htmtext += '<img src="images/tags/'+jpgRef(v2)+'.jpg" width="8" height="12">';
	}
	if(lcr == 'L') document.getElementById(id1).className='spec';
	else if(lcr == 'C')	document.getElementById(id1).className='spec1';
	else if(lcr == 'R') document.getElementById(id1).className='spec2';
	
	document.getElementById(id1).innerHTML = htmtext;
	return;
}

function gethtml12(v1, lcr, id1) {
	var charList="0123456789abcdefghijklmnopqrstuvwxyz";
	var htmtext = '';
	for(i=0; i<v1.length; i++) {
		var v2 = v1.substr(i,1);
		if(charList.indexOf(v2) >= 0) htmtext += '<img src="../images/tags/'+v2+'.jpg" width="8" height="12">';
		else htmtext += '<img src="../images/tags/'+jpgRef(v2)+'.jpg" width="8" height="12">';
	}
	if(lcr == 'L') document.getElementById(id1).className='spec';
	else if(lcr == 'C')	document.getElementById(id1).className='spec1';
	else if(lcr == 'R') document.getElementById(id1).className='spec2';
	
	document.getElementById(id1).innerHTML = htmtext;
	return;
}

function ckradio() {
	if(opener.document.getElementById('tags2').checked == true) 
		document.getElementById('radios').style.display = 'none';
}

function toggles() {
	if(document.getElementById('2tag').checked == true) {
		document.getElementById('tag1').style.display = 'none';
		document.getElementById('tag3').style.display = 'none';
		document.getElementById('tag2').style.display = '';
		document.getElementById('tag4').style.display = '';
	}
	else if(document.getElementById('1tag').checked == true) {
		document.getElementById('tag2').style.display = 'none';
		document.getElementById('tag4').style.display = 'none';
		document.getElementById('tag1').style.display = '';
		document.getElementById('tag3').style.display = '';
	}
}