/*Window script - Copyrighted 2001 Thomas Brattli. This script will come as a stand-alone script in a while*/
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;
 oDCMenu=new makeCoolMenu("oDCMenu"); 
 oDCMenu.useframes=0 
oDCMenu.frame="frmMain";
 oDCMenu.offlineUrl=""; 
 oDCMenu.onlineUrl="http://192.168.1.31/";
 oDCMenu.NS4padding="2px";
 oDCMenu.useNS4links=1 ;
 oDCMenu.checkselect=1 ;
 oDCMenu.pagecheck=0;
 oDCMenu.checkscroll=2;
 oDCMenu.resizecheck=1 ;
 oDCMenu.wait=100 ;
oDCMenu.usebar=1;
oDCMenu.barcolor="#003090" ;
oDCMenu.barwidth="100%"//778//"75%" ;
oDCMenu.barheight=19;
oDCMenu.barx=0 ; 
oDCMenu.bary=96;//97
oDCMenu.barinheritborder=0 ;
oDCMenu.rows=1;
oDCMenu.fromleft=0 ;
oDCMenu.fromtop=96 ;
oDCMenu.pxbetween=0;
avail="0+((toppage.x2-5)/4)";//6 to 4
oDCMenu.menuplacement=new Array(10,avail+"-28",avail+"*2-52",avail+"*3-0")//,avail+"*4-31",avail+"*5-45") //,avail+"*6+10")
//oDCMenu.menuplacement=new Array(0,avail+"-28",avail+"*2-52",avail+"*3-0",avail+"*4-31",avail+"*5-45") //,avail+"*6+10")
//alert(oDCMenu.menuplacement)-28
//oCMenu.menuplacement=0
oDCMenu.level[0]=new Array() //TRUNKEY PROJECT, SURFACE TRANSPORT,
oDCMenu.level[0].width=90 
oDCMenu.level[0].height=19 
oDCMenu.level[0].bgcoloroff="#003090"
oDCMenu.level[0].bgcoloron="#003090" 
oDCMenu.level[0].textcolor="white"
oDCMenu.level[0].hovercolor="#FCCE55"  
oDCMenu.level[0].style="font-family:arial,helvetica; font-size:12px; font-weight:bold"
oDCMenu.level[0].border=0
oDCMenu.level[0].bordercolor="" 
oDCMenu.level[0].offsetX=0
oDCMenu.level[0].offsetY=-1
oDCMenu.level[0].NS4font="arial,helvetica"
oDCMenu.level[0].NS4fontSize="2"
oDCMenu.level[0].align="bottom"

oDCMenu.level[1]=new Array() // Under menu
oDCMenu.level[1].width=98
oDCMenu.level[1].height=19
oDCMenu.level[1].bgcoloroff="#003090"
oDCMenu.level[1].bgcoloron="#275BB0"
oDCMenu.level[1].textcolor="#A7A3A3"
oDCMenu.level[1].hovercolor="#ffffff"
oDCMenu.level[1].style="padding:2px; font-family:verdana; font-size:11px;"
oDCMenu.level[1].align="bottom" 
oDCMenu.level[1].offsetX=0
oDCMenu.level[1].offsetY=0
oDCMenu.level[1].border=1 
oDCMenu.level[1].bordercolor="#A7A3A3"
oDCMenu.level[1].NS4font="arial,helvetica"
oDCMenu.level[1].NS4fontSize="2"

oDCMenu.level[2]=new Array() //Sub-Menu
oDCMenu.level[2].width=150
oDCMenu.level[2].height=20
oDCMenu.level[2].style="padding:2px; font-family:verdana; font-size:10px;"
oDCMenu.level[2].align="bottom" 
oDCMenu.level[2].offsetX=0
oDCMenu.level[2].offsetY=0
oDCMenu.level[2].border=1 
oDCMenu.level[2].bordercolor="#A7A3A3"
oDCMenu.level[2].NS4fontSize="1"
oDCMenu.level[2].bgcoloroff="#164694"
oDCMenu.level[2].bgcoloron="#4077D4"
oDCMenu.level[2].textcolor="#A7A3A3"
oDCMenu.level[2].hovercolor="#CDDBEB"
oDCMenu.makeMenu('top0','','','','',103,19,'../images/mainpage/trunkeybuttons.gif')//103
	oDCMenu.makeMenu('sub00','top0','Services','../randomindex/1.html','',130,19)
	oDCMenu.makeMenu('sub01','top0','Major Breakthroughs','../turnkey/majorbreakthrough.html','',130,19)
	oDCMenu.makeMenu('sub02','top0','Completed Projects','../turnkey/completedproj1.asp','',130,19)
	oDCMenu.makeMenu('sub03','top0','Equipments','../turnkey/equip.html','',130,19)
	oDCMenu.makeMenu('sub04','top0','Route Surveys','../turnkey/routesurveys.asp','',130,19)
	oDCMenu.makeMenu('sub05','top0','Credentials','../turnkey/credentials.html','',130,19)
	oDCMenu.makeMenu('sub06','top0','Useful Links','../turnkey/usefullinks.asp','',130,19)
	
oDCMenu.makeMenu('top1','','','','',105,19,'../images/mainpage/surfacetransport.gif')//105
	oDCMenu.makeMenu('sub10','top1','Services','../randomindex/2.html','',105,17)
	oDCMenu.makeMenu('sub11','top1','Network','../surfacetransp/rnetwork.asp','',105,17)
	oDCMenu.makeMenu('sub12','top1','Tracking','../surfacetransp/tracking.html','',105,19)
    oDCMenu.makeMenu('sub13','top1','Utilities','../surfacetransp/utilities.html','',105,19)
    oDCMenu.makeMenu('sub14','top1','Useful Links','../surfacetransp/usefullinks.asp','',105,19)
    
