
///////  REGISTER PAGE  /////////////////////////////////////////////////////////////

	function disableElement(){
		var x = document.register
		for(i=0;i<x.length;i++){
			if(i!=0) x.elements[i].disabled = 'disabled'
		}
		document.getElementById('registers').onmouseover = ""
	}
	function enableElement(){
		var x = document.register
		for(i=0;i<x.length;i++){
			if(i!=0) x.elements[i].disabled = ""
		}
	}
	function okCheck(){
		var check = document.register.agree
		if(check.checked==true)	enableElement() 
		else disableElement()
	}
	
	function locate(id,url){
		document.location.href=url+document.getElementById(id).value
	}
	
	function checkForm(loihoten,loicanhan,loicongty,loidiachi,loiemail,loitendangnhap,securitycode,loimaxacnhan){

		var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		
		var hoten 		= document.register.hoten.value
		var congty 		= document.register.congty.value
		var diachi 		= document.register.diachi.value
		
		var email	 	= document.register.email.value
		var tendangnhap	= document.register.tendangnhap.value
		var maxacnhan 	= document.register.maxacnhan.value
		
		var err	= ""
		
		if(document.register.acept.checked==true) document.register.dongy.value =1
		else document.register.dongy.value =0
		canhan = ""
		
		if(document.getElementById('radcanhan').checked==true)	document.register.canhan.value = 1
		else if(document.getElementById('radcongty').checked==true)	document.register.canhan.value = 0

		if(hoten.indexOf(" ")==0||hoten.length<3){
			err += "* "+loihoten+"\n"
		}
		
		if(document.register.canhan.value==""){
			err += "* "+loicanhan+"\n"
		}
		if(document.register.canhan.value==0){
			if(congty.indexOf(" ")==0||congty.length<3){
				err += "* "+loicongty+"\n"
			}
		}
		if(diachi.indexOf(" ")==0||diachi.length<3){
			err += "* "+loidiachi+"\n"
		}
		if(!reg.test(email)){
			err += "* "+loiemail+"\n"
		}
		if(tendangnhap.indexOf(" ")==0||tendangnhap.length<3){
			err += "* "+loitendangnhap+"\n"
		}
		if(maxacnhan!=securitycode){
			err += "* "+loimaxacnhan+"\n"
		}
		
		if(err!=""){
			alert(err)
			return false
		}else{
			return true
		}
	}
	
	function hidePopup(){
		document.getElementById('popupbox').style.display='none'
		document.getElementById('popupbox2').style.display='none'
	}
	
//********************* LOGIN PAGE ********************************//

	function checkLogin(loitendangnhap,loimatkhau){
		var err=""
		if(document.login.tendangnhap.value.indexOf(" ")==0 || document.login.tendangnhap.value.length<3){
			err += "* "+loitendangnhap+"\n"
		}
		if(document.login.matkhau.value.indexOf(" ")==0 || document.login.matkhau.value.length<3){
			err += "* "+loimatkhau+"\n"
		}
		if(err!=""){
			alert(err)
			return false
		}else return true
	}
	
///////////////////////  FORGOT PASSWORD PAGE  ////////////////////////

	function checkForgot(loiemail){
		var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		if(!reg.test(document.forgot.email.value)){
			alert("* "+loiemail)
			return false
		}else return true
		
	}
	
////////////////////////// MESSAGE ADD //////////////////////////////////	

	function GetXmlHttpObject(){
		var xmlHttp=null;
		try { xmlHttp=new XMLHttpRequest(); }
		catch (e){
			try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");  }
		}
		return xmlHttp;
	}
	
	function ajax(url,vars,element){ 
		var obj = document.getElementById(element)
		var xmlHttp
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null){
			alert ("Browser does not support HTTP Request")
	 		return
	 	} 
		xmlHttp.onreadystatechange=function (){ 
			if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete"){				
				document.body.style.cursor="wait"
				window.status ='Loading...'
			 }else{ 
				document.body.style.cursor=""
				window.status ='Done'
				if(typeof(obj.innerHTML)!="undefined") obj.innerHTML=xmlHttp.responseText 
			 }
		}
		xmlHttp.open("POST",url,true)
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
		xmlHttp.send(vars)
	}

