function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		xmlHttp =new ActiveXObject("Msxml2.XMLHTTP"); 
	}catch(e){ 
		try{ 
			xmlHttp =new ActiveXObject("Microsoft.XMLHTTP"); 
		}catch(e){ 
			try{
		  		// Firefox, Opera 8.0+, Safari
  				xmlHttp=new XMLHttpRequest();
		  	}catch (e){
				xmlHttp =false; 
			}
		} 
	}
	return xmlHttp;
}
function Show_File(url){
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	var xmlHttp = GetXmlHttpObject()
	xmlHttp.open("GET",url, false)
	//url=url+"&sid="+Math.random();
	//xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.send(null)
	return xmlHttp.responseText
}
function stateChanged(){ 
	if (xmlHttp.readyState==4){ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}
}
function On_Link(lnk,dv){
	document.getElementById(dv).innerHTML = Show_File(lnk)
}
//***********************************************
function ChangeStyle(nm,vl){
	nm.style.fontWeight=vl
}

function ChangeType(value,name,type){
	x = document.getElementById(name)
	if(type=='images'){
		x.src = value
	}else if(type=='background'){
		x.style.background = "url("+value+")"
	}else if(type=='bgcolor'){
		x.style.background = value
	}else if(type=='class'){
		x.className = value
	}
}
//Check Mail Yahoo
//function CheckMail_OnOff(vl){
	//var mail = Show_File('http://opi.yahoo.com/online?u='+vl+'&amp;m=g&amp;t=2&amp;l=us')
	//alert('('+mail+')')
//}
//GIF89a@
//CheckMail_OnOff('tpvlang')
//Goi bang Date
	var activeElement = false;
	function setDate( elementName )	{
		//activeElement = document.forms[0].elements[ elementName ];
		activeElement = document.getElementById(elementName);
		var w = window.open("images/DateSelector.html", "DateSelector", "width=280,height=260,resizable=no,scrollbars=no,menu=no,location=no,status=no");
		w.focus();
	}
	function GetDateSelectorDate() { return activeElement.value; }
	function SetDateSelectorDate( dateString ) { activeElement.value = dateString; }
//*********************************
function LinkNhan(vl){
	window.open('Index.asp?show=tknc');
	window.location = 'Index.asp?show=' + vl
}
function checkKeycode(e) {
	var keycode;
	var ty = document.frm.slTopSearch.value;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	if(keycode == 13){
		if(ty == 'nh'){
			TraCuuWeb('?show=searchhhdv');
		}else if(ty == 'kd'){
			TraCuuWeb('?show=searchkd');
		}else if(ty == 'sc'){
			TraCuuWeb('?show=searchsc');
		}else if(ty == 'tt'){
			TraCuuWeb('?show=searchtt');
		}
	}
}
function SearchTopMenu() {
	var ty = document.frm.slTopSearch.value;
	if(ty == 'nh'){
		TraCuuWeb('?show=searchhhdv');
	}else if(ty == 'kd'){
		TraCuuWeb('?show=searchkd');
	}else if(ty == 'sc'){
		TraCuuWeb('?show=searchsc');
	}else if(ty == 'tt'){
		TraCuuWeb('?show=searchtt');
	}
}
function Blank(){}
function On_ShowList(show,lnk){
	if(show=='nhanhieu'){
		//document.frm.action = "Submit.asp?show=" + show  + "&list=list"
		On_Link('NhanHieu.asp?list=list','dvMain')
	}else if(show=='hinhnhan'){
		//document.frm.action = "Submit.asp?show=" + show + "&list=list"
		On_Link('HinhAnhNhan.asp?list=list','dvMain')
	}else if(show=='dssp'){
		//document.frm.action = "Submit.asp?show=" + show + lnk + "&list=list"		
		On_Link('DSSanPham.asp?list=list'+lnk,'dvMain')
	}else if(show=='ngthn'){
		On_Link('NgayThangNam.asp?list=list','dvMain')
	}else if(show=='diachi'){
		On_Link('DiaChi.asp?list=list','dvMain')
	}
}
function On_ShowPicture(show,lnk){
	if(show=='nhanhieu'){
		//document.frm.action = "Submit.asp?show=" + show + "&list=picture"
		On_Link('NhanHieu.asp?list=picture','dvMain')
	}else if(show=='hinhnhan'){
		//document.frm.action = "Submit.asp?show=" + show + "&list=picture"
		On_Link('HinhAnhNhan.asp?list=picture','dvMain')
	}else if(show=='dssp'){
		//document.frm.action = "Submit.asp?show=" + show + lnk + "&list=picture"
		On_Link('DSSanPham.asp?list=picture'+lnk,'dvMain')
	}else if(show=='ngthn'){
		On_Link('NgayThangNam.asp?list=picture','dvMain')
	}else if(show=='diachi'){
		On_Link('DiaChi.asp?list=picture','dvMain')
	}
}

