var textname='hebname';
	
	function hide(x) {
			document.getElementById(x).style.display='none';}
		function show(x) {
			document.getElementById(x).style.display='';}
		function showhide(x) {
			if(document.getElementById(x).style.display=='') {
				document.getElementById(x).style.display='none';
				document.getElementById('wrapper').style.minWidth='400px';
				}
			else {
				document.getElementById(x).style.display='';
				document.getElementById('wrapper').style.minWidth='520px';
				}
			
			}

			
	
	function text_name(name){
	textname=name;
	}
	
	function add_letter(newletter) {
		
		
		//IE support
	 if (document.selection) {
	 	if(textname=='hebrew'){
		document.form.hebrew.focus();}
		else{
		document.form.hebname.focus();}
		sel = document.selection.createRange();
		sel.text = newletter;
		
		}//end if for ie

  		//MOZILLA/NETSCAPE support
		
		else if (document.form.hebrew.selectionStart || document.form.hebrew.selectionStart == '0' || document.form.hebname.selectionStart || document.form.hebname.selectionStart == '0') {
		if(textname=='hebrew'){
		document.form.hebrew.focus();
		var startPos = document.form.hebrew.selectionStart;
		var endPos = document.form.hebrew.selectionEnd;
		
		document.form.hebrew.value = document.form.hebrew.value.substring(0, startPos)
		+ newletter
		+ document.form.hebrew.value.substring(endPos, document.form.hebrew.value.length);
		
		document.form.hebrew.selectionStart = startPos+1;
		document.form.hebrew.selectionEnd = startPos+1;
		}//end if textname==hebrew
		else{document.form.hebname.focus();
		var startPos = document.form.hebname.selectionStart;
		var endPos = document.form.hebname.selectionEnd;
		
		document.form.hebname.value = document.form.hebname.value.substring(0, startPos)
		+ newletter
		+ document.form.hebname.value.substring(endPos, document.form.hebname.value.length);
		
		document.form.hebname.selectionStart = startPos+1;
		document.form.hebname.selectionEnd = startPos+1;
		}//end if textname==hebname
		} //end elseif

	else {
	if(textname=='hebrew'){
    document.form.hebrew.value += newletter;}
    else{
    document.form.hebname.value += newletter;}
		}//end of else
	}//end of function