/////////////////////////// MESSAGE ADD CHECK FORM I ////////////////////////////////////////

	function tickAllCheckBox(){
		var x = document.msgAdd
		for(i=0;i<x.length;i++){
			if(x.elements[i].type=="checkbox"){
				if(x.elements[i].checked==true) x.elements[i].value=1
				else x.elements[i].value =0
			}
		}		
	}
	
	function getAllAddition(byName,group){
		var str = ""
		var arr = document.getElementsByName(byName)
		for(var i=0;i<arr.length;i++){ 
			if(arr[i].checked==true) str += arr[i].value + "," 
		}
		str += "0"
		group.value = str
	}
	
	
	function checkMsgAdd(loiloaitin,loitieude,loiphude,loinhomsp,loisocho,loisocua,loikmdadi,loigia,loichieudai,loichieurong,loichieucao,loitrongluongkhongtai,loitrongluongtoantai,loicongsuatcucdai,loidungtichxilanh,loidungtichthungnhienlieu,loimuctieuhaonhienlieu,loiloainhienlieu,loihoten,loiemail,loitinhthanh){
		
		getAllAddition('addition',document.msgAdd.phude)
		
		var regEmail 	= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		var err			= ""
	
		var loaitin 	= document.msgAdd.loaitin.value
		var tieude 		= document.msgAdd.tieude.value
		var phude 		= document.msgAdd.phude.value
		var nhomsp_id	= document.msgAdd.nhomsp_id.value
		var socho		= document.msgAdd.socho.value
		var socua		= document.msgAdd.socua.value
		var kmdadi		= document.msgAdd.kmdadi.value
		var gia			= document.msgAdd.gia.value
		var chieudai	= document.msgAdd.chieudai.value
		var chieurong	= document.msgAdd.chieurong.value
		var chieucao	= document.msgAdd.chieucao.value
		
		var trongluongkhongtai		= document.msgAdd.trongluongkhongtai.value
		var trongluongtoantai		= document.msgAdd.trongluongtoantai.value
		var congsuatcucdai			= document.msgAdd.congsuatcucdai.value
		var dungtichxilanh			= document.msgAdd.dungtichxilanh.value
		var dungtichthungnhienlieu	= document.msgAdd.dungtichthungnhienlieu.value
		var muctieuhaonhienlieu		= document.msgAdd.muctieuhaonhienlieu.value
		
		var loainhienlieu	= document.msgAdd.loainhienlieu.value
		var hinhanh		= document.msgAdd.hinhanh1.value
		var hoten		= document.msgAdd.hoten.value
		var email		= document.msgAdd.email.value
		var tinhthanh	= document.msgAdd.tinhthanh.value
		
		if(loaitin=="") err += "* "+loiloaitin+"\n"
		
		if(tieude.indexOf(" ")==0||tieude.length<3) err += "* "+loitieude+"\n"
		
		var arr = phude.split(",")
		//alert('count:'+arr.length)
		if(phude=="" || phude=="0" || arr.length>11) err += '* '+loiphude+'\n'
		
		
		if(nhomsp_id==0) err += "* "+loinhomsp+"\n"
				
		if(socho!="" && isNaN(socho)) err += "* "+loisocho+"\n"
		
		if(socua!="" && isNaN(socua)) err += "* "+loisocua+"\n"
		
		if(kmdadi!="" && isNaN(kmdadi)) err += "* "+loikmdadi+"\n"
		
		if(gia!="" && isNaN(gia)) err += "* "+loigia+"\n"
		
		if(chieudai!="" && isNaN(chieudai)) err += "* "+loichieudai+"\n"
		
		if(chieurong!="" && isNaN(chieurong)) err += "* "+loichieurong+"\n"
		
		if(chieucao!="" && isNaN(chieucao)) err += "* "+loichieucao+"\n"

		if(trongluongkhongtai!="" && isNaN(trongluongkhongtai)) err += "* "+loitrongluongkhongtai+"\n"
		
		if(trongluongtoantai!="" && isNaN(trongluongtoantai)) err += "* "+loitrongluongtoantai+"\n"
		
		if(congsuatcucdai!="" && isNaN(congsuatcucdai)) err += "* "+loicongsuatcucdai+"\n"
		
		if(dungtichxilanh!="" && isNaN(dungtichxilanh)) err += "* "+loidungtichxilanh+"\n"
		
		if(dungtichthungnhienlieu!="" && isNaN(dungtichthungnhienlieu)) err += "* "+loidungtichthungnhienlieu+"\n"
		
		if(muctieuhaonhienlieu!="" && isNaN(muctieuhaonhienlieu)) err += "* "+loimuctieuhaonhienlieu+"\n"
								
		if(loainhienlieu=="") err += "* "+loiloainhienlieu+"\n"
						
		if(hoten.indexOf(" ")==0||hoten.length<3) err += "* "+loihoten+"\n"
		
		if(!regEmail.test(email))  err += "* "+loiemail+"\n"
		
		if(tinhthanh=="")  err += "* "+loitinhthanh+"\n"
				
		tickAllCheckBox()

		if(err!=""){
			alert(err)
			return false
		}else return true
	}
