// GLOBAL VARS
var isOnline=false;

// INITIALIZE
is = new BrowserCheck();

NS6 = (document.getElementById&&!document.all) ? 1: 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;

DeclareMenu();
function gotoUrl(){
	var urltxt = "";
	args=gotoUrl.arguments; 
	urltxt = (isOnline) ? (urltxt + args[0]) : args[0];
	location.href=urltxt;
}
// MAIN MENU BAR HIGHLIGHT
function asal(src){src.style.backgroundColor='#ff9933'}
function keluar(src){src.style.backgroundColor='#b5ccc9'}
function keluar2(src){src.style.backgroundColor='#b5ccc9'}//lightblue

function BrowserCheck() {
	var b = navigator.appName;
	if (b == "Netscape") this.b = "NS";
	else if (b == "Microsoft Internet Explorer") this.b = "IE";
	else this.b = b;

	this.v = parseInt(navigator.appVersion);
	this.NS = (this.b == "NS" && this.v>=4);
	this.NS4 = (this.b == "NS" && this.v == 4);
	this.NS5 = (this.b == "NS" && this.v == 5);
	this.IE = (this.b == "IE" && this.v>=4);
	this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.IE5 || this.NS5) this.VER5 = true;
	if (this.IE4 || this.NS4) this.VER4 = true;
	this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
	this.min = (this.NS||this.IE);
}


var menuData;
var menuCaptions;
var clDrop = "#b5ccc9"; //"E6E6DD"#EBE6D9"
var clDropFrame = "#ffffff";//"999990#D2C2AA"
var clDropSep = "#306090"; //"#D2C2AA"
var clDropHi = "#F09933";//004474"C9C6C0#D2C2AA"

function DeclareMenu()
{
  var i,j;
  //declare menu captions array
  menuCaptions = new Array("tarif");
  
  //declare menu array
  menuData = new Array()
  for (i=0; i < 4; i++) {
  	menuData[i] = new Array(40)
  	for (j=0; j < 20; j++) { menuData[i][j] = new Array(3) }
  }
  
  // General
  menuData[0][0][0]="&nbsp;Dalam Negeri";
  menuData[0][0][1]="./tarifdn.php";
  menuData[0][1][0]="&nbsp;Luar Negeri";
  menuData[0][1][1]="./tarifln.php";
  menuData[0][2][0]="&nbsp;Wesel Pos ";
  menuData[0][2][1]="./tarif_rs.php";
  menuData[0][3][0]="&nbsp;WeselPos LN";
  menuData[0][3][1]="./tarifwpln.html";
  
  }


function fmFindTop(ob)
{
	var y = 0;
	do {
		y += ob.offsetTop;
		ob = ob.offsetParent;
		if (!ob) {break;}
	} while (1);
	return y;
}

function fmFindLeft(ob)
{
	var x = 210;
	do {
		x += ob.offsetLeft;
		ob = ob.offsetParent;
		if (!ob) {break;}
	} while (1);
	return x;
}

// SHOW DROPDOWN MENU
function showNav(){
	args = showNav.arguments;
	theObj = (is.VER5) ? document.getElementById(args[0]).style : (is.NS) ? document.layers[args[0]] : document.all[args[0]].style;
	if (args[1]){  //acuan posisi
		theTab=eval(document.images[args[1]]);
		theObj.left = fmFindLeft(theTab);
		theObj.top = fmFindTop(theTab)+0;
	}
	if (theObj){
		if(theObj.visibility=='hidden')	theObj.visibility = 'visible';
	}
}

// HIDE DROPDOWN MENU
function hideNav(){
	args = hideNav.arguments;
	theObj = (is.VER5) ? document.getElementById(args[0]).style : (is.NS) ? document.layers[args[0]] : document.all[args[0]].style;
	if (theObj){
		if(theObj.visibility=='visible') theObj.visibility = 'hidden';
	}
}

// HILITE MENUITEM
function divOver(){
	args = divOver.arguments;
	theObj = (is.VER5) ? document.getElementById(args[0]).style : (is.NS) ? document.layers[args[0]] : document.all[args[0]].style;
	if(theObj.backgroundColor=clDrop)	theObj.backgroundColor=clDropHi;
}

// UNHILITE MENUITEM
function divOut(){
	args = divOut.arguments;
	theObj = (is.VER5) ? document.getElementById(args[0]).style : (is.NS) ? document.layers[args[0]] : document.all[args[0]].style;
	if(theObj.backgroundColor=clDropHi)	theObj.backgroundColor=clDrop;
}

// BUILD MENU DIV
var tdID = 0
function doMenuDiv(){
	args = doMenuDiv.arguments;
	var divID = args[0];
	var x = args[1];
	
	objDiv = "<div id=\"" + divID + "\" style=\"position:absolute; left:0px; top:0px; width:177px; z-index:300; background-color:" + clDropFrame + "; visibility:hidden; padding-left:1;\" onMouseover=\"showNav('" + divID + "')\"  onMouseout=\"hideNav('" + divID + "')\">"
	objDiv += "<div id=\"arrow\" style=\"position:relative; background-color:" + clDropFrame+ "; width:177px;height:2px;\"><span> </span></div>"

	for (y = 0; y < 10; y++){
	    if(menuData[x][y][0]!=null){ 
	  	objDiv += "<div id=\"x" + tdID + "\" style=\"position:relative;top:0px; cursor:pointer;  background-color:" + clDrop + "; width:176px;height:20;\" onMouseover=\"divOver('x" + tdID + "')\" onMouseout=\"divOut('x" + tdID + "')\"><span class=\"nav\" onClick=\" window.open('"+menuData[x][y][1]+"','','height=600,width=800,resizable=no,scrollbars=yes,status=no')\"><font color=#FFFFFF>"+ menuData[x][y][0] +"&nbsp;</font></span></div>"
		objDiv += "<div id=\"line\" style=\"position:relative; background-color:" + clDropFrame + "; width:176px; height:1px;\"><span> </span></div>";
		tdID = tdID +1
		}
	}
	objDiv +="<div id=\"line\" style=\"position:relative;  width:177px; height:0px;\"><span> </span></div></div>"
	document.write(objDiv);
}

// BUILD ALL MENU DIV
function Menu(){
	var i;
	for(i=0;i<4;i++){ doMenuDiv(menuCaptions[i],i); }
}

