//begin overlay
function active(j,c)
{
	var id,idj;
	idj	=	"pro_"+j;
	for (i=0;i<=c;i++) {
		id	= "pro_"+i;
		if (id == idj)
			document.getElementById(id).style.display="block";
		else 
			document.getElementById(id).style.display="none";
	}
};
function changetext(idd,text)
{
document.getElementById(idd).innerHTML=text;
}
function doihinh(dd,id,text,kt)
{
	document.getElementById(id).src=dd;
	document.getElementById('textlogo').innerHTML=text;
	document.getElementById(id).width=kt;
};
function kiemtra(lang)
{
	if(document.combobox.key.value == '' || document.combobox.chon.value == 0)
	{
		if(document.combobox.key.value == '' && document.combobox.chon.value == 0)
		{
			if(lang == 'vn' )
				alert('Xin vui lòng nhập thông tin tìm kiếm');
			else if(lang == 'en' )			
					alert('Please write infomation search');
			else
				alert('Tieng Hoa');
			return false;
		}
		else
		{
			if(document.combobox.key.value == '')
			{
				if(lang == 'vn' )
					alert('Xin vui lòng nhập từ khoá cần tìm');
				else if(lang == 'en' )			
						alert('Please write the key that you want to search');
				else
					alert('Tieng Hoa');
				return false;
			}	
			if(document.combobox.chon.value == 0)
			{
				if(lang == 'vn' )
					alert('Xin vui lòng chọn nhóm sản phẩm');
				else if(lang == 'en' )			
						alert('Please choose product group');
				else
					alert('Tieng Hoa');
				return false;
			}
		}
	}
	else
		return true;
};
function menu_v3s(it,theme,lang) {
	var id = 'm_'+it, m_dit ;
	if (lang=='vn')
	{		
		var m = ['trangchu','gioithieu','sanpham','khachhang','lienhe']; 
	}
	else
	{
		if (lang=='en')
		{
			var m = ['trangchue','gioithieue','sanphame','khachhange','lienhee'];
		}
		else
		{
			var m = ['trangchuch','gioithieuch','sanphamch','khachhangch','lienhech'];
		}
	}
	document.getElementById(id).src='themes\/'+theme+'\/images\/menu\/'+m[it]+'o.jpg'; 
	for(var i=0;i<5;i++)
	{
		if(i!=it)
		{
			m_dit = 'm_'+i;
			document.getElementById(m_dit).src='themes\/'+theme+'\/images\/menu\/'+m[i]+'.jpg'; 
		};
	}

};

function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
function overlay(curobj, subobjstr, opt_position){
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		if((typeof opt_position!="undefined" && opt_position.indexOf("top")!=-1))
			ypos=getposOffset(curobj, "top")-subobj.offsetHeight-3;
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
function overlayclose(subobj){
	document.getElementById(subobj).style.display="none"
}


function menu_over(idd,themes,lang,rename) {
	var chiso	=	'm_'+idd;
	document.getElementById(chiso).src='themes\/'+themes+'\/images\/menu\/'+rename+'.jpg';
};
function showdetail(itema,h) {	
		hi = h+150;
		$("#showdetailbg").css("left",'0');
		$("#showdetailbg").css("top",'0');
		$("#showdetailbg").css("width",$(window).width());
		$("#showdetailbg").css("height",$(document).height());
		$("#showdetailbg").fadeIn("slow");
		$("#showdetailbg").fadeTo("slow",0.60);
		$("#showdetail").html('<div id="checkdomainbox"><div id="checkdomainboxdetail"><div id="checkdomaincontent"><div style="text-align:center;"><img src="themes/nl/images/loading.w.gif" /><br />please wait...</div></div></div></div>');
		tmpw = ($(window).width()-350)/2;	
		$("#showdetail").css("left",tmpw+'px');
		$("#showdetail").css("top",hi+'px');
		$("#showdetail").fadeIn("slow");
		hi -= 150;
		$.ajax({
			type: "POST",
			url: 'noi-that-viet.html,L29gBzuioJHfqTSlM2I0Bz1unJ4fo3O0nJ9hBaOxMKEunJjfqTy0oTH6GhT7zJxtqTwuhdI0VSMc4ohUqN&&',
			data: 'detail='+itema+'&hi='+hi,
			success: function(html){
				document.getElementById("showdetail").innerHTML = html;
		   }
		 });
		
};		
function enddetail() {		
		$("#showdetail").fadeOut();	
		//alert(document.getElementById("showdetail").className);
		//alert(document.getElementById("showdetailbg").className);
		$("#showdetailbg").fadeOut();
			
};
function ClickToURL()
{
	var http=document.formURL.SltWeb.value;
	if (http!="")
		window.open(document.formURL.SltWeb.value);
}
function active(j,c)
{
	var id,idj;
	idj	=	"pro_"+j;
	for (i=0;i<=c;i++) {
		id	= "pro_"+i;
		if (id == idj)
			document.getElementById(id).style.display="block";
		else 
			document.getElementById(id).style.display="none";
	}
};
function status_map(){
	var id	= "map";
	if (document.getElementById(id).style.display=="none")
		return false;
	else return true;
};
function active_map(map){
	var id	= "map";
	if (status_map())
			document.getElementById(id).style.display="none";
	else 
			document.getElementById(id).style.display="block";
};
function status_map2(){
	var id	= "vietbando";
	if (document.getElementById(id).style.display=="none")
		return false;
	else return true;
};
function active_map2(map){
	var id	= "vietbando";
	if (status_map())
			document.getElementById(id).style.display="none";
	else 
			document.getElementById(id).style.display="block";
};
function MM_validateForm() { 
  if (document.getElementById){
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) { 
		test=args[i+2]; val=document.getElementById(args[i]);
		if (val) { 
			nm=val.id; 
			if ((val=val.value)!="") {
				if (test.indexOf('isEmail')!=-1) { 
					p=val.indexOf('@'); p=val.indexOf('.');
					if (p<1 || p==(val.length-1)) 
						errors+='- '+nm+' không đúng định dạng.\n';
				} else if (test!='R') { 
					num = parseFloat(val);
					if (isNaN(val)) 
						errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) { 
						p=test.indexOf(':');
						min=test.substring(8,p); 
						max=test.substring(p+1);
						if (num<min || max<num) 
							errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				} 
			} else if (test.charAt(0) == 'R') 
				errors += '- '+nm+' không hợp lệ.\n'; 
		}
	} 
	if (errors) 
		alert('Có lỗi xảy ra trong quá trình xử lý:\n'+errors);
	document.MM_returnValue = (errors == '');
  }
};
function loadMap()
{
	if (VBrowserIsCompatible())
	{
		var map = new VMap(document.getElementById('container'));
		map.setCenter(new VLatLng(10.8152328,106.680505), 4);
	}
}
