var supported = (document.all || document.getElementById);
var disabled = false;
var charmapid = 1;
var keymodeid = 0;
var linebreak = 0;
var theTyper = null;

reset = function(){}
initTyper = telexingVietUC;

function setTypingMode(mode) {
  keymodeid = mode;
  if (theTyper) theTyper.keymode= initKeys();
  if (!supported && !disabled) {
    alert("Xin loi, trinh duyet web cua ban khong cho phep dung VietTyping.\n");
    disabled = true;
  }
}

initCharMap = function() { return new CVietUniCodeMap(); }

initKeys = function() {
  switch (keymodeid) {
    case 1: return new CTelexKeys();
    case 2: return new CVniKeys();
    case 3: return new CViqrKeys();
    case 4: return new CAllKeys();
    default: return new CVKOff();
  }
}

function telexingVietUC (txtarea) {
  txtarea.vietarea= true;
  txtarea.onkeyup= null;
  if (!supported) return;
  txtarea.onkeypress= vietTyping;
  txtarea.getCurrentWord= getCurrentWord;
  txtarea.replaceWord= replaceWord;
  txtarea.onkeydown= onKeyDown;
  txtarea.onmousedown= onMouseDown;
  if(!theTyper) theTyper = new CVietString("");
}

function getEvt(evt) {
  if (typeof(evt)=='string') return evt.charCodeAt(0);
  return document.all? event.keyCode: (evt && evt.which)? evt.which: 0;
}

function onKeyDown(evt) {
  var c= getEvt(evt);
  if ((c==10) || (c==13)) { reset(1); linebreak= 1; }
  else if ((c<49) && (c!=16) && (c!=20)) { linebreak= 0; reset(c==32); }
  return true;
}

function onMouseDown(evt) { reset(0); linebreak= 0; return true; }

function vietTyping(evt) {
  var c= getEvt(evt);
  theTyper.value= this.getCurrentWord();
  var changed= ((c>32) && theTyper.typing(c));
  if (changed) this.replaceWord(theTyper.value);
  return !changed;
}

function getCurrentWord() {
  if(!document.all) return this.value;
  var caret = this.document.selection.createRange();
  if (caret.text) return null;
  var backward = -10;
  do {
    var caret2 = caret.duplicate();
    caret2.moveStart("character", backward++);
  } while (caret2.parentElement() != this && backward <0);
  this.curword = caret2.duplicate();
  return caret2.text;
}

function replaceWord(newword) {
  if(!document.all) { this.value= newword; return; }
  this.curword.text = newword;
  this.curword.collapse(false);
}
// end interface


// "class": CVietString
//
function CVietString(str) {
  this.value= str;
  this.keymode= initKeys();
  this.charmap= initCharMap();
  this.ctrlchar= '-';
  this.changed= 0;

  this.typing= typing;
  this.Compose= Compose;
  this.Correct= Correct;
  this.findCharToChange= findCharToChange;
  return this;
}

function typing(ctrl) {
  this.changed = 0;
  this.ctrlchar = String.fromCharCode(ctrl);
  if (linebreak) linebreak= 0; else this.keymode.getAction(this);
  this.Correct();
  return this.changed;
}

function Compose(type) {
  if(!this.value) return;
  var info = this.findCharToChange(type);
  if (!info || !info[0]) return;
  var telex;
  if (info[0]=='\\') telex= [1,this.ctrlchar,1];
  else if (type>6) telex= this.charmap.getAEOWD(info[0], type, info[3]);
  else telex= this.charmap.getDau(info[0], type);
  if (!(this.changed = telex[0])) return;
  this.value = this.value.replaceAt(info[1],telex[1],info[2]);
  if (!telex[2]) { spellerror= 1; this.value+= this.ctrlchar; }
}

function Correct() {
  if (this.charmap.maxchrlen || !document.all) return 0;
  var tmp= this.value;
  if ('nNcC'.indexOf(this.ctrlchar)>=0) tmp+= this.ctrlchar;
  var er= /[^\x01-\x7f](hn|hc|gn)$/i.exec(tmp);
  if (er) {
    this.value= tmp.substring(0,tmp.length-2)+er[1].charAt(1)+er[1].charAt(0);
    this.changed= 1;
  }
  else if(!this.changed) return 0;
  er= /\w([^\x01-\x7f])(\w*)([^\x01-\x7f])\S*$/.exec(this.value);
  if (!er) return 0;
  var i= this.charmap.isVowel(er[1]);
  var ri= (i-1)%24 + 1, ci= (i-ri)/24;
  var i2= this.charmap.isVowel(er[3]);
  if (!ci || !i2) return 0;
  var ri2= (i2-1)%24 + 1, ci2= (i2-ri2)/24;
  var nc= this.charmap.charAt(ri)+ er[2]+ this.charmap.charAt(ci*24+ri2);
  this.value= this.value.replace(new RegExp(er[1]+er[2]+er[3],'g'), nc);
}

