
function isdom(url){
	var xmlhttp = false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (E){
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined')    xmlhttp = new XMLHttpRequest();
	xmlhttp.open("GET",url,false);
	xmlhttp.send(null);
	return xmlhttp;
 }
function makechange(url,a){
	theoldcell = '' ;
	xmlhttp=isdom(url);
	text = xmlhttp.responseText;
	obj = document.getElementById(a);
	obj.innerHTML = text;
}	
function chgObj(url,a,b){
	tr = document.getElementById(b);
	tr.style.display='' ;
	obj = document.getElementById(a);
	obj.innerHTML = '<img src="image/load.gif" width="16" height="16" />' ;
	xmlhttp=isdom(url);
	text = xmlhttp.responseText;
	obj.innerHTML = text;
	showhide(b) ;
}
function getResult(a){
	for(i=0;i<a.length;i++){
		obj=document.getElementById('tab'+i);
		obj.innerHTML=a[i];
		if(i==(a.length-1)) return;
		obj=document.getElementById('tabs'+i);
		obj.innerHTML=a[i];
	}
}
function checkfrm(a,lang){
	obj=a.elements ;
	if(lang=='us') a = new Array('Please enter your ','You typed wrong ');
		else a = new Array('Nhap Vao ','Qui Khach Nhap Sai ');
	for(var i=0;i<obj.length;i++){
		if(obj[i].id != ""){
			if(obj[i].value=="")
			return disAlert(a[0]+obj[i].id,obj[i]);
			if((isNaN(obj[i].value))&&(obj[i].name=='txtPhone'))
			return disAlert(a[1]+obj[i].id,obj[i]);
			if(obj[i].name=='txtEmail'){
				if(obj[i].value.indexOf('@')<0){  
					return disAlert(a[1]+obj[i].id,obj[i]);
				}else{
					fr=obj[i].value.indexOf('@')+1;
					t=obj[i].value.substr(fr,obj[i].value.length-fr);
					if(t.indexOf('.')<0) return disAlert(a[1]+obj[i].id,obj[i]);
				}
			}
		}//end if
	}//end for
	return true;
}
function disAlert(a,objs){
	alert(a);
	objs.focus();
	return false;
}
function showhide(thecell){	
	if(theoldcell == thecell){
		eval('document.getElementById(thecell)').style.display = 'none';
		theoldcell = "" ;
	}else{
		if(theoldcell != thecell){
			if(theoldcell != "")
				eval('document.getElementById(theoldcell)').style.display = 'none';
			eval('document.getElementById(thecell)').style.display = '';
			theoldcell = thecell;
		}
	}
	return false;
}