oDCMenu.makeMenu('top2','','','','',182,19,'../images/mainpage/international.gif')//182
	oDCMenu.makeMenu('sub20','top2','Ocean Freight','','',182,19)
		oDCMenu.makeMenu('sub200','sub20','Introduction','../randomindex/7.html')
		oDCMenu.makeMenu('sub201','sub20','Shipment Tracking','../intfreightforwd/ofshiptracking.html')
		oDCMenu.makeMenu('sub202','sub20','Overseas Agents','../intfreightforwd/ofoverseasagents.html')
		oDCMenu.makeMenu('sub203','sub20','Useful Links','../intfreightforwd/ousefullinks.asp')
		oDCMenu.makeMenu('sub204','sub20','Utilities','../intfreightforwd/ofutilities.html')
		oDCMenu.makeMenu('sub205','sub20','Appreciation Certificates','../intfreightforwd/ofcertificates.html')
	oDCMenu.makeMenu('sub21','top2','Air Freight','','',182,19)
		oDCMenu.makeMenu('sub210','sub21','Introduction','../randomindex/3.html')
		oDCMenu.makeMenu('sub211','sub21','Shipment Tracking','../intfreightforwd/afshiptracking.html')
		oDCMenu.makeMenu('sub212','sub21','Overseas Agents','../intfreightforwd/afoverseasagents.html')
		oDCMenu.makeMenu('sub213','sub21','Useful Links','../intfreightforwd/ausefullinks.asp')
		oDCMenu.makeMenu('sub214','sub21','Utilities','../intfreightforwd/afutilities.html')
		oDCMenu.makeMenu('sub215','sub21','Appreciation Certificates','../intfreightforwd/afcertificates.html')
   oDCMenu.makeMenu('sub22','top2','Export','','',182,19)
		oDCMenu.makeMenu('sub220','sub22','Services','../randomindex/4.html')
		oDCMenu.makeMenu('sub221','sub22','Procedure','../exp&imp/expprocedure.html')
		oDCMenu.makeMenu('sub222','sub22','Documents Required','../exp&imp/expdocuments.html')
   oDCMenu.makeMenu('sub23','top2','Import','','',182,19)
		oDCMenu.makeMenu('sub230','sub23','Services','../randomindex/8.html')
		oDCMenu.makeMenu('sub231','sub23','Procedure','../exp&imp/impprocedure.html')
		oDCMenu.makeMenu('sub232','sub23','Documents Required','../exp&imp/impdocuments.html')
		oDCMenu.makeMenu('sub233','sub23','Duty Structure','../exp&imp/impdutystruct.html')
   oDCMenu.makeMenu('sub24','top2','ABCO Lines','../intlogis/abcolines.html','',182,19)
   oDCMenu.makeMenu('sub25','top2','House Hold Goods Movement','','',182,19)
		oDCMenu.makeMenu('sub250','sub25','Services','../randomindex/6.html','',182,19)   
		oDCMenu.makeMenu('sub251','sub25','Baggage Export Rules & Regulation','../househgm/baggexprules.html','',182,30)		
		oDCMenu.makeMenu('sub252','sub25','Baggage Import Rules & Regulation','../househgm/baggimprules.html','',182,30)
   
	
/*oDCMenu.makeMenu('top3','','','','',98,19,'images/mainpage/export&import.gif')
	oDCMenu.makeMenu('sub30','top3','Export','','',98,19)
		oDCMenu.makeMenu('sub300','sub30','Services','../abcindia/randomindex/4.html')
		oDCMenu.makeMenu('sub301','sub30','Procedure','../abcindia/exp&imp/expprocedure.html')
		oDCMenu.makeMenu('sub302','sub30','Documents Required','../abcindia/exp&imp/expdocuments.html')
	oDCMenu.makeMenu('sub31','top3','Import','','',98,19)
		oDCMenu.makeMenu('sub310','sub31','Services','../abcindia/randomindex/8.html')
		oDCMenu.makeMenu('sub311','sub31','Procedure','../abcindia/exp&imp/impprocedure.html')
		oDCMenu.makeMenu('sub312','sub31','Documents Required','../abcindia/exp&imp/impdocuments.html')
		oDCMenu.makeMenu('sub313','sub31','Duty Structure','../abcindia/exp&imp/impdutystruct.html')*/
	
oDCMenu.makeMenu('top3','','','','',116,19,'../images/mainpage/integrated.gif')//116
	oDCMenu.makeMenu('sub30','top3','Services','../randomindex/5.html','',116,19)
   //oDCMenu.makeMenu('sub51','top5','ABCO Lines','../abcindia/intlogis/abcolines.html','',116,19)
	
	
/*oDCMenu.makeMenu('top6','','','','',175,19,'images/mainpage/household.gif')
  oDCMenu.makeMenu('sub060','top6','Services','../abcindia/randomindex/6.html','',175,19)
  oDCMenu.makeMenu('sub061','top6','Baggage Import Rules & Regulation','../abcindia/househgm/baggimprules.html','',175,30)
  oDCMenu.makeMenu('sub062','top6','Baggage Export Rules & Regulation','../abcindia/househgm/baggexprules.html','',175,30)*/
  
oDCMenu.makeStyle(); oDCMenu.construct()
oDCMenu.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)
}