function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion; this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom)
	return this
}
var bw=new lib_bwcheck()

var oWin=new Array; oWin.zIndex=10; oWin.dragobj=-1; oWin.resizeobj=-1; oWin.zIndex=100
var isFront;
function winit(w,is,w1,h1,x1,y1){
	wins=w
	win_init()
	winpage=lib_doc_size()
	for(i=0;i<wins;i++){
		create_window(i,0,0,1)
	}
	oWin.currwins=i
	if(is){
		isFront=1
		setWindows()
	}
	if(w1){
		j=0
		for(i=2;i<arguments.length;i+=4){
			oWin[j].resize(arguments[i],arguments[i+1])
			oWin[j].origw=arguments[i]; oWin[0].origh=arguments[i+1]
			oWin[j].moveIt(eval(arguments[i+2]),arguments[i+3])
			oWin[j].checkscroll()
			oWin[j].showIt()
			j++
		}
	}
}
function create_window(i,link,heading,SYSTEM){
	oWin[i]=new lib_obj2('divWin'+i,'','','',i)
	oWin[i].oWindow=new lib_obj2('divWindow'+i,'divWin'+i)
	oWin[i].oText=new lib_obj2('divWinText'+i,'divWin'+i,'divWindow'+i)
	oWin[i].oHead=new lib_obj2('divWinHead'+i,'divWin'+i)
	oWin[i].oButtons=new lib_obj2('divWinButtons'+i,'divWin'+i)
	oWin[i].oResize=new lib_obj2('divWinResize'+i,'divWin'+i)
	//Events
	oWin[i].oHead.evnt.onmouseover=new Function("w_mmover("+i+")")
	oWin[i].oHead.evnt.onmouseout=new Function("w_mmout()")
	if(!bw.ns4) oWin[i].oHead.evnt.ondblclick=new Function("mdblclick(0,"+i+")")
	oWin[i].oResize.evnt.onmouseover=new Function("w_mmover("+i+",1)")
	oWin[i].oResize.evnt.onmouseout=new Function("w_mmout()")	
	//Styles
	if(!bw.ns4){
		oWin[i].oHead.css.cursor="move"
		oWin[i].oResize.css.cursor="w-resize"
		if(!bw.opera5){
			oWin[i].oWindow.css.overflow="hidden"
			oWin[i].css.overflow="hidden"
		}
	}

	//Scroll
	oWin[i].oUp=new lib_obj2('divWinUp'+i,'divWin'+i)
	oWin[i].oDown=new lib_obj2('divWinDown'+i,'divWin'+i)
	
	//If loader
	if(link){
		//Loader
		if(!bw.ns4) oWin[i].oLoader=new lib_obj2('ifrWin'+i,'divWin'+i)
		if(!bw.ns6&&!bw.ns4) oWin[i].oIfr=document.frames['ifrWin'+i]
	}
	
	oWin[i].lastx=oWin[i].x
	oWin[i].lasty=oWin[i].y
	oWin[i].origw=250
	oWin[i].origh=250
	
	//Functions
	oWin[i].resize=win_resize;
	oWin[i].close=win_close;
	oWin[i].maximize=win_maximize;
	oWin[i].minimize=win_minimize;
	oWin[i].regwin=win_regwin
	oWin[i].checkscroll=win_checkscroll;
	oWin[i].up=win_up;
	oWin[i].down=win_down;
	oWin[i].addZ=win_addZ;
	oWin[i].state="reg"
	oWin[i].heading=heading?heading:""
	if(link){
		oWin[i].resize(250,250)
		oWin[i].moveIt(20,150)
	}
	if(!SYSTEM){
		oWin[i].showIt()
	}
}
//Window functions 
function win_regwin(){
	this.oResize.css.visibility="inherit"
	this.resize(this.origw,this.origh)
	this.slideIt(this.lastx,this.lasty,30,10)
	this.state="reg"
	this.addZ()
	this.checkscroll()
}
function win_maximize(){
	if(this.state!="max"){
		if(this.state!="min"){this.lastx=this.x; this.lasty=this.y}
		mw=winpage.x2 - 10
		mh=winpage.y2 - 10 - 140
		this.slideIt(5,143,30,10,this.obj+'.resize('+mw+','+mh+');')
		this.state="max"
		this.addZ()
	}else this.regwin()
}
function win_minimize(){
	if(this.state!="min"){
		couns=0
		if(this.state!="max"){this.lastx=this.x; this.lasty=this.y}
		y=winpage.y2-16; ox=winpage.x2-126
		a=0
		for(i=0;i<wins;i++){
			x=i*125; ok=a
			if(a*125>ox){
				if(ox>126) i=0
				a=0; y-=15; x=0
			}
			for(j=0;j<wins;j++){
				couns++
				//self.status=oWin[j].x + "=" + x + "   -    " + oWin[j].y + "=" + y
				if(oWin[j].x==x && oWin[j].y==y) a++
			}		
			if(a==ok) break;
		}
		x=a*125;
		this.slideIt(x,y,30,10)
		this.oResize.hideIt()
		this.state="min"
		this.resize(125,14)
	}else this.regwin()
}
function win_close(){
	this.hideIt()
	this.oUp.hideIt()
	this.oDown.hideIt()
}
function win_resize(w,h){
	this.oButtons.moveIt(w-39,0)
	this.oResize.moveIt(w-13,h-9)
	this.oWindow.clipTo(0,w-2,h-23,0,1)
	this.clipTo(0,w,h,0,1)
	this.oHead.clipTo(0,w,14,0,1)
	this.oText.moveIt(2,3)
	this.oUp.hideIt()
	this.oDown.hideIt()
}
function win_checkscroll(w,h){
	this.oText.height=this.oText.evnt.offsetHeight||this.oText.css.pixelHeight||this.oText.ref.height||0
	w=this.cr
	h=this.cb
	if(this.oText.height>h-28 && this.state!="min"){
		this.oWindow.clipTo(0,w-14,h-23,0,1)
		this.oUp.moveIt(w-12,14)
		this.oUp.clipTo(0,11,h-30,0,1)
		this.oDown.moveIt(w-12,h-21)
		this.oDown.clipTo(0,11,12,0,1)
		this.oUp.showIt()
		this.oDown.showIt()
	}else{
		this.oUp.hideIt()
		this.oDown.hideIt()
	}
}
var sctim=100;
var winScroll;
function win_up(){
	clearTimeout(sctim);
	if(this.oText.y>=this.oWindow.cb-this.oText.height-10 && winScroll){
		this.oText.moveBy(0,-8); 
		setTimeout(this.obj+".up()",30)
	}
}
function win_down(){
	clearTimeout(sctim);
	if(this.oText.y<=0 && winScroll){
		this.oText.moveBy(0,8);
		setTimeout(this.obj+".down()",30)
	}
}
function noScroll(){clearTimeout(sctim);winScroll=false}