///////////////////////// MESSAGE MANAGE ////////////////////////////////

	function checkToFirst(formName){
		
		var arr = document.getElementsByName('first')
		var str=""
		for(i=0;i<arr.length;i++){	
			if(arr[i].checked == true) str=str+arr[i].value+","
		}
	
		formName.allfirst.value = str+"0"
		if(confirm("Are you ready !!!")) formName.submit()
		
	}
	
	function checkToDel(formName){
		
		var arr = document.getElementsByName('delete')
		var str=""
		for(i=0;i<arr.length;i++){	
			if(arr[i].checked == true) str=str+arr[i].value+","
		}
	
		formName.alldelete.value = str+"0"
		if(confirm("Are you ready !!!")) formName.submit()
		
	}
	
	function checkAllFirst(forName,check){
		
		var arr = document.getElementsByName('first')
		for(i=0;i<arr.length;i++){	
			arr[i].checked = check
		}
		
	}
	
	function checkAllDel(forName,check){
		
		var arr = document.getElementsByName('delete')
		for(i=0;i<arr.length;i++){	
			arr[i].checked = check
		}
		
	}
	
///////////////////// MESSAGE DETAIL ////////////////////////////////////
	function checkAllSave(){
		var arr = document.getElementsByName('saved')
		var str=""
		for(i=0;i<arr.length;i++){	
			arr[i].checked = document.msgSave.checked.checked
		}		
	}
	
	function checkToSave(){
		
		var arr = document.getElementsByName('saved')
		var str=""
		for(i=0;i<arr.length;i++){	
			if(arr[i].checked == true) str=str+arr[i].value+","
		}
	
		document.msgSave.allsaved.value = str
		if(confirm("Are you ready !!!")) document.msgSave.submit()
		
	}
///////////////////// MESSAGE SAVED////////////////////////////

	function checkAll(byName,checked){
		var arr = document.getElementsByName(byName)
		var str=""
		for(i=0;i<arr.length;i++){	
			arr[i].checked = checked
		}
	}
	function getAll(byName,param,obj){
		var arr = document.getElementsByName(byName)
		var str=""
		for(i=0;i<arr.length;i++){	
			if(arr[i].checked == true) str=str+arr[i].value+","
		}
		param.value = str
		if(confirm("Are you ready !!!")) obj.submit()
	}
	
/////////////////////////// CUST INFO PAGE //////////////////////////////////////

	function checkCustInfo(loihoten,loicanhan,loicongty,loidiachi,loiemail){
		
		var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		var hoten 		= document.custInfo.hoten.value
		var congty 		= document.custInfo.congty.value
		
		var diachi 		= document.custInfo.diachi.value
		
		var email	 	= document.custInfo.email.value
		
		
		var err	= ""
		
		
		if(document.custInfo.acept.checked==true) document.custInfo.dongy.value =1
		else document.custInfo.dongy.value =0
		canhan = ""
		
		if(document.getElementById('radcanhan').checked==true)	document.custInfo.canhan.value = 1
		else if(document.getElementById('radcongty').checked==true)	document.custInfo.canhan.value = 0

		if(hoten.indexOf(" ")==0||hoten.length<3){
			err += "* "+loihoten+"\n"
		}
		
		if(document.custInfo.canhan.value==""){
			err += "* "+loicanhan+"\n"
		}
		if(document.custInfo.canhan.value==0){
			if(congty.indexOf(" ")==0||congty.length<3){
				err += "* "+loicongty+"\n"
			}
		}
		if(diachi.indexOf(" ")==0||diachi.length<3){
			err += "* "+loidiachi+"\n"
		}
		if(!reg.test(email)){
			err += "* "+loiemail+"\n"
		}
		
		if(err!=""){
			alert(err)
			return false
		}else{
			return true
		}
	}
	
