/*function Select_Panel(status=0,align=""){
   if (status > 0){
      if (align != "")
         document.write("<div align=".align.">");
      document.write("<form name='_frm_VK'>");
      document.write("<table border=0 cellpadding=0 cellspacing=0>");
      document.write("<tr>");
      document.write("<td align='center'>");
      document.write("<input type='radio' class='cRadio' name='_vietkey_mode' value=0 onFocus='setTypingMode(0);'>Off | ");
      document.write("<input type='radio' class='cRadio' name='_vietkey_mode' value=1 onFocus='setTypingMode(1);'>Telex | ");
      document.write("<input type='radio' class='cRadio' name='_vietkey_mode' value=2 onFocus='setTypingMode(2);'>VNI | ");
      document.write("<input type='radio' class='cRadio' name='_vietkey_mode' value=3 onFocus='setTypingMode(3);'>VIQR");
      document.write("<input type='radio' class='cRadio' name='_vietkey_mode' value=4 onFocus='setTypingMode(4);'>All");
      document.write("</td>");
      document.write("</tr>");
      document.write("</table>");
      document.write("</form>");
      if (align != "")
         document.write("</div>");
   }
}

function _VK_updateVietkey() {
        var vk = ewsd_GetCookie(ewsd_vCOOKIE_PREFIX+'_VK');
        switch (vk) {
                case '0': document._frm_VK._vietkey_mode[0].checked = true; break;
                case '1': document._frm_VK._vietkey_mode[1].checked = true; break;
                case '2': document._frm_VK._vietkey_mode[2].checked = true; break;
                case '3': document._frm_VK._vietkey_mode[3].checked = true; break;
                case '4': document._frm_VK._vietkey_mode[4].checked = true; break;
                default: document._frm_VK._vietkey_mode[3].checked = true; break;
        }
}*/
function _VK_key_press() {
        var el=event.srcElement;
        if (event.keyCode == 120) {
                /* F9: change typing mode */
                _switchKeymode();
                //_VK_updateVietkey();
                return false;
        }
        if(el.type=='text'||el.type=='textarea') {
                telexingVietUC(el, event.keyCode);
                return true;
        } else {
                return false;
        }
}
function _VK_page_load() {
        var vk = ewsd_GetCookie(ewsd_vCOOKIE_PREFIX+'_VK');
        switch (vk) {

                case '1': setTypingMode(1); break;
                case '2': setTypingMode(2); break;
                case '3': setTypingMode(3); break;
                case '4': setTypingMode(4); break;
                default: setTypingMode(3); break;
        }
        //_VK_updateVietkey();
        ewsd_HookKeydown(_VK_key_press);
        return false;
}
ewsd_HookPageload(_VK_page_load);