function findCharToChange(type) {
  var lastchars= this.charmap.lastCharsOf(this.value, 5);
  var i= 0, c=lastchars[0][0], chr=0;
  if (c=='\\') return [c,this.value.length-1,1];
  if (type==15) while (!(chr=this.charmap.isVD(c))) {
    if ((c < 'A') || (i>=4) || !(c=lastchars[++i][0])) return null;
  }
  else while( "cghmnptCGHMNPT".indexOf(c)>=0) {
    if ((c < 'A') || (i>=2) || !(c=lastchars[++i][0])) return null;
  }
  c = lastchars[0][0].toLowerCase();
  var pc = lastchars[1][0].toLowerCase();
  var ppc = lastchars[2][0].toLowerCase();
  if (i==0 && type!=15) {
    if ( (chr=this.charmap.isVowel(lastchars[1][0]))
      && ("uyoia".indexOf(c)>=0) && !this.charmap.isUO(pc,c)
      && !((pc=='o' && c=='a') || (pc=='u' && c=='y'))
      && !((ppc=='q' && pc=='u') || (ppc=='g' && pc=='i')) ) ++i;
    if (c=='a' && (type==9 || type==7)) i= 0;
  }
  c= lastchars[i][0];
  if ((i==0 || chr==0) && type!=15) chr= this.charmap.isVowel(c);
  if (!chr) return null;
  var clen= lastchars[i][1], isuo=0;
  if ((i>0) && (type==7 || type==8 || type==11)) {
    isuo=this.charmap.isUO(lastchars[i+1][0],c);
    if (isuo) { chr=isuo; clen+=lastchars[++i][1]; isuo=1; }
  }
  var pos= this.value.length;
  for (var j=0; j<= i; j++) pos -= lastchars[j][1];
  return [chr, pos, clen, isuo];
}
// end CVietString


// character-map template
//
function CVietCharMap(){
  this.vietchars = null;
  this.length = 149;
  this.chr_cache = new Array(20);
  this.ind_cache = new Array(20);
  this.cptr = 0;
  this.caching= function(chr, ind) {
    this.chr_cache[this.cptr] = chr;
    this.ind_cache[this.cptr++] = ind;
    this.cptr %= 20;
  }
  return this;
}

CVietCharMap.prototype.charAt= function(ind){
  var chrcode = this.vietchars[ind];
  return chrcode ? String.fromCharCode(chrcode) : null;
}

CVietCharMap.prototype.isVowel= function(chr){
  var i = 0;
  while ((i<20) && (chr != this.chr_cache[i])) ++i;
  if (i<20) return this.ind_cache[i];

  i = this.length-5;
  while ((chr != this.charAt(i)) && i) --i;
  this.caching(chr, i);
  return i;
}

CVietCharMap.prototype.isVD= function (chr){
  var ind = this.length-5;
  while ((chr != this.charAt(ind)) && (ind < this.length)) ++ind;
  return (ind<this.length)? ind: 0;
}

CVietCharMap.prototype.isUO= function (c1, c2){
  if (!c1 || !c2) return 0;
  var ind1 = this.isVowel(c1);
  var ci = (ind1-1)%12;
  if ((ci!=9) && (ci!=10)) return 0;
  var ind2 = this.isVowel(c2);
  ci = (ind2-1)%12;
  if ((ci!=6) && (ci!=7) && (ci!=8)) return 0;
  return [ind1,ind2];
}

CVietCharMap.prototype.getDau= function (ind, type){
  var accented= (ind < 25)? 0: 1;
  var ind_i= (ind-1) % 24 +1;
  var charset= (type == 6)? 0 : type;
  if ((type== 6) && !accented) return [0];
  var newind= charset*24 + ind_i;
  if (newind == ind) newind= ind_i;
  var chr= this.charAt(newind);
  if (!chr) chr= this.lowerCaseOf(0,newind);
  return [1, chr, newind>24 || type==6];
}