function SearchNhanHieu(pg){
	document.frm.action = "Submit.asp?show=searchnhanhieu"
	document.frm.submit()
	setTimeout("On_Link('NhanHieu.asp?pg="+pg+"','dvMain')",2000)
}
function SearchSoDon(pg){
	document.frm.action = "Submit.asp?show=searchsodon"
	document.frm.submit()
	setTimeout("On_Link('SoDon.asp?pg="+pg+"','dvMain')",2000)
}
function SearchSoBang(pg){
	document.frm.action = "Submit.asp?show=searchvanbang"
	document.frm.submit()
	setTimeout("On_Link('SoVanBang.asp?pg="+pg+"','dvMain')",2000)
}
function SearchChuSoHuu(pg){
	document.frm.action = "Submit.asp?show=searchchusohuu"
	document.frm.submit()
	setTimeout("On_Link('ChuSoHuu.asp?pg="+pg+"','dvMain')",2000)
}
function SearchDate(pg){
	document.frm.action = "Submit.asp?show=searchdate"
	document.frm.submit()
	setTimeout("On_Link('NgayThangNam.asp?pg="+pg+"','dvMain')",2000)
}
function SearchTinhThanh(pg){
	document.frm.action = "Submit.asp?show=searchtinhthanh"
	document.frm.submit()
	setTimeout("On_Link('TinhThanh.asp?pg="+pg+"','dvMain')",2000)
}
function SearchDiaChi(pg){
	document.frm.action = "Submit.asp?show=searchdiachi"
	document.frm.submit()
	setTimeout("On_Link('DiaChi.asp?pg="+pg+"','dvMain')",2000)
}

function SearchDanhBa(pg){
	document.frm.action = "Submit.asp?show=danhba"
	document.frm.submit()
	setTimeout("On_Link('DanhBa.asp?pg="+pg+"','dvMain')",1000)
}
function SearchSanPhamCL(lnk){
	document.frm.action = "Submit.asp?show=spcl"
	document.frm.submit()
	setTimeout("On_Link('SanPhamChatLuong.asp?"+lnk+"','dvMain')",1000)
}
function SearchSanPham(lnk){
	document.frm.action = "Submit.asp?show=dmspcl"
	document.frm.submit()
	setTimeout("On_Link('DanhMucSanPhamChatLuong.asp?"+lnk+"','dvMain')",1000)
}
function SearchSanPhamCT(pg){
	document.frm.action = "Submit.asp?show=ctspcl"
	document.frm.submit()
	setTimeout("On_Link('ChiTietSanPhamChatLuong.asp?pg="+pg+"','dvMain')",1000)
}
function SearchCongTy(vl){
	document.frm.slDM.value = vl
	document.frm.action = "Submit.asp?show=dmspcl"
	document.frm.submit()
	setTimeout("javascript:window.location='?show=dmspcl&pg=1&pgtc=1'",1000)
}

function TraCuuWeb(lnk){
	//if(nm == 'searchhhdv'){
		document.frm.action = "Submit.asp" + lnk
		document.frm.submit()
		On_Link('TraCuuWeb.asp','dvMain');
		//window.open('ListTraCuu.asp' + lnk)
		setTimeout("On_Link('ListTraCuu.asp" + lnk + "','dvTraCuu')",3000)
}

