function menuBuildMain(isfulltext)
{
	var html="",title="";
    var i=0;
    var length=g_menubar_items.length;
    if(isEmpty(isfulltext))isfulltext=false;
    
    while(i<length)
    {
        if(!isString(g_menubar_items[i])){
            if(isfulltext)
                html+="<button title=\"menu\" onclick=\"window_menushow('idpopupmenu"+(i+1)+"')\" class=\"dropbtn\">"+itxt(g_menubar_items[i].f)+"</button>";
            else
                html+="<button title=\"menu\" onclick=\"window_menushow('idpopupmenu"+(i+1)+"')\" class=\"dropbtn\">"+itxt(g_menubar_items[i].s)+"</button>";
        }
        else
        {
            html+="<button title=\"menu\" onclick=\"window_menushow('idpopupmenu"+(i+1)+"')\" class=\"dropbtn\">"+itxt(g_menubar_items[i])+"</button>";
        }
        i++;
    }
	return html;
}

function menuBuildPopup(idpopupmenu)
{
		var nitem=g_menubar_popup_items.length;
		var index=parseInt(idpopupmenu.substr(idpopupmenu.length-1,1));
		var pmleft="";
		var pmright="";
		var i=0;
		
		while(i<nitem)
		{
			if(parseInt(g_menubar_popup_items[i])==index)
			{
				if(g_menubar_popup_items[i+1]=="0")
				{
					if(g_menubar_popup_items[i+2]=="-")
						pmleft+="<hr class='menu'>";
					else
						pmleft+="<a href=\"javascript:void(0)\" onclick=\"javascript:window_newtab('"+g_menubar_popup_items[i+2]+"')\">"+itxt(g_menubar_popup_items[i+3])+"</a>";
				}
				else
				{
					if(g_menubar_popup_items[i+2]=="-")
						pmright+="<hr class='menu'>";
					else
						pmright+="<a href=\"javascript:void(0)\" onclick=\"javascript:window_newtab('"+g_menubar_popup_items[i+2]+"')\">"+itxt(g_menubar_popup_items[i+3])+"</a>";
				}
			}
			i+=4;
		}
		pmleft="<div style=\"width:50%;float:left\">"+pmleft+"</div>";
		pmright="<div style=\"width:50%;float:left\">"+pmright+"</div>";
		return (pmleft+pmright);
}	
function gsTimHang()
{
		var gsgoodsname=document.getElementById("gsgoodsname");
		var gsgoodscode=document.getElementById("gsgoodscode");
		var gsgoodsserial=document.getElementById("gsgoodsserial");
		if((gsgoodsname.value.length==0)&&(gsgoodscode.value.length==0)&&(gsgoodsserial.value.length==0))
		{
			return 0;
		}
		vgsgoodsname=uriEncode(gsgoodsname.value);
		vgsgoodscode=uriEncode(gsgoodscode.value);
		vgsgoodsserial=uriEncode(gsgoodsserial.value);
		window_menushow(myDropdownSearch);
		
		if(gsgoodsserial.value.length>0)
			window_newtab('bc_timkiemchungtu','sview=all&serial='+vgsgoodsserial);
		else
		{
			
			window_newtab('bc_hangtonkho','sview=all&sgoodsname='+vgsgoodsname+'&sgoodscode='+vgsgoodscode+'&serial=');
		}
		//clear
		gsgoodsname.value="";
		gsgoodscode.value="";
		gsgoodsserial.value="";
}
	
function gsTimDoiTac()
{
		gscontactname=document.getElementById("gscontactname");
		gscontactcode=document.getElementById("gscontactcode");
		gscontactaddress=document.getElementById("gscontactaddress");
		gscontactphone=document.getElementById("gscontactphone");
		vgscontactname=uriEncode(gscontactname.value);
		vgscontactcode=uriEncode(gscontactcode.value);
		vgscontactaddress=uriEncode(gscontactaddress.value);
		vgscontactphone=uriEncode(gscontactphone.value);
		if((vgscontactname.length==0)&&(vgscontactcode.length==0)&&(vgscontactaddress.length==0)&&(vgscontactphone.length==0))
		{
			return 0;
		}		
		window_menushow(myDropdownSearch);
		window_newtab('bc_doitacgiaodichchitiet','&contactname='+
		uriEncode(vgscontactname)+'&contactcode='+uriEncode(vgscontactcode)+'&contactaddress='+
		uriEncode(vgscontactaddress)+'&contactphone='+uriEncode(vgscontactphone));
		//clear
		gscontactname.value="";
		gscontactcode.value="";
		gscontactaddress.value="";
		gscontactphone.value="";		
}