var map=[
[7,7,7,8,8, 8,9,10,11,15],
[0,3,6,0,6, 9,0, 3, 6, 0],
[1,4,7,2,8,10,1, 4, 7, 1]
];
CVietCharMap.prototype.getAEOWD= function(ind, type, isuo) {
  var c=0, i1=isuo? ind[0]: ind;
  var vc1= (type==15)? (i1-1)%2 : (i1-1)%12;
  if (isuo) {
    var base= ind[1]-(ind[1]-1)%12;
    if (type==7 || type==11) c= this.charAt(i1-vc1+9)+this.charAt(base+7);
    else if (type==8) c= this.charAt(i1-vc1+10)+this.charAt(base+8);
    return [c!=0, c, 1];
  }
  var i= -1, shift= 0, del= 0;
  while (shift==0 && ++i<map[0].length) {
    if (map[0][i]==type) {
      if(map[1][i]==vc1) shift= map[2][i]-vc1;
      else if(map[2][i]==vc1) shift= map[1][i]-vc1;
    }
  }
  if (shift==0) {
    if (type==7 && (vc1==2 || vc1==8)) shift=-1;
    else if ((type==9 && vc1==2) || (type==11 && vc1==8)) shift=-1;
    else if (type==8 && (vc1==1 || vc1==7)) shift=1;
    del= 1;
  } else del=(shift>0);
  i1 += shift;
  var chr= this.charAt(i1);
  if (i1<145) this.caching(chr, i1);
  if (!chr) chr= this.lowerCaseOf(0, i1);
  return [shift!=0, chr, del];
}

CVietCharMap.prototype.lastCharsOf= function(str, num){
  if (!num) return [str.charAt(str.length-1),1];
  var vchars = new Array(num);
  for (var i=0; i< num; i++) { vchars[i]= [str.charAt(str.length-i-1),1]; }
  return vchars;
}
// end CVietCharMap prototype


String.prototype.replaceAt= function(i,newchr,clen){
  return this.substring(0,i)+ newchr + this.substring(i+clen);
}

// output map: class CVietUniCodeMap
//
function CVietUniCodeMap(){ var map= new CVietCharMap();
map.vietchars = new Array(
"UNICODE",
97, 226, 259, 101, 234, 105, 111, 244, 417, 117, 432, 121,
65, 194, 258, 69, 202, 73, 79, 212, 416, 85, 431, 89,
225, 7845, 7855, 233, 7871, 237, 243, 7889, 7899, 250, 7913, 253,
193, 7844, 7854, 201, 7870, 205, 211, 7888, 7898, 218, 7912, 221,
224, 7847, 7857, 232, 7873, 236, 242, 7891, 7901, 249, 7915, 7923,
192, 7846, 7856, 200, 7872, 204, 210, 7890, 7900, 217, 7914, 7922,
7841, 7853, 7863, 7865, 7879, 7883, 7885, 7897, 7907, 7909, 7921, 7925,
7840, 7852, 7862, 7864, 7878, 7882, 7884, 7896, 7906, 7908, 7920, 7924,
7843, 7849, 7859, 7867, 7875, 7881, 7887, 7893, 7903, 7911, 7917, 7927,
7842, 7848, 7858, 7866, 7874, 7880, 7886, 7892, 7902, 7910, 7916, 7926,
227, 7851, 7861, 7869, 7877, 297, 245, 7895, 7905, 361, 7919, 7929,
195, 7850, 7860, 7868, 7876, 296, 213, 7894, 7904, 360, 7918, 7928,
100, 273, 68, 272);
return map;
}

// input methods: class C...Keys
function CVietKeys() {
  this.getAction= function(typer){
    var i= this.keys.indexOf(typer.ctrlchar.toLowerCase());
    if(i>=0) typer.Compose(this.actions[i]);
  }
  return this;
}

function CVKOff() {
  this.off = true;
  this.getAction= function(){};
  return this;
}

function CTelexKeys() {
  var k= new CVietKeys();
  k.keys= "sfjrxzaeowd";
  k.actions= [1,2,3,4,5,6,9,10,11,8,15];
  k.istelex= true;
  return k;
}

function CVniKeys() {
  var k= new CVietKeys();
  k.keys= "0123456789";
  k.actions= [6,1,2,4,5,3,7,8,8,15];
  return k;
}