function win_addZ(){
	oWin.zIndex++
	this.css.zIndex=oWin.zIndex
}
//Initiating winpage
function win_init(){
	if(document.layers){
		document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK)
		document.ondblclick=mdblclick;
	}
	document.onmousemove=mmove;
	document.onmousedown=mdown
	document.onmouseup=mup;
}
//Event functions
function w_mmover(num,resize){ //Mouseover on elements
	if(!resize) oWin.dragover=num
	else oWin.resizeover=num
}
function w_mmout(){ //Mouseout on elements
	oWin.dragover=-1
	oWin.resizeover=-1
}
function mup(e){ //Mouseup
	if(oWin.dragobj!=-1){oWin[oWin.dragobj].lastx=oWin[oWin.dragobj].x; oWin[oWin.dragobj].lasty=oWin[oWin.dragobj].y}
	oWin.dragobj=-1	
	if(oWin.resizeobj!=-1){
		oWin[oWin.resizeobj].checkscroll()
		oWin[oWin.resizeobj].origw=oWin[oWin.resizeobj].cr
		oWin[oWin.resizeobj].origh=oWin[oWin.resizeobj].cb		
	}else if(bw.ns4) routeEvent(e)		
	oWin.resizeobj=-1
}
function mdown(e){ //Mousedown
	x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
	if(bw.ie5 || bw.ie6) y+=document.body.scrollTop
	id1=oWin.dragover
	id2=oWin.resizeover
	if(id1>-1 || id2>-1){
		if(id2>-1){ id=id2; oWin.resizeobj=id;
		}else{ 
			id=id1; oWin.dragobj=id
			oWin.clickedX=x-oWin[id].x; 
			oWin.clickedY=y-oWin[id].y
		}
		oWin[id].addZ()
		//Setting background-colors	
		for(i=0;i<wins;i++){
			if(i!=id1&&i!=id2){
				oWin[i].oWindow.bg("white")
			}else oWin[i].oWindow.bg("#EEF3F9")
		}
	}else if(bw.ns4) routeEvent(e)
}
function mmove(e,y,rresize){ //Mousemove
	x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
	if(bw.ie5 || bw.ie6) y+=document.body.scrollTop
	id1=oWin.dragobj
	id2=oWin.resizeobj
	if(id2>-1){ //Resize
		nx=x; ny=y
		oldw=oWin[id2].cr
		oldh=oWin[id2].cb
		cw= nx -oWin[id2].x
		ch= ny - oWin[id2].y
		if(cw<120) cw=120
		if(ch<70) ch=70
		oWin[id2].resize(cw,ch)
	}else if(id1>-1){ //Move
		nx=x-oWin.clickedX; ny=y-oWin.clickedY
		if(ny<140) ny=140
		oWin[id1].moveIt(nx,ny)
		if(oWin[id].state==0){oWin[id].lastx=nx; oWin[id].lasty=ny}
	}
	if(!bw.ns4) return false      
}
function mdblclick(e,num){ //Doubleclick
	if(num>-1) oWin[num].maximize()
	else if(oWin.dragover>-1) oWin[oWin.dragover].maximize()
}
function setWindows(placeit,rez){
	between=10
	oWin.rows=Math.round((oWin.currwins/3)+0.2)
	oWin.columns=1
	j=0;a=0;c=0;
	for(i=0;i<wins;i++){
		if(j==oWin.columns-1){
			oWin.columns=oWin.currwins-a<3?oWin.currwins-a:oWin.currwins-a==4?2:3
			if(oWin.currwins!=1 && a!=0) c++
			j=0
		}else if(a!=0) j++
		oWin[i].origw=(winpage.x2-3-(between*oWin.columns))/oWin.columns 
		oWin[i].origh=(winpage.y2-137-(between*oWin.rows))/oWin.rows
		oWin[i].origx=oWin[i].origw*(j)+(between*j+1) +5
		oWin[i].origy=oWin[i].origh*c+140+(between*c)  + 3
		if(!placeit){oWin[i].lasty=oWin[i].origy; oWin[i].lastx=oWin[i].origx
		}else{
			oWin[i].lasty=((page.avail)*parseFloat(oWin[i].yy)/100)+130 ; 
			oWin[i].lastx=page.x2*parseFloat(oWin[i].xx)/100
		}
		oWin[i].resize(oWin[i].origw,oWin[i].origh)
		st=oWin[i].state; oWin[i].regwin()
		if(st==1) oWin[i].minimize(1); else if(st==2) oWin[i].maximize(1)
		else if(st==3) oWin[i].close(); 
		else oWin[i].moveIt(oWin[i].lastx,oWin[i].lasty); if(!placeit)oWin[i].showIt()
		a++;
	}
}

