function showMessage(key) {
		alert(ncr2u(key));
}

function showConfirm(key)
{
  return confirm(ncr2u(key));
}

	
//Ham ncr2u : bien doi numberic character references to unicode  
function ncr2u(s) 
 {
    if (s==null)  return null;
    else
        {
              var len=s.length;
              var result='';
              var foundIndex;
              var startIndex=0;
              while (startIndex<len) 
              {
                  foundIndex=s.indexOf('&#',startIndex);
	                  if (foundIndex==-1)
	                   {
	                     result+=s.substring(startIndex);
	                     break;
	                   }
                   result+=s.substring(startIndex,foundIndex);
                   startIndex=s.indexOf(';',foundIndex);
                      if (startIndex==-1) 
                       {
                          result+=s.substring(foundIndex);
                          break;
                       }
                      var tok=s.substring(foundIndex+2,startIndex);
                      var radix=10;
                       if (tok.charAt(0)=='x') 
                          {
                             radix=16;
                             tok=tok.substring(1,tok.length());
                          }
                          result+=String.fromCharCode(parseInt(tok,radix));
                          startIndex++;
              }
              return result;
        } 
    }    
    
// JavaScript template using Windows Script Host
var GLOBAl_HOTKEY = null;
function javaScriptDoHotKey() {
	GLOBAl_HOTKEY = this;
	this.onhelp = window.onhelp;
	this.f1 = null;
	this.f2 = null;
	this.f3 = null;
	this.f4 = null;
	this.f5 = null;
	this.f6 = null;
	this.f7 = null;
	this.f8 = null;
	this.f9 = null;
	this.f10 = null;
	this.f11 = null;
	this.f12 = null;
	this.alt_h = null;
	this.ctrl_tab = null;
	this.esc = null;
	this.alt_q = null;
	this.enter = null;
	this.isNav = window.Event ? true : false;
	this.getControlKey = function(e) {
		eee = e;
		if(!this.isNav){
			eee = event;
		}
		if(eee.altKey){
			return 0;
		}
		else if(eee.ctrlKey){
			return 1;
		}
		else if(eee.shiftKey){
			return 2;
		}
		else {
			return -1;
		}
		return -1;
	}
	this.getKeyCode = function(e) {
		if(this.isNav){
			return e.which;
		}
		else {
		  return window.event.keyCode;
		}
	}
	// prevent event
	this.preventDefault = function(e){
		if(this.isNav){
			e.stopPropagation();
			e.preventDefault();
		}
		else {
			event.cancelBubble = true;
			event.returnValue = false;
			event.keyCode = null;
			
		}
		return false;
	}	
	this.processEvent = function(e) {
		var c = this.getKeyCode(e);
		var prevent = false;
		var cKey = this.getControlKey(e);
		if(cKey == -1) {
			switch(c) {
				case 112: {
					if(this.f1 != null) {
						prevent = true;
						this.f1(e);
					}
					break;
				}
				case 113:
					if(this.f2 != null){
						prevent = true;
						this.f2(e);
					}
					break;
				case 114:
					if(this.f3 != null){
						prevent = true;
						this.f3(e);
					}
					break;
				case 115:
					if(this.f4 != null){
						prevent = true;
						this.f4(e);
					}
					break;
				case 116:
					if(this.f5 != null){
						prevent = true;
						this.f5(e);
					}
					break;
				case 117:
					if(this.f6 != null){
						prevent = true;
						this.f6(e);
					}
					break;
				case 118:
					if(this.f7 != null){
						prevent = true;
						this.f7(e);
					}
					break;
				case 119:
					if(this.f8 != null){
						prevent = true;
						this.f8(e);
					}
					break;
				case 120:
					if(this.f9 != null){
						prevent = true;
						this.f9(e);
					}
					break;
				case 121:
					if(this.f10 != null){
						prevent = true;
						this.f10(e);
					}
					break;
				case 122:
					if(this.f11 != null){
						prevent = true;
						this.f11(e);
					}
					break;
				case 123:
					if(this.f12 != null){
						prevent = true;
						this.f12(e);
					}
					break;	
				case 27:
					if(this.esc != null){
						prevent = true;
						this.esc(e);
					}
					break;	
				case 13:
					if(this.enter != null){
						prevent = true;
						this.enter(e);
					}
					break;	

				default:					
					break;
			}
		}
		else {
			//altKey 
			if(cKey == 0) {
				if(c == 72){
					if(this.alt_h != null){
						prevent = true;
						this.alt_h(e);
					}
				}
				if(c == 81){
					if(this.alt_q != null){
						prevent = true;
						this.alt_q(e);
					}
				}
				
			}
			//ctrlKey
			else if (cKey == 1){
				if(c == 9){
					if(this.ctrl_tab != null){
						prevent = true;
						this.ctrl_tab(e);
					}
				}
			}
			//shiftKey
			else if(cKey == 2) {
			}
		}
		if(prevent){
			this.preventDefault(e);
			return false;
		 }
		 else {
		 	return true;
		 }
	}
}
var hotKeyObject = new javaScriptDoHotKey();
function javaScriptProcessEvent(e) {
	return GLOBAl_HOTKEY.processEvent(e);
}
window.onhelp = function(){
	if(GLOBAl_HOTKEY.f1 != null){
		return false;
	}
	else {
		GLOBAl_HOTKEY.onhelp();
		return true;
	}
}
var nav = window.Event ? true : false;
if (nav) {
   	window.captureEvents(Event.KEYDOWN);
   	window.onkeydown = javaScriptProcessEvent;
} else {
   document.onkeydown = javaScriptProcessEvent;
}