function CViqrKeys() {
  var k= new CVietKeys();
  k.keys= "\xB4/'\u2019`.?~-^(*+d";
  k.actions= [1,1,1,1,2,3,4,5,6,7,8,8,8,15];
  return k;
}

function CAllKeys() {
  var k= new CVietKeys();
  k.keys= "sfjrxzaeowd0123456789\xB4/'`.?~-^(*+d";
  k.actions= [1,2,3,4,5,6,9,10,11,8,15,6,1,2,4,5,3,7,8,8,15,1,1,1,2,3,4,5,6,7,8,8,8,15];
  k.istelex= true;
  return k;
}

// end vietuni.js


	var xmlHttp=false;
	function creatAjaxObject()
	{
		if (window.XMLHttpRequest)
		{ 
			xmlHttp=new XMLHttpRequest()
			if (xmlHttp.overrideMimeType)
			xmlHttp.overrideMimeType('text/xml')
		}
		else if (window.ActiveXObject)
		{ 
			try 
				{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				} 
				catch (e)
				{
					try
					{
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e)
					{
					}
				}
			}
	}
 function ond(i)
{
lo=document.getElementById('ok');
lo.style.posTop=i++*2;
lo.style.posLeft=screen.width/2-120;
b=i++;
if(i*5 < screen.height/2+300)
{
setTimeout("ond("+b+")",15);
}
else
{
lo.style.posLeft=screen.width/2-120
}
}
function end(i)
{
lo=document.getElementById('ok');
lo.style.posLeft=i--;
b=i;
if(i > -100)
{
setTimeout("end("+b+")",1);
}

}
   function ajax(where, url){
        /* xmlHttp = new GetXmlHttpObject()
         if(xmlHttp==null){
                 return;
                 }
                 */
         creatAjaxObject();
var bar = '<div  align="center"><img border="0" src="loading.gif"></div>';
document.getElementById(where).innerHTML = bar
window.status="Website Ä‘ang táº£i dá»¯ liá»‡u ...";
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4){
                          document.getElementById(where).innerHTML = xmlHttp.responseText
						  window.status="*** WWW.SIM9X.COM *** Sim sá»‘ Ä‘áº¹p , Sim vip , Sim taxi , Sim lá»™c phÃ¡t , Sim nÄƒm sinh ... --- Hotline : 0944.666.889 ";
                         }
                 }
         xmlHttp.open("GET", url, true);
         xmlHttp.send(null);
   }


   
    function ajaxp1(where, url){
         xmlHttp = new GetXmlHttpObject()
         if(xmlHttp==null){
                 return;
                 }
        
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                          document.getElementById(where).innerHTML = xmlHttp.responseText
               
                         }
                 }
  
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("copy=");
   }
   function cmenu(id)
   {
   	a=document.getElementById(id);
   	if(a)
   	{
    a=document.getElementById(id);
   	a.style.display='';
   	}
   	 else
   {
   	a=document.getElementById(id);
   	a.style.display='none';
   }
   }
  
   if(window.screen.width==800)
   {
   	test=document.getElementById('css');
   	test.href="css/style2.css";
   }
   
   function vreg(where, url){
   	ob=document.reg;
   	if(ob.hoten.value=="")
   	{
   		alert('Báº¡n quÃªn chÆ°a nháº­p hï¿½? tÃªn !');
   		ob.hoten.focus()
   		return false;
   	}
   	else if(ob.diachi.value=="")
   	{
   		alert('Báº¡n quÃªn chÆ°a nháº­p Ä‘á»‹a chá»‰ !');
   		ob.diachi.focus()
   		return false;
   	}
   	else if(ob.dienthoai.value=="")
   	{
   		alert('Báº¡n quÃªn chÆ°a nháº­p sá»‘ Ä‘iá»‡n thoáº¡i');
   		ob.dienthoai.focus()
   		return false;
   	}
   	else if(ob.email.value=="")
   	{
   		alert('Báº¡n quyÃªn chÆ°a nháº­p email');
   		ob.email.focus()
   		return false;
   	}
   	else if(ob.email.value.indexOf('.', 1)== -1 || ob.email.value.indexOf('@', 1)==-1)
   	{
   		
   		alert('Email báº¡n vá»«a nháº­p khÃ´ng Ä‘Ãºng!')
   		ob.email.focus()
   		return false;
   	}
   	else if(ob.user.value=="")
   	{
   		alert('Báº¡n chÆ°a nháº­p tÃªn Ä‘Äƒng nháº­p');
   		ob.user.focus()
   		return false
   	}
   	else if(ob.user.value.length < 5 || ob.user.value.length > 25)
   	{
   		alert('Báº¡n hÃ£y chá»?n tÃªn Ä‘Äƒng nháº­p cÃ³ Ä‘á»™ dÃ i tá»« 5-25 kÃ½ tá»±');
   		ob.user.focus()
   		return false;
   	}
   	else if(ob.pass1.value=="")
   	{
   		alert('Báº¡n quÃªn chÆ°a nháº­p máº­t kháº©u');
   		ob.pass1.focus()
   		return false;
   	}
   	else if(ob.pass2.value=="")
   	{
   		alert('Báº¡n quyÃªn chÆ°a nháº­p láº¡i máº­t kháº©u');
   		ob.pass2.focus()
   		return false;
   	}
   	else if(ob.pass1.value.length < 5 || ob.pass2.value <5)
   	{
   		alert('Ä?á»™ dÃ i máº­t kháº©u tá»‘i thiá»ƒu lÃ  5 kÃ½ tá»± báº¡n hÃ£y nháº­p láº¡i');
   		ob.pass1.focus()
   		return false;
   	}
   	else if(ob.pass1.value!=ob.pass2.value)
   	{
   		alert('Máº­t kháº©u vÃ  máº­t kháº©u nháº­p láº¡i khÃ´ng khá»›p nhau1');
   		ob.pass1.focus()
   		return false
   	}
   	return checkuser(ob.user.value, where, url)
   	//else if(return checkuser(ob.user.value))
   //	{
   		
   //	}
   	
  		creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                          document.getElementById(where).innerHTML = xmlHttp.responseText
               
                         }
                 }
    
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("hoten="+ob.hoten.value+"&diachi="+ob.diachi.value+"&dienthoai="+ob.dienthoai.value+"&email="+ob.email.value+"&user="+ob.user.value+"&pass="+ob.pass1.value+"&cmnd="+ob.cmnd.value+"&nganhang="+ob.nganhang.value+"&sotaikhoan="+ob.sotaikhoan.value+"&num=1");
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
    function login(where, url){
    
   	ob=document.dologin;
   	if(ob.username.value=="" || ob.username.value=="TÃªn Ä‘Äƒng nháº­p")
   	{
   		alert('Báº¡n quÃªn chÆ°a nháº­p tÃªn Ä‘Äƒng nháº­p !');
   		ob.username.value="";
   		ob.username.focus()
   		return false;
   	}
   	else if(ob.password.value=="" || ob.password.value=="Máº­t kháº©u")
   	{
   		alert('Báº¡n quyÃªn chÆ°a nháº­p máº­t kháº©u!');
   		ob.password.value="";
   		ob.password.focus()
   		return false;
   	}
   	creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                         test = xmlHttp.responseText
                         if(test!="")
                         {
                         	alert(xmlHttp.responseText)
                         }
                         else
                         {
                        creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                       document.getElementById(where).innerHTML = xmlHttp.responseText
               
                         }
                 }
    
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("username="+ob.username.value+"&password="+ob.password.value+"&num=1");
                         }
               
                         }
                 }
    
	xmlHttp.open('POST', 'checkuser.php' , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("username="+ob.username.value+"&password="+ob.password.value+"&num=1");

  	
   }
   
   
   
   //----------------------
   
   
   
   
    function menber(where, url){
    
   	ob=document.login1;
   	if(ob.user1.value=="" || ob.user1.value=="TÃªn Ä‘Äƒng nháº­p")
   	{
   		alert('Báº¡n quÃªn chÆ°a nháº­p tÃªn Ä‘Äƒng nháº­p !');
   		ob.user1.value="";
   		ob.user1.focus()
   		return false;
   	}
   	else if(ob.pass1.value=="" || ob.pass1.value=="Máº­t kháº©u")
   	{
   		alert('Báº¡n quyÃªn chÆ°a nháº­p máº­t kháº©u!');
   		ob.pass1.value="";
   		ob.pass1.focus()
   		return false;
   	}
   	creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                         test = xmlHttp.responseText
                         if(test!="")
                         {
                         	alert('Báº¡n nháº­p sai tÃªn Ä‘Äƒng nháº­p hoáº·c máº­t kháº©u')
                         }
                         else
                         {
                        creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                       document.getElementById(where).innerHTML = xmlHttp.responseText
               
                         }
                 }
    
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("user1="+ob.user1.value+"&pass1="+ob.pass1.value+"&num=1");
                         }
               
                         }
                 }
    
	xmlHttp.open('POST', 'checkuser.php' , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("username="+ob.user1.value+"&password="+ob.pass1.value+"&num=1");

  	
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   function checkuser(user, where, url){
    

  		creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                       
                    
                        av = xmlHttp.responseText
                        if(av!="")
                        {
                          	alert(xmlHttp.responseText);
                          	document.reg.user.focus()
                          	return false;
                        }
                        else
                        {
                        	creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                          document.getElementById(where).innerHTML = xmlHttp.responseText
               
                         }
                 }
    
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("hoten="+ob.hoten.value+"&diachi="+ob.diachi.value+"&dienthoai="+ob.dienthoai.value+"&email="+ob.email.value+"&user="+ob.user.value+"&pass="+ob.pass1.value+"&cmnd="+ob.cmnd.value+"&nganhang="+ob.nganhang.value+"&sotaikhoan="+ob.sotaikhoan.value+"&num=1");
                        }
                          
               
                         }
                 }
    
	xmlHttp.open('POST', 'checkuser.php' , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("user="+document.reg.user.value+"&num=1");
   }
 function buy()
 {
 	ob=document.fr;
 	     creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                          alert('ThÃ´ng tin Ä‘áº·t hÃ ng cá»§a báº¡n Ä‘Ã£ Ä‘Æ°á»£c gá»­i thÃ nh cÃ´ng!');
            
                         return ajax('main','start.php?act=main');
               
                         }
                 }
    
	xmlHttp.open('POST', 'checkuser.php' , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("so="+ob.bso.value+"&gia="+ob.bgia.value+"&kho="+ob.bkho.value+"&user="+ob.buser.value+"&sp="+ob.sp.value+"&num=1");
 }
 
 //----------- Thay doi thong tin
 function adinfo(where, url)
 {
 	ob=document.frinfo;
 	if(ob.pass1.value!=ob.pass2.value)
 	{
 		alert('Password khÃ´ng khá»›p vá»›i password nháº­p láº¡i !');
 		ob.pass1.focus()
 		return false;
 		
 	}
 	if(ob.pass1.value!="")
 	{
 	if(ob.pass1.value.length < 5)
 		{
 			alert('Password Pháº£i dÃ i hÆ¡n 5 kÃ½ tá»±');
 			ob.pass1.focus()
 			return false;
 		}
 	}
 	     creatAjaxObject();
         //var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                         alert('ThÃ´ng tin cá»§a báº¡n Ä‘Ã£ Ä‘Æ°á»£c thay Ä‘á»•i');
                        
               
                         }
                 }
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("hoten="+ob.hoten.value+"&diachi="+ob.diachi.value+"&dienthoai="+ob.dienthoai.value+"&email="+ob.email.value+"&cmnd="+ob.cmnd.value+"&nganhang="+ob.nganhang.value+"&sotaikhoan="+ob.sotaikhoan.value+"&password="+ob.pass1.value+"&num=1");
 }
 
 //--- post
 
 function post(where, url)
 {
 	ob=document.dangso;
 	if(ob.sl.value=="")
 	{
 		alert("Báº¡n quyÃªn chÆ°a chï¿½?n máº¡ng");
 		ob.sl.focus()
 		return false;
 	}
 	     creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                           ob.simtxt.value = xmlHttp.responseText
                        
               
                         }
                 }
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("sl="+ob.sl.value+"&simtxt="+ob.simtxt.value+"&num=1");
 }
 function lay(url)
 {
 	ob=document.laypass;
 	     creatAjaxObject();
         //var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                           alert(xmlHttp.responseText)
                        
               
                         }
                 }
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("email="+ob.email.value+"&num=1");
 }
 function lay2(url)
 {
 	ob=document.laypass;
 	if(ob.masacnhan.value=="")
 	{
 		alert('Lá»—i !  Báº¡n quÃªn chÆ°a nháº­p mÃ£ sÃ¡c nháº­n!');
 		ob.masacnhan.focus()
 		return false;
 	}
 	if(ob.matkhau1.value!=ob.matkhau2.value)
 	{
 		alert('Lá»—i !  Máº­t kháº©u vÃ  máº­t kháº©u nháº­p láº¡i khÃ´ng khá»›p nhau');
 		ob.matkhau1.focus()
 		return false;
 	}
 	if(ob.matkhau1.value.length < 5)
 	{
 		alert('Lá»—i !  Ä?á»™ dÃ i máº­t kháº©u pháº£i lá»›n hÆ¡n hoáº·c báº±ng 5 kÃ½ tá»±!');
 		ob.matkhau1.focus()
 		return false;
 	}
 	     creatAjaxObject();
         //var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                           alert(xmlHttp.responseText)
                        
               
                         }
                 }
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("masacnhan="+ob.masacnhan.value+"&matkhau1"+ob.matkhau1.value+"&matkhau2="+ob.matkhau2.value+"&num=1");
 }
 //-----------------------------
 
 
 
  function smslogin()
 {

 	     creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="../images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                  
                        
               
                         }
                 }
                 //http://alofun.vn/vn/include/login.jsp
	xmlHttp.open('POST', "http://alofun.vn/vn/include/login.jsp" , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("txtUserName=wwwsodepvn&txtPassword=anhyeuem");
 }
 
 

 function smsgui(where, url)
 {
ob=document.sms;
if(ob.tieude.value=="")
{
	alert("Báº¡n quÃªn chÆ°a nháº­p sá»‘ cáº§n gá»­i");
	ob.tieude.focus()
	return false;
}
if(ob.noidung.value=="")
{
	alert("Báº¡n quÃªn chÆ°a nháº­p ná»™i dung cáº§n gá»­i");
	ob.noidung.focus()
	return false;
}
if(ob.noidung.value.length > 150)
{
	alert("Ná»™i dung cá»§a báº¡n Ä‘Ã£ vÆ°á»£t quÃ¡ 150 kÃ½ tá»± , vui lÃ²ng xÃ³a bá»›t!");
	ob.focus()
	return false;
}
 	     creatAjaxObject();
         var bar = '<div  align="center"><img border="0" src="../images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                   ob.submit.style.display='none';
                   creatAjaxObject();
         //var bar = '<div  align="center"><img border="0" src="images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                 	

                        
               
                         }
                 }
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("value=1");	
               alert('Tin nháº¯n cá»§a báº¡n Ä‘Ã£ Ä‘Æ°á»£c gá»­i thÃ nh cÃ´ng tá»›i sá»‘ '+ob.tieude.value+'');
                
                         }
                 }
                 
                 //http://alofun.vn/vn/address/addressprocess.jsp
	xmlHttp.open('POST', "http://alofun.vn/vn/address/addressprocess.jsp" , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("txtLeftTo="+ob.tieude.value+"&txtLeftSubject="+ob.noidung.value+"&txtLeftCharsLeft="+ob.txtLeftCharsLeft.value+"&Submit3=Submit&txtLeftName=www.sodep.vn-SimVip");
 }

  
    function yeucauc()
    {
    	ob=document.yeucau;  
    	if(ob.hoten.value=="")
    	{
    		alert("Báº¡n quÃªn chÆ°a nháº­p há»? tÃªn");
    		ob.hoten.focus()
    		return false
    	}
    	else if(ob.diachi.value=="")
    	{
    		alert("Báº¡n quÃªn chÆ°a nháº­p Ä‘á»‹a chá»‰");
    		ob.diachi.focus()
    		return false;
    	}
    	else if(ob.dienthoai.value=="")
    	{
    		alert("Báº¡n quÃªn chÆ°a nháº­p Ä‘iá»‡n thoáº¡i");
    		ob.dienthoai.focus()
    		return false;
    	}
    	else
    	{
		ob.submit()
    	}
   }
   function timsim(where,url)
 {
      ob=document.tim;
      setTimeout("ond('1')",1);
window.status="Website Ä‘ang táº£i dá»¯ liá»‡u ...";
lo=document.getElementById('ok');
lo.style.display="block";
        if(ob.sosim.value=='')
        {
        	alert("Báº¡n chÆ°a nháº­p sá»‘ sim cáº§n tÃ¬m !");
        	ob.sosim.focus()
        	return false;
        }
 	     creatAjaxObject();
         //var bar = '<div  align="center"><img border="0" src="../images/loading.gif"></div>';
         //document.getElementById(where).innerHTML = bar
         ob.submit.value='Ä?á»£i chÃºt ...';
         xmlHttp.onreadystatechange= function(){
                 if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
                  
                      document.getElementById(where).innerHTML = xmlHttp.responseText  
               		  lo.style.display="none";
						  window.status="*** WWW.SIMTRUCTUYEN.VN *** Sim sá»‘ Ä‘áº¹p , Sim vip , Sim taxi , Sim lá»™c phÃ¡t , Sim nÄƒm sinh ... --- Hotline : 0945.27.8888 ";
                         }
                 }
	xmlHttp.open('POST', url , true);//must be put here
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send("sosim="+ob.sosim.value+"&mang="+ob.mang.value+"&gia="+ob.gia.value+"&submit=1");
 }
 function stim()
 {
 	
 	var ob=document.tim;
 	if(ob.sosim.value=="")
 	{
 		alert('Báº¡n hÃ£y nháº­p chuá»—i sá»‘ cáº§n tÃ¬m VD: 1986');
 		ob.sosim.focus();
 		return false;
 	}
 	else
 	{
 	window.location.href='index.php?act=tim&sosim='+ob.sosim.value+'&gia='+ob.gia.value+'&kieutim='+ob.kieutim.value+'&mang='+ob.mang.value+'';
 	return true;
 	}
 }
 function stim2()
 {
 	stim();
 	return false;
 }
 function checkbuynow()
 {
 	var obj=document.buynow;
 	if(obj.hovaten.value=="")
 	{
 		alert("Báº¡n quÃªn chÆ°a nháº­p há»? vÃ  tÃªn");
 		obj.hovaten.focus();
 		return false;
 	}
 	if(obj.diachi.value=="")
 	{
 		alert("Báº¡n quÃªn chÆ°a nháº­p Ä‘á»‹a chá»‰ nháº­n sim");
 		obj.diachi.focus();
 		return false;
 	}
 	if(obj.city.value==0)
 	{
 		alert("Báº¡n quÃªn chÆ°a nháº­p tá»‰nh thÃ nh báº¡n Ä‘ang á»Ÿ!");
 		obj.city.focus();
 		return false;
 		
 	}
 	if(obj.mobile.value=="")
 	{
 		alert("Báº¡n quÃªn chÆ°a nháº­p sá»‘ Ä‘iá»‡n thoáº¡i liÃªn há»‡");
 		obj.mobile.focus();
 		return false;
 	}
 	
 }