var mDebugging=2; oVMenu=new makeCoolMenu("oVMenu"); oVMenu.useframes=0 

oVMenu.onlineUrl="http://smenet.com/"
oVMenu.frame="frmMain"; oVMenu.NS4padding="0px";oVMenu.useNS4links=1 ;oVMenu.checkselect=1 ;oVMenu.pagecheck=0;oVMenu.checkscroll=0;oVMenu.resizecheck=1 ;oVMenu.wait=1000 ;
oVMenu.usebar=0;oVMenu.barcolor="#336699" ;oVMenu.barwidth="660" ;oVMenu.barheight="menu" ;oVMenu.barx=215 ;oVMenu.bary="menu";oVMenu.barinheritborder=0 ;oVMenu.rows=0;oVMenu.fromleft=0 ;oVMenu.fromtop=143 ;oVMenu.pxbetween=0;

avail="215+((toppage.x2-215)/6)" 
//oVMenu.menuplacement=new Array(215,avail,avail+"*2",avail+"*3",avail+"*4",avail+"*5")
oVMenu.menuplacement=0
oVMenu.level[0]=new Array() 
oVMenu.level[0].width=140 
oVMenu.level[0].height=20
oVMenu.level[0].bgcoloroff="#67C0E0"
oVMenu.level[0].bgcoloron="#67C0E0" 
oVMenu.level[0].textcolor="black"
oVMenu.level[0].hovercolor="#003399"  
oVMenu.level[0].style="padding:3px;font-family:arial,helvetica; font-size:11px; font-weight:normal"
oVMenu.level[0].border=2 
oVMenu.level[0].bordercolor="" 
oVMenu.level[0].offsetX=0 
oVMenu.level[0].offsetY=0 
oVMenu.level[0].NS4font="arial,helvetica"
oVMenu.level[0].NS4fontSize="2"
oVMenu.level[0].align="right" 