function DangKyTV(){
	var login = document.frm.txtLogin.value
	var pass = document.frm.txtPass.value
	var repass = document.frm.txtRePass.value
	var name = document.frm.txtName.value
	var email = document.frm.txtEmail.value
	if(TrimStr(login) == ''){
		alert('Tên đăng nhập chưa được nhập !')
		document.frm.txtLogin.focus()
	}else if(TrimStr(pass) == ''){
		alert('Mật khẩu chưa được nhập !')
		document.frm.txtPass.focus()
	}else if(TrimStr(pass) != TrimStr(repass)){
		alert('Phần xác nhận chưa giống với mật khẩu được nhập !')
		document.frm.txtRePass.focus()
	}else if(TrimStr(name) == ''){
		alert('Họ tên chưa được nhập !')
		document.frm.txtName.focus()
	}else if(TrimStr(email) == ''){
		alert('Email chưa được nhập !')
		document.frm.txtEmail.focus()
	}else if(CheckEmail(email) == false){
		alert('Vui lòng kiểm tra lại email !')
		document.frm.txtEmail.focus()
	}else{
		document.frm.action = "Submit.asp?show=reg"
		document.frm.submit()
		setTimeout("On_Link('DangKyThanhVien.asp','dvMain')",3000)
	}
}

function On_LienHe(){
	var nguoi = document.frm.txtNguoi.value
	var tel = document.frm.txtDienThoai.value
	var email = document.frm.txtEmail.value
	var dt = document.frm.txtDeTai.value
	if(TrimStr(nguoi) == ''){
		alert('Người liên hệ chưa được nhập !')
		document.frm.txtNguoi.focus()
	}else if(TrimStr(tel) == ''){
		alert('Số điện thoại chưa được nhập !')
		document.frm.txtDienThoai.focus()
	}else if(TrimStr(email) == ''){
		alert('Email chưa được nhập !')
		document.frm.txtEmail.focus()
	}else if(CheckEmail(email) == false){
		alert('Vui lòng kiểm tra lại email !')
		document.frm.txtEmail.focus()
	}else if(TrimStr(dt) == ''){
		alert('Tên đề tài chưa được nhập !')
		document.frm.txtDeTai.focus()
	}else{
		document.frm.action = "Submit.asp?show=lienhe"
		document.frm.submit()
		setTimeout("On_Link('LienHe.asp','dvMain')",3000)
	}
}

function ChangPass(){
	var pass = document.frm.txtPass.value
	var repass = document.frm.txtRePass.value
	var old = document.frm.txtPassOld.value
	if(TrimStr(old) == ''){
		alert('Mật khẩu mới chưa được nhập !')
		document.frm.txtPassOld.focus()
	}else if(TrimStr(pass) == ''){
		alert('Mật khẩu chưa được nhập !')
		document.frm.txtPass.focus()
	}else if(TrimStr(pass) != TrimStr(repass)){
		alert('Phần xác nhận chưa giống với mật khẩu mới được nhập !')
		document.frm.txtRePass.focus()
	}else{
		document.frm.action = "Submit.asp?show=cpss"
		document.frm.submit()
		setTimeout("On_Link('DoiMatKhau.asp','dvMain')",3000)
	}
}
function On_Login(){
	var email = document.frm.btEmail.value
	if(TrimStr(email) != null){
		if(CheckEmail(email)  == true){
			document.frm.action = "Submit.asp?show=login"
			document.frm.submit()
			setTimeout("On_Link('Login.asp','dvLogin')",3000)
			alert("Bạn đã đăng ký nhận tin thành công! Trademarkvietnam sẽ gởi đến bạn những thông tin mới nhất về nhãn hiệu, sở hữu trí tuệ, đăng ký độc quyền,....")
		}else{
			alert("Vui lòng kiểm tra lại email!")
			document.frm.btEmail.focus();
		}
	}
}

function ReMail(){
	var email = document.frm.txtEmail.value
	if(TrimStr(email) == ''){
		alert('Email chưa được nhập !')
		document.frm.txtEmail.focus()
	}else if(CheckEmail(email) == false){
		alert('Vui lòng kiểm tra lại email !')
		document.frm.txtEmail.focus()
	}else{
		document.frm.action = "Submit.asp?show=spass"
		document.frm.submit()
		setTimeout("On_Link('QuenMatKhau.asp','dvMain')",3000)
	}
}