///////////////////////// CHANGE PASSWORD ///////////////////////////////

	function checkChangePass(loimatkhau,loinhaplai){
		
		var matkhau 	= document.changePass.matkhau.value
		var nhaplai 	= document.changePass.nhaplai.value
		var err			= ""
		if(matkhau=="" || matkhau.indexOf(" ")==0){
			err 		+= "* "+loimatkhau +"\n"	
		}

		if(nhaplai!=matkhau){
			err 		+= "* "+loinhaplai +"\n"	
		}
		if(err!=""){
			alert(err)
			return false
		}else return true
	}
////////////////////////////////////////////// MESSAGE ADD 2 //////////////////////////////////////////////////////
	function checkMsgAdd2(loiloaitin,loitieude,loiphude,loinhomsp,loigia,loitrongluongkhongtai,loitrongluongtoantai,loicongsuatcucdai,loidungtichxilanh,loidungtichthungnhienlieu,loimuctieuhaonhienlieu,loiloainhienlieu,loihoten,loiemail,loitinhthanh){
		
		getAllAddition('addition',document.msgAdd2.phude)
		
		var regEmail 	= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		var err			= ""
		
		var loaitin 	= document.msgAdd2.loaitin.value
		var tieude 		= document.msgAdd2.tieude.value
		var phude 		= document.msgAdd2.phude.value
		var nhomsp_id	= document.msgAdd2.nhomsp_id.value
		var gia			= document.msgAdd2.gia.value
		
		var trongluongkhongtai		= document.msgAdd2.trongluongkhongtai.value
		var trongluongtoantai		= document.msgAdd2.trongluongtoantai.value
		var congsuatcucdai			= document.msgAdd2.congsuatcucdai.value
		var dungtichxilanh			= document.msgAdd2.dungtichxilanh.value
		var dungtichthungnhienlieu	= document.msgAdd2.dungtichthungnhienlieu.value
		var muctieuhaonhienlieu		= document.msgAdd2.muctieuhaonhienlieu.value
		
		var loainhienlieu	= document.msgAdd2.loainhienlieu.value
		var hinhanh		= document.msgAdd2.hinhanh1.value
		var hoten		= document.msgAdd2.hoten.value
		var email		= document.msgAdd2.email.value
		var tinhthanh	= document.msgAdd2.tinhthanh.value
		
		if(loaitin=="") err += "* "+loiloaitin+"\n"
		
		if(tieude.indexOf(" ")==0||tieude.length<3) err += "* "+loitieude+"\n"
		
		var arr = phude.split(",")
		//alert('count:'+arr.length)
		if(phude=="" || phude=="0" || arr.length>11) err += '* '+loiphude+'\n'
		
		if(nhomsp_id==0) err += "* "+loinhomsp+"\n"
				
		if(gia!="" && isNaN(gia)) err += "* "+loigia+"\n"
		
		if(trongluongkhongtai!="" && isNaN(trongluongkhongtai)) err += "* "+loitrongluongkhongtai+"\n"
		
		if(trongluongtoantai!="" && isNaN(trongluongtoantai)) err += "* "+loitrongluongtoantai+"\n"
		
		if(congsuatcucdai!="" && isNaN(congsuatcucdai)) err += "* "+loicongsuatcucdai+"\n"
		
		if(dungtichxilanh!="" && isNaN(dungtichxilanh)) err += "* "+loidungtichxilanh+"\n"
		
		if(dungtichthungnhienlieu!="" && isNaN(dungtichthungnhienlieu)) err += "* "+loidungtichthungnhienlieu+"\n"
		
		if(muctieuhaonhienlieu!="" && isNaN(muctieuhaonhienlieu)) err += "* "+loimuctieuhaonhienlieu+"\n"
								
		if(loainhienlieu=="") err += "* "+loiloainhienlieu+"\n"
						
		if(hoten.indexOf(" ")==0||hoten.length<3) err += "* "+loihoten+"\n"
		
		if(!regEmail.test(email))  err += "* "+loiemail+"\n"
		
		if(tinhthanh=="")  err += "* "+loitinhthanh+"\n"
				
		if(err!=""){
			alert(err)
			return false
		}else return true
	}
	