oVMenu.level[0].clip=1 
oVMenu.level[0].clippx=15 
oVMenu.level[0].cliptim=50

oVMenu.level[1]=new Array() 
oVMenu.level[1].width=200
oVMenu.level[1].height=20
oVMenu.level[1].bgcoloroff="#CDDBEB"
oVMenu.level[1].bgcoloron="#319ACE"
oVMenu.level[1].textcolor="#000000"
oVMenu.level[1].hovercolor="#FFFFFF"
oVMenu.level[1].style="padding:2px; font-family:arial,helvetica; font-size:11px; font-weight:bold"
oVMenu.level[1].align="right" 
oVMenu.level[1].offsetX=0
oVMenu.level[1].offsetY=0
oVMenu.level[1].border=1 
oVMenu.level[1].bordercolor="#F75500"
oVMenu.level[1].NS4font="arial,helvetica"
oVMenu.level[1].NS4fontSize="2"
oVMenu.level[2]=new Array()
oVMenu.level[2].width=150
oVMenu.level[2].height=20
oVMenu.level[2].style="padding:2px; font-family: arial,helvetica; font-size:10px; font-weight:bold"
oVMenu.level[2].align="right" 
oVMenu.level[2].offsetX=0
oVMenu.level[2].offsetY=0
oVMenu.level[2].border=1 
oVMenu.level[2].bordercolor="#006699"
oVMenu.level[2].NS4fontSize="1"
oVMenu.level[2].bgcoloroff="#CDDBEB"
oVMenu.level[2].bgcoloron="#319ACE"
oVMenu.level[2].textcolor="#000000"
oVMenu.level[2].hovercolor="#FFFFFF"
//	/TiengViet/
oVMenu.makeMenu('top1','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Doing Business in VN','')
	oVMenu.makeMenu('sub10','top1','Business Environment','/English/DoingBizInVietNam/businessenvironment.asp')
	oVMenu.makeMenu('sub11','top1','Taxation','/English/DoingBizInVietNam/taxation.asp')
	oVMenu.makeMenu('sub12','top1','Employment','/English/DoingBizInVietNam/employment.asp')
	oVMenu.makeMenu('sub13','top1','Projects Calling for Investment','/English/DoingBizInVietNam/Investment.asp')

oVMenu.makeMenu('top2','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">SME Vietnam','')	
	oVMenu.makeMenu('sub20','top2','SME Promotion Programmes','/English/smevietnam/PromotionProgrammes.asp')
	oVMenu.makeMenu('sub21','top2','SME promotion organizations','/English/smevietnam/PromotionOrganizations.asp')
	oVMenu.makeMenu('sub22','top2','SME needs','/English/smevietnam/SMENeeds.asp')