function BinhChon(){
	var hoten = document.frm.txtHoTen.value
	var diachi = document.frm.txtDiaChi.value
	var email = document.frm.txtEmail.value
	var bc1 = document.frm.txtBC1.value
	var bc2 = document.frm.txtBC2.value
	var bc3 = document.frm.txtBC3.value
	var bc4 = document.frm.txtBC4.value
	var bc5 = document.frm.txtBC5
	var code = document.frm.txtCode.value
	var str = bc1 + bc2 + bc3 + bc4
	var msg = ''
	if(hoten == '')
		msg = '1'
	if(diachi == '')
		msg = msg + '2'
	if(email == '' || CheckEmail(email) == false)
		msg = msg + '3'
	if(str == '' && bc5.checked==false)
		msg = msg + '4'
	if(msg == ''){
		document.frm.action = "Submit.asp?show=bchon"
		document.frm.submit()
		setTimeout("On_Link('Msg.asp?msg=0','dvMsg')",3000)
		setTimeout("On_Link('NhanHieuNoiTieng.asp','dvMain')",500)
	}else{
		On_Link('Msg.asp?msg='+msg+'&code='+code,'dvMsg')	
	}
}
function Check09(vl){
	var str = vl.value;
	//var fg = CheckBC();
	if(str.charCodeAt(0) > 48 && str.charCodeAt(0) < 52){
		document.frm.txtBC1.value = "";
		document.frm.txtBC2.value = "";
		document.frm.txtBC3.value = "";
		document.frm.txtBC4.value = "";		
		vl.value = str
	}else{
		vl.value = ""
	}
}
function ClearText(vl){
	if(vl.value=='gõ chữ tiếng việt có dấu'){
		vl.value = ""
	}else if(vl.value==''){
		vl.value = 'gõ chữ tiếng việt có dấu'
	}
}
function CheckEmail(vl){
	fg = false
	if(vl.indexOf('@') > 0){
		vl = vl.substring(vl.indexOf('@')+1,vl.length-1)
		if(vl.indexOf('.') > 0){
			fg = true
		}
	}
	return fg
}
function ChangeNhom(n){
	if(n==1){
		var vl = document.frm.slNhom.options[document.frm.slNhom.selectedIndex].value
		On_Link('ChangeGroup.asp?ty='+vl+'&sub='+n,'dvNganhNghe')
	}
}
function Submit(frm,show){
	document.frm.action = "Submit.asp?show=" + show
	document.frm.submit();
	a = setTimeout("On_Link('" + frm + "','dvMain')",500)
}
function ChangeImages(x,y,z,nm){
	img = document.getElementById(nm)
	if(img.src.indexOf(x) > 1){
		img.src = y
	}else if(img.src.indexOf(y) > 1){
		img.src = z
	}else{
		img.src = x
	}
	setTimeout("ChangeImages('"+x+"','"+y+"','"+z+"','"+nm+"')",3000)
}
function LogoRightChange(vl){
	var j = 1;
	for(var i=0;i<33;i++){
		if(vl==1){
			document.getElementById('img_'+j).src = 'LogoRight/' + mylogo[(i+1)]
			document.getElementById('lnk_'+j).href = mylink[(i+1)]
			j++;
		}else if(vl==2){
			document.getElementById('img_'+j).src = 'LogoRight/' + mylogo[(i+2)]
			document.getElementById('lnk_'+j).href = mylink[(i+2)]
			j++;
		}else if(vl==3){
			document.getElementById('img_'+j).src = 'LogoRight/' + mylogo[(i)]
			document.getElementById('lnk_'+j).href = mylink[(i)]
			j++;
		}
		i = i + 2
	}
	if(vl==3){
		vl = 1	
	}else{
		vl = vl + 1	
	}
	setTimeout("LogoRightChange(" + vl + ")",3000)
}