////////////////////////////////////////////// MESSAGE ADD 3 /////////////////////////////////////////////////

	function checkMsgAdd3(loiloaitin,loitieude,loiphude,loinhomsp,loikmdadi,loigia,loidocaoyenxe,loikcgiuahaitrucbanhxe,loikhoangcachgam,loihoten,loiemail,loitinhthanh){
		
		getAllAddition('addition',document.msgAdd3.phude)
		var regEmail 	= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		var err			= ""
		
		var loaitin 	= document.msgAdd3.loaitin.value
		var tieude 		= document.msgAdd3.tieude.value
		var phude 		= document.msgAdd3.phude.value
		
		var nhomsp_id	= document.msgAdd3.nhomsp_id.value
		var kmdadi		= document.msgAdd3.kmdadi.value
		var gia			= document.msgAdd3.gia.value
		var docaoyenxe	= document.msgAdd3.docaoyenxe.value
		
		var kcgiuahaitrucbanhxe	= document.msgAdd3.kcgiuahaitrucbanhxe.value
		var khoangcachgam		= document.msgAdd3.khoangcachgam.value
		
		var hoten		= document.msgAdd3.hoten.value
		var email		= document.msgAdd3.email.value
		var tinhthanh	= document.msgAdd3.tinhthanh.value
	
		if(loaitin=="") err += "* "+loiloaitin+"\n"
		
		if(tieude.indexOf(" ")==0||tieude.length<3) err += "* "+loitieude+"\n"
		
		var arr = phude.split(",")
		//alert('count:'+arr.length)
		if(phude=="" || phude=="0" || arr.length>11) err += '* '+loiphude+'\n'
		
		if(nhomsp_id==0) err += "* "+loinhomsp+"\n"
						
		if(kmdadi!="" && isNaN(kmdadi)) err += "* "+loikmdadi+"\n"
		
		if(gia!="" && isNaN(gia)) err += "* "+loigia+"\n"
		
		if(docaoyenxe!="" && isNaN(docaoyenxe)) err += "* "+loidocaoyenxe+"\n"
		
		if(kcgiuahaitrucbanhxe!="" && isNaN(kcgiuahaitrucbanhxe)) err += "* "+loikcgiuahaitrucbanhxe+"\n"
		
		if(khoangcachgam!="" && isNaN(khoangcachgam)) err += "* "+loikhoangcachgam+"\n"
				
		if(hoten.indexOf(" ")==0||hoten.length<3) err += "* "+loihoten+"\n"
		
		if(!regEmail.test(email))  err += "* "+loiemail+"\n"
		
		if(tinhthanh=="")  err += "* "+loitinhthanh+"\n"
				
		if(err!=""){
			alert(err)
			return false
		}else return true
	}
	
	
////////////////////////////////////////////// MESSAGE ADD 4 /////////////////////////////////////////////////

	function checkMsgAdd4(loiloaitin,loitieude,loiphude,loitenphutung,loinhomsp,loigia,loihoten,loiemail,loitinhthanh){
		getAllAddition('addition',document.msgAdd4.phude)
		var regEmail 	= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		var err			= ""
		
		var loaitin 	= document.msgAdd4.loaitin.value
		var tieude 		= document.msgAdd4.tieude.value
		var phude 		= document.msgAdd4.phude.value
		var tenphutung	= document.msgAdd4.tenphutung.value
		var nhomsp_id	= document.msgAdd4.nhomsp_id.value
		var gia			= document.msgAdd4.gia.value
		
		var hoten		= document.msgAdd4.hoten.value
		var email		= document.msgAdd4.email.value
		var tinhthanh	= document.msgAdd4.tinhthanh.value
	
		if(loaitin=="") err += "* "+loiloaitin+"\n"
		
		if(tieude.indexOf(" ")==0||tieude.length<3) err += "* "+loitieude+"\n"
		
		var arr = phude.split(",")
		//alert('count:'+arr.length)
		if(phude=="" || phude=="0" || arr.length>11) err += '* '+loiphude+'\n'
		
		if(tenphutung.indexOf(" ")==0 || tenphutung.length<3) err += "* "+loitenphutung+"\n"
		
		if(nhomsp_id==0) err += "* "+loinhomsp+"\n"
								
		if(gia!="" && isNaN(gia)) err += "* "+loigia+"\n"
				
		if(hoten.indexOf(" ")==0||hoten.length<3) err += "* "+loihoten+"\n"
		
		if(!regEmail.test(email))  err += "* "+loiemail+"\n"
		
		if(tinhthanh=="")  err += "* "+loitinhthanh+"\n"
				
		if(err!=""){
			alert(err)
			return false
		}else return true
	}

