var subdir = "Site";
dir = document.location.href;
dir = dir.substring(0,dir.lastIndexOf(subdir)+subdir.length+1);
//var dir = "/";

var NS4 = false;
var NS6 = false;
var newWin = null;
var menuCount = 5;
if (!document.all && document.getElementById) NS6 = true;
if (navigator.appName == "Netscape" && document.getElementById == undefined) NS4 = true;
var layerRef,layerLeft;
if (NS4 || NS6){
	if (NS4){
		layerRef	= "document.layers[";
		layerLeft	= "].left";
		layerVis	= "].visibility";
	} else {
		layerRef	= "document.getElementById(";	
		layerLeft	= ").style.left";
		layerVis	= ").style.visibility";		
	}
} else {
	layerRef	= "document.all[";
	layerLeft	= "].style.pixelLeft";	
	layerVis	= "].style.visibility";	
}

Array.prototype.name = "";
var aLeft = new Array(294,397,509,609,679);
var aSubLeft = new Array(294,397,509,609,679);

var menu0 = new Array(2);
menu0.img = "<a href='"+dir+"company/company.html'><img border=0 src='"+dir+"companyBtn.gif' width=56 height=17></a>";
menu0.width = 117;
menu0[0] = new classLink("btn0_0",dir+"company/technology.html");
menu0[1] = new classLink("btn0_1",dir+"company/executives.html");
menu0[2] = new classLink("btn0_2",dir+"company/features.html");

var menu1 = new Array(5);
menu1.img = "<a href='"+dir+"products/products.html'><img border=0 src='"+dir+"productsBtn.gif' width=65 height=17></a>";
menu1.width = 104;
menu1[0] = new classLink("btn1_0",dir+"products/references.html");
menu1[1] = new classLink("btn1_1",dir+"products/hot/hot.html");
menu1[2] = new classLink("btn1_2",dir+"products/quickmind/quickmind.html");
menu1[3] = new classLink("btn1_3",dir+"products/idata/idata.html");
menu1[4] = new classLink("btn1_4",dir+"products/others/others.html");

var menu2 = new Array(2);
menu2.img = "<a href='"+dir+"services/services.html'><img border=0 src='"+dir+"servicesBtn.gif' width=60 height=17>";
menu2.width = 86;
menu2[0] = new classLink("btn2_0",dir+"services/workflow.html");
menu2[1] = new classLink("btn2_1",dir+"services/partners.html");

var menu3 = new Array(2);
menu3.img = "<a href='"+dir+"news/news.html'><img border=0 src='"+dir+"newsBtn.gif' width=37 height=17>";
menu3.width = 75;
menu3[0] = new classLink("btn3_0",dir+"news/archive.html");
menu3[1] = new classLink("btn3_1",dir+"news/articles.html");
 
var menu4 = new Array();
menu4.img = "<a href='"+dir+"contact.html'><img border=0 src='"+dir+"contactBtn.gif' width=75 height=17></a>";


function classLink(img, url) {
	this.img = img;
	this.url = url;
 }

function createMenu(){
	var str,topMenu1=130,topMenu2=167;
	writeLayer(0,topMenu1);
	writeLayer(1,topMenu1);
	writeLayer(2,topMenu1);
	writeLayer(3,topMenu1);
	writeLayer(4,topMenu1);
	window.onresize = showCenter;
}

function showLayer(layerName){
	eval (layerRef+'"'+layerName+'"'+layerVis+' = "visible"');
}

function hideLayer(layerName){
	eval (layerRef+'"'+layerName+'"'+layerVis+' = "hidden"');
}

function writeLayer(num,top) {
	var upText="",downText="",centerText="",i;
	var aMenu= eval("menu"+num);
	if (NS4){
		upText = "<layer id=\"la"+ num +"\" Z-INDEX=1 VISIBILITY=HIDE LEFT="+ aLeft[num] +" TOP="+ top +" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\"><p class=\"menu\">"+aMenu.img+"</p></layer>";
		centerText	= "<layer id=\"subla"+ num +"\" VISIBILITY=HIDE Z-INDEX=2 LEFT="+ aSubLeft[num] +" TOP="+ (top + 16) +" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\">";
		downText= "</layer>";
	} else {
		upText		= "<div id=\"la"+ num +"\" style=\"position: absolute; visibility:hidden; left: " + aLeft[num] + "; top: " + top + "; height:20; z-index:1;\" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\">"+aMenu.img+"</div>";
		centerText	= "<div id=\"subla"+ num +"\" style=\"position: absolute; visibility:hidden; left: " + aSubLeft[num] + "; top: " + (top + 16) + "; z-index:2;\" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\">";
		downText	+="</div>";	
	}
	
	centerText += "<img border=\"0\" src=\""+dir+"zero.gif\" width="+aMenu.width+" height=9><BR>";
	for (i=0;i<aMenu.length;i++){
		centerText += "<a href=\""+aMenu[i].url+"\" onmouseover=\""+aMenu[i].img+".src='"+dir+aMenu[i].img+"_on.gif'\" onmouseout=\""+aMenu[i].img+".src='"+dir+aMenu[i].img+"_off.gif'\"><IMG SRC='"+dir+aMenu[i].img+"_off.gif' border=0 width="+aMenu.width+" height='22' name='"+aMenu[i].img+"'></a><br>";
	}	
	document.write(upText+centerText+downText);
}

function showMenu(){
	showCenter();
	for (var i=0;i<menuCount;i++) showLayer("la"+ i);
}

function showCenter(){
	var i,left,objLayer;
	var w  = getWidth();
	if (w > 758){
		left = parseInt((w-758)/2)+225;
		if (NS4 || NS6) left -= 10;
		for (i=0;i<menuCount;i++){
			left = parseInt((w-758)/2)+aLeft[i];
			if (NS4 || NS6) left -= 10;
			eval (layerRef+'"la'+i+'"'+layerLeft+' = '+left);
			left = parseInt((w-758)/2)+aSubLeft[i];
			if (NS4 || NS6) left -= 10;
			eval (layerRef+'"subla'+i+'"'+layerLeft+' = '+left);
		}
	} else {
		for (i=0;i<menuCount;i++){
			eval (layerRef+'"la'+i+'"'+layerLeft+' = '+aLeft[i]);
			eval (layerRef+'"subla'+i+'"'+layerLeft+' = '+aSubLeft[i]);
		}	
	}
}	

function getWidth(){
	if (document.all == null) return window.innerWidth;
	else return document.body.clientWidth;
}

function showImage(nm,im,w,h){
	if(newWin!=null) if (!newWin.closed)newWin.close();
	var top = (screen.height-h)/2;
	var left = (screen.width-w)/2;
	var windstatus;
	windstatus='width='+w+',height='+h+',top='+top+',left='+left+',status=no,resizable=no,scrollbars=no';
	newWin=window.open('','',windstatus);
	newWin.document.open();
	newWin.document.writeln('<html>');
	newWin.document.writeln('<head>');
	newWin.document.writeln('<title>'+nm+'</title>');
	newWin.document.writeln('</head>');
	newWin.document.writeln('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
	newWin.document.writeln('<A HREF="javascript:close()"><img border="0" src="'+im+'" width="'+w+'" height="'+h+'"></A>');
	newWin.document.writeln('</body>');
	newWin.document.writeln('</html>');
	newWin.document.close();
}