function dk()
{
	var ob=document.dangk;
	if(ob.hoten.value=="")
	{
		alert("Báº¡n quÃªn chÆ°a nháº­p TÃªn Ä‘áº¡i lÃ½");
		ob.hoten.focus();
		return false;
	}
	if(ob.diachi.value=="")
	{
		alert("Báº¡n quÃªn chÆ°a nháº­p Ä‘á»‰a chá»‰ ");
		ob.diachi.focus();
		return false;
	}
	if(ob.dienthoai.value=="")
	{
		alert("báº¡n quÃªn chÆ°a nháº­p Ä‘iá»‡n thoáº¡i");
		ob.dienthoai.focus();
		return false;
		
	}
	if(ob.email.value=="")
	{
		alert("Báº¡n quÃªn chÆ°a nháº­p email");
		ob.email.focus();
		return false;
	}
	if(ob.email.value.indexOf('.', 1)== -1 || ob.email.value.indexOf('@', 1)==-1)
	{
		alert("Email báº¡n vá»«a nháº­p khÃ´ng Ä‘Ãºng");
		ob.email.focus();
		return false;
		
	}
	if(ob.city.value==0)
	{
		alert("Báº¡n quÃªn chÆ°a chá»?n ThÃ nh phá»‘!");
		ob.city.focus();
		return false;
	}
	if(ob.username.value=="" || ob.username.value.length < 3)
	{
		alert("TÃªn Ä‘Äƒng nháº­p quÃ¡ ngáº¯n!");
		ob.username.focus();
		return false;
	}
	if(ob.password1.value == "" || ob.password2.value=="")
	{
		alert("Báº¡n quÃªn chÆ°a nháº­p máº­t kháº©u");
		ob.password1.focus();
		return false;
	}
	if(ob.password1.value!=ob.password2.value)
	{
		alert("Máº­t kháº©u nháº­p láº¡i khÃ´ng Ä‘Ãºng");
		ob.password2.focus();
		return false;
	}
}

window.status="*** WWW.SIMTRUCTUYEN.VN *** Sim sá»‘ Ä‘áº¹p , Sim vip , Sim taxi , Sim lá»™c phÃ¡t , Sim nÄƒm sinh ... --- Hotline : 0945.27.8888 ";