////////////////////////////////////////////// MESSAGE ADD 5 /////////////////////////////////////////////////

	function checkMsgAdd5(loiloaitin,loitieude,loiphude,loinhomsp,loigia,loichieudai,loichieurong,loichieucao,loiloainhienlieu,loihoten,loiemail,loitinhthanh){
		getAllAddition('addition',document.msgAdd5.phude)
		var regEmail 	= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
		var err			= ""
		
		var loaitin 	= document.msgAdd5.loaitin.value
		var tieude 		= document.msgAdd5.tieude.value
		var phude 		= document.msgAdd5.phude.value
		var nhomsp_id	= document.msgAdd5.nhomsp_id.value
		var gia			= document.msgAdd5.gia.value
		var chieudai	= document.msgAdd5.chieudai.value
		var chieurong	= document.msgAdd5.chieurong.value
		var chieucao	= document.msgAdd5.chieucao.value
		var loainhienlieu	= document.msgAdd5.loainhienlieu.value
		var hoten		= document.msgAdd5.hoten.value
		var email		= document.msgAdd5.email.value
		var tinhthanh	= document.msgAdd5.tinhthanh.value
		
		if(loaitin=="") err += "* "+loiloaitin+"\n"
		
		if(tieude.indexOf(" ")==0||tieude.length<3) err += "* "+loitieude+"\n"
		
		var arr = phude.split(",")
		//alert('count:'+arr.length)
		if(phude=="" || phude=="0" || arr.length>11) err += '* '+loiphude+'\n'
		
		if(nhomsp_id==0) err += "* "+loinhomsp+"\n"
				
		if(gia!="" && isNaN(gia)) err += "* "+loigia+"\n"
		
		if(chieudai!="" && isNaN(chieudai)) err += "* "+loichieudai+"\n"
		
		if(chieurong!="" && isNaN(chieurong)) err += "* "+loichieurong+"\n"
		
		if(chieucao!="" && isNaN(chieucao)) err += "* "+loichieucao+"\n"
		
		if(loainhienlieu=="") err += "* "+loiloainhienlieu+"\n"
						
		if(hoten.indexOf(" ")==0||hoten.length<3) err += "* "+loihoten+"\n"
		
		if(!regEmail.test(email))  err += "* "+loiemail+"\n"
		
		if(tinhthanh=="")  err += "* "+loitinhthanh+"\n"
						
		if(err!=""){
			alert(err)
			return false
		}else return true
	}


	//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
	//** Last updated: Nov 8th, 06
	
	var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?
	
	////NO NEED TO EDIT BELOW////////////////////////
	var tabcontentIDs=new Object()
	
	function expandcontent(linkobj){
	var ulid=linkobj.parentNode.parentNode.id //id of UL element
	var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
	for (var i=0; i<ullist.length; i++){
	ullist[i].className=""  //deselect all tabs
	if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
	document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
	}
	linkobj.parentNode.className="selected"  //highlight currently clicked on tab
	document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
	saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
	}
	
	function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
	var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
	if (thetab.getAttribute("rel"))
	expandcontent(thetab)
	}
	
	function savetabcontentids(ulid, relattribute){// save ids of tab content divs
	if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
	tabcontentIDs[ulid]=new Array()
	tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
	}
	
	function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
	if (enabletabpersistence==1) //if persistence feature turned on
	setCookie(ulid, selectedtabid)
	}
	
	function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
	var ullist=document.getElementById(ulid).getElementsByTagName("li")
	for (var i=0; i<ullist.length; i++){
	if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
	return ullist[i].getElementsByTagName("a")[0]
	break
	}
	}
	}
	
	function initializetabcontent(){
	for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
	if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
	setCookie(arguments[i], "")
	var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
	var ulobj=document.getElementById(arguments[i])
	var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
	for (var x=0; x<ulist.length; x++){ //loop through each LI element
	var ulistlink=ulist[x].getElementsByTagName("a")[0]
	if (ulistlink.getAttribute("rel")){
	savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
	ulistlink.onclick=function(){
	expandcontent(this)
	return false
	}
	if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
	expandcontent(ulistlink) //auto load currenly selected tab content
	}
	} //end inner for loop
	if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
	var culistlink=getullistlinkbyId(arguments[i], clickedontab)
	if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
	expandcontent(culistlink) //auto load currenly selected tab content
	else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
	expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
	}
	} //end outer for loop
	}
	
	
	function getCookie(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
	return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
	}
	
	function setCookie(name, value){
	document.cookie = name+"="+value //cookie value is domain wide (path=/)
	}

	// END TAB CONTENT 