function startDateTime(){
	var today=new Date()
	var h=today.getHours()
	var m=today.getMinutes()
	var s=today.getSeconds()
	var dd = today.getDate()
	var mm = today.getMonth() + 1
	var yy = today.getFullYear()
	// add a zero in front of numbers<10
	m=checkAddZero(m)
	s=checkAddZero(s)
	dd=checkAddZero(dd)
	mm=checkAddZero(mm)
	document.getElementById('divDateTime').innerHTML= APM(h)+":"+m+"&nbsp;"+checkAPM(h)+"&nbsp;&nbsp;&nbsp;"+dd+"/"+mm+"/"+yy
	t=setTimeout('startDateTime()',1000)
}
function checkAddZero(i){
	if (i<10){i="0" + i}
  	return i
}
function checkAPM(i){
	var kq;
	if (i<12){
		kq = "AM"
	}else{
		kq = "PM"
	}
  	return kq;
}
function APM(i){
	var kq;
	if (i<12){
		kq = i
	}else{
		kq = i - 12
	}
  	return kq;
}
function TrimStr(vl){
	var xfg = true
	var yfg = true
	var i = 0
	var j = vl.length - 1
	var cnt = vl.length - 1
	while(1 == 1){
		if(vl.charCodeAt(i) == 32){			
			i++
		}else if(xfg == true){
			x = i
			xfg = false
		}
			
		if(vl.charCodeAt(j) == 32){			
			j--
		}else if(yfg == true){
			y = j + 1
			yfg = false
		}
		if(xfg == false && yfg == false){
			vl = vl.substring(x,y)	
			break;}
				
		if(i >= j){
			vl = ''
			break;}
	}
	return vl;
}
//***********************************************
function mmLoadMenus() {
  if (window.mm_menu_0607092839_0) return;
  window.mm_menu_0607092839_0 = new Menu("root",150,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#DDDDDD","#DA251D","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
  mm_menu_0607092839_0.addMenuItem("Ki&#7875;u Dáng Công Nghi&#7879;p","window.open('?show=tintuc&ty=4', '_self');");
  mm_menu_0607092839_0.addMenuItem("Nhãn Hi&#7879;u","window.open('?show=tintuc&ty=5', '_self');");
  mm_menu_0607092839_0.addMenuItem("Tin Khác","window.open('?show=tintuc&ty=2', '_self');");
   mm_menu_0607092839_0.fontWeight="bold";
   mm_menu_0607092839_0.hideOnMouseOut=true;
   mm_menu_0607092839_0.bgColor='#FFFFFF';
   mm_menu_0607092839_0.menuBorder=0;
   mm_menu_0607092839_0.menuLiteBgColor='#0000FF';
   mm_menu_0607092839_0.menuBorderBgColor='#FFFFFF';
   
	window.mm_menu_0607110637_0 = new Menu("root",120,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#DDDDDD","#DA251D","left","middle",3,0,1000,-5,7,true,true,true,0,false,false);
  mm_menu_0607110637_0.addMenuItem("Châu&nbsp;Âu","window.open('http://ep.espacenet.com/', '_blank');");
  mm_menu_0607110637_0.addMenuItem("Hoa&nbsp;Kỳ&nbsp;(USPTO)","window.open('http://www.uspto.gov/', '_blank');");
  mm_menu_0607110637_0.addMenuItem("Hàn&nbsp;Quốc","window.open('http://www.kipo.go.kr/kpo2/ek/?catmenu=KIPOENG', '_blank');");
  mm_menu_0607110637_0.addMenuItem("Nhật&nbsp;Bản","window.open('http://www.ipdl.inpit.go.jp/homepg_e.ipdl', '_blank');");
  mm_menu_0607110637_0.addMenuItem("Trung&nbsp;Quốc","window.open('http://www.sipo.gov.cn', '_blank');");
  mm_menu_0607110637_0.addMenuItem("Úc","window.open('http://www.ipaustralia.gov.au/', '_blank');");
  mm_menu_0607110637_0.addMenuItem("WIPO","window.open('http://www.wipo.int/ipdl/en/', '_blank');");
   mm_menu_0607110637_0.fontWeight="bold";
   mm_menu_0607110637_0.hideOnMouseOut=true;
   mm_menu_0607110637_0.bgColor='#FFFFFF';
   mm_menu_0607110637_0.menuBorder=0;
   mm_menu_0607110637_0.menuLiteBgColor='#0000FF';
   mm_menu_0607110637_0.menuBorderBgColor='#000000';
   
window.mm_menu_0611085917_0 = new Menu("root",90,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#DDDDDD","#DA251D","left","middle",3,0,1000,-5,7,true,true,true,0,false,false);
   mm_menu_0611085917_0.addMenuItem("Cạnh Tranh","window.open('?show=tintuc&ty=3', '_self');");
   mm_menu_0611085917_0.addMenuItem("Tranh Chấp","window.open('?show=tintuc&ty=1', '_self');");
   mm_menu_0611085917_0.fontWeight="bold";
   mm_menu_0611085917_0.hideOnMouseOut=true;
   mm_menu_0611085917_0.bgColor='#FFFFFF';
   mm_menu_0611085917_0.menuBorder=0;
   mm_menu_0611085917_0.menuLiteBgColor='#0000FF';
   mm_menu_0611085917_0.menuBorderBgColor='#000000';
   
   window.mm_menu_0611085916_0 = new Menu("root",220,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#DDDDDD","#DA251D","left","middle",3,0,1000,-5,7,true,true,true,0,false,false);
   mm_menu_0611085916_0.addMenuItem("Nhãn Hiệu Và Các Dấu Hiệu Nhận Biết","window.open('?show=dauhieu1', '_self');");
   mm_menu_0611085916_0.addMenuItem("Thương hiệu - Logo - Nhãn Hiệu","window.open('?show=dauhieu2', '_self');");
   mm_menu_0611085916_0.fontWeight="bold";
   mm_menu_0611085916_0.hideOnMouseOut=true;
   mm_menu_0611085916_0.bgColor='#FFFFFF';
   mm_menu_0611085916_0.menuBorder=0;
   mm_menu_0611085916_0.menuLiteBgColor='#0000FF';
   mm_menu_0611085916_0.menuBorderBgColor='#000000';

	mm_menu_0611085916_0.writeMenus();
} 

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

//*************************************
function DangKyNhan(){
	var nlhe = document.frm.txtNLhe;
	var cmnd = document.frm.txtCmnd;
	var dch = document.frm.txtDchi;
	var dth = document.frm.txtDThoai;
	var ddo = document.frm.txtDDong;
	var eml = document.frm.txtEmail;
	var cvu = document.frm.txtCvu;
	var ttv = document.frm.txtTtv;
	var dch1 = document.frm.txtDchi1;
	var dth1 = document.frm.txtDThoai1;
	var fax = document.frm.txtFax;
	var eml1 = document.frm.txtEmail1;
	var gd = document.frm.txtTgd;
	var ycau = document.frm.txtYCau;
	var dsdk = document.frm.dsNhanDk;
	var maso = document.frm.txtMaSo;
	var shw = document.frm.txtShow;
	
	if(nlhe.value == ''){
		alert('Vui lòng nhập Người liên hệ!')
		nlhe.focus();
	}else if(cmnd.value == ''){
		alert('Vui lòng nhập CMND!')
		cmnd.focus();
	}else if(dch.value == ''){
		alert('Vui lòng nhập Địa chỉ!')
		dch.focus();
	}else if(dth.value == ''){
		alert('Vui lòng nhập Điện thoại!')
		dth.focus();
	}else if(ddo.value == ''){
		alert('Vui lòng nhập Di động!')
		ddo.focus();
	}else if(eml.value == ''){
		alert('Vui lòng nhập E-mail!')
		eml.focus();
	}else if(eml.value != '' && CheckEmail(eml.value) == false){
		alert('Vui lòng kiểm tra E-mail!')
		eml.focus();
	}else if(cvu.value == ''){
		alert('Vui lòng nhập Chức vụ!')
		cvu.focus();
	}else if(ttv.value == ''){
		alert('Vui lòng nhập Tên tiếng Việt!')
		ttv.focus();
	}else if(dch1.value == ''){
		alert('Vui lòng nhập Địa chỉ!')
		dch1.focus();
	}else if(dth1.value == ''){
		alert('Vui lòng nhập Điện thoại!')
		dth1.focus();
	}else if(fax.value == ''){
		alert('Vui lòng nhập Fax!')
		fax.focus();
	}else if(eml1.value == ''){
		alert('Vui lòng nhập E-mail!')
		eml1.focus();
	}else if(eml1.value != '' && CheckEmail(eml1.value) == false){
		alert('Vui lòng kiểm tra E-mail!')
		eml1.focus();
	}else if(gd.value == ''){
		alert('Vui lòng nhập Giám đốc!')
		gd.focus();
	}else if(ycau.text == ''){
		alert('Vui lòng nhập Yêu cầu!')
		ycau.focus();
	}else if(dsdk.value == ''){
		alert('Vui lòng nhập Nhãn hiệu!')
	}else if(maso.value != shw.value){
		alert('Vui lòng kiểm tra Mã số bảo mật!')
	}else{
		document.frm.action = "Submit.asp?show=dknh"
		document.frm.submit();
		setTimeout("On_Link('DangKyNhanHieu.asp','dvMain')",3000)	
	}
}

function AddNhanHieu(show){
	var tennhan = document.frm.txtNhan;
	var hinhnhan = document.frm.dkHinh;
	var dsnhan = document.getElementById("dsHHDV").innerHTML;
	if(tennhan.value == ''){
		alert('Vui lòng nhập tên nhãn!')
		tennhan.focus();
	}else if(hinhnhan.value == ''){
		alert('Vui lòng chọn hình nhãn!')
		hinhnhan.focus();
	}else if(dsnhan == ''){
		alert('Vui lòng chọn loại nhãn!')
	}else if(previewImage(hinhnhan) == false){
		hinhnhan.focus()
	}else{
		document.frm.action = "Submit.asp?show=" + show
		document.frm.submit();
		setTimeout("On_Link('ThemNhanDangKy.asp','dsNhan')",3000)	
	}
}

function previewImage(pathField){ 
	var path = pathField.value.toLowerCase();
	var img = new Image();
	var fg = false;
	if (path.indexOf('.jpg') > -1 || path.indexOf('.jpeg') > -1 || path.indexOf('.gif') > -1 || path.indexOf('.png') > -1 ){ 
		img.src = 'file://'+path;
		if(img.width <= 300 && img.height <= 300 && img.fileSize <= 102400){
			fg = true;
		}else{
			alert('Kích thước của bạn không vượt quá (300 x 300)px và 100Kb. Vui lòng kiểm tra lại hình nhãn của bạn.')	
			alert('Kích thước hiện tại của bạn là ('+img.width+' x '+img.height+')px và '+parseInt(img.fileSize/1024)+'Kb')
		}
	}else{
		alert('Các kiểu hình có thể upload được là "jpg, jpeg, gif, png". Vui lòng kiểm tra lại kiểu hình nhãn!')	
	}
	return fg;
}

function AddNN(){
	var nhom = document.frm.dkNhom.options[document.frm.dkNhom.selectedIndex]
	var hhdv = document.frm.dkNganhNghe.options[document.frm.dkNganhNghe.selectedIndex]
	var list = document.frm.listhhdv
	var khac = document.frm.dkNgheKhac;
	var arr = new Array();
	var fg = true;
	if(list.value != ''){
		arr = list.value.split('@#');
		for (x in arr){
			if(x%2==0 && arr[x]==hhdv.value){
				fg = false
				break;
			}
		}
	}
	if(TrimStr(khac.value) != ''){
		var d = new Date();
		var t = d.getTime();
		if(list.value != ''){
			list.value = list.value + '@#' + t + '@#' + nhom.text + ' / ' + khac.value
		}else{
			list.value = list.value + t + '@#' + nhom.text + ' / ' + khac.value
		}
	}else if(fg == true){
		if(list.value != ''){
			list.value = list.value + '@#' + hhdv.value + '@#' + nhom.text + ' / ' + hhdv.text
		}else{
			list.value = list.value + hhdv.value + '@#' + nhom.text + ' / ' + hhdv.text
		}
	}

	var arrA = new Array();
	var str = ''
	arrA = list.value.split('@#');
	for (x=0;x<=arrA.length-1;x++){		
		if(arrA[x]!=''){
			str = str + arrA[x+1] + " (<a href=javascript:ClearNN('" + arrA[x] + "') >Xoá</a>)<br>"
		}
		x++;
	}
	document.getElementById("dsHHDV").innerHTML = str
}
function ClearNN(vl){
yn = confirm('Bạn đã chắc chắn xóa danh mục hàng hóa dịch vụ này chưa ?');	
if(yn==true){
	var list = document.frm.listhhdv
	var arr = new Array();
	var arrA = new Array();
	var str = '';
	if(list.value != ''){
		arr = list.value.split('@#');
		for (x=0;x<=arr.length-1;x++){		
			if(arr[x]!=vl && arr[x] != ''){
				if(str != ''){
					str = str + '@#' + arr[x] + '@#' + arr[x+1]
				}else{
					str = str + arr[x] + '@#' + arr[x+1]
				}
			}
			x++;
		}
		list.value = str
	}
	var str1 = ''
	arrA = str.split('@#');
	for (y=0;y<=arrA.length-1;y++){	
		if(arrA[y]!=''){
			str1 = str1 + arrA[y+1] + " (<a href=javascript:ClearNN('" + arrA[y] + "') >Xoá</a>)<br>"
		}
		y++;
	}
	document.getElementById("dsHHDV").innerHTML = str1
}
}
//*************************************