oVMenu.makeMenu('top3','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Biz Information','')	
	oVMenu.makeMenu('sub30','top3','SMEnet news','/English/BizInfo/SMENews.asp')
	oVMenu.makeMenu('sub31','top3','News from the web','/English/BizInfo/InternetNews.asp')
	oVMenu.makeMenu('sub32','top3','Trade Fair in Vietnam','/English/BizInfo/TradeFairInfo.asp')

oVMenu.makeMenu('top4','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Industries','')	
	oVMenu.makeMenu('sub40','top4','Agriculture','/English/Industries/Industry.asp?id=1')
	oVMenu.makeMenu('sub41','top4','Construction','/English/Industries/Industry.asp?id=2')
	oVMenu.makeMenu('sub42','top4','Electrics','/English/Industries/Industry.asp?id=3')
	oVMenu.makeMenu('sub43','top4','Information Technology','/English/Industries/Industry.asp?id=4')
	oVMenu.makeMenu('sub44','top4','Garment and Textile','/English/Industries/Industry.asp?id=5')
	oVMenu.makeMenu('sub45','top4','Footwear','/English/Industries/Industry.asp?id=6')
	oVMenu.makeMenu('sub46','top4','Handicraft','/English/Industries/Industry.asp?id=7')
	oVMenu.makeMenu('sub47','top4','Tourism','/English/Industries/Industry.asp?id=8')
	oVMenu.makeMenu('sub48','top4','Marketing','/English/Industries/Industry.asp?id=10')
	oVMenu.makeMenu('sub49','top4','Sea food','/English/Industries/Industry.asp?id=11')
	oVMenu.makeMenu('sub410','top4','Mechanic','/English/Industries/Industry.asp?id=12')

oVMenu.makeMenu('top5','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Legal consulting','')	
	oVMenu.makeMenu('sub50','top5','Tax, Investment, Banking & Finance','/English/BizInfo/taxinvestmentupdate.asp')
	oVMenu.makeMenu('sub51','top5','Legal Document Update','/English/Consulting/LegalUpdate.asp')
	oVMenu.makeMenu('sub52','top5','Itellectual Property Update','/English/Consulting/IPVN.asp')
	oVMenu.makeMenu('sub53','top5','Legal Consulting','/English/Consulting/LegalConsulting.asp')


oVMenu.makeMenu('top6','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Business Opportunities','/English/BizOpp/default.asp')	

oVMenu.makeMenu('top9','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Trade statistics','/English/TradeStatistics/default.asp')	

oVMenu.makeMenu('top12','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Useful Links','/English/UsefulLinks/default.asp')

oVMenu.makeMenu('top13','','<image border=0 src=\"/TiengViet/buttons/bullet.gif\">Newsletter','/English/Newsletter/default.asp')

oVMenu.makeStyle(); oVMenu.construct()
oVMenu.resizecode="placeA(n)"
	
function placeA(n){	
	if(isFront){winpage=new makePageCoords(); setWindows()}
}
placeA(); var isFront
function cm_checkScrolled(obj){
	if(bw.mac) return
	if(bw.ns4 || bw.ns6) obj.scrolledY=obj.win.pageYOffset
	else obj.scrolledY=obj.win.document.body.scrollTop
	if(obj.scrolledY!=obj.lastScrolled){
		if(!obj.useframes){
			if(obj.scrolledY>119){
				for(i=0;i<obj.l[0].num;i++){var sobj=obj.l[0].o[i].oBorder; sobj.moveY(obj.scrolledY)}
				if(obj.usebar) obj.oBar.moveY(obj.scrolledY)
			}else{
				for(i=0;i<obj.l[0].num;i++){var sobj=obj.l[0].o[i].oBorder; sobj.moveY(obj.fromtop)}
				if(obj.usebar) obj.oBar.moveY(obj.fromtop)
			}
		}
		obj.lastScrolled=obj.scrolledY; page.y=obj.scrolledY; page.y2=page.y2orig+obj.scrolledY
		if(!obj.useframes || bw.ie){ clearTimeout(obj.tim); obj.isover=0; obj.hideSubs(1,0)}
	}
	if((bw.ns4 || bw.ns6) && !obj.useframes) setTimeout("cm_checkScrolled("+obj.name+")",200)
}