/************
 *
 * Copyright (C) 1999 EquaVision AB
 * Developed by Pablo at EquaVision AB
 *
 ************/

function Is() {
    var agent  = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns    = ((agent.indexOf('mozilla')   !=   -1) &&
                 ((agent.indexOf('spoofer')   ==   -1) &&
                 (agent.indexOf('compatible') ==   -1)));
    this.ns2   = (this.ns && (this.major      ==    3));
    this.ns3   = (this.ns && (this.major      ==    3));
    this.ns4b  = (this.ns && (this.major      ==    4) &&
                 (this.minor                  <= 4.03));
    this.ns4   = (this.ns && (this.major      >=    4));
    this.ns6    = (this.ns && (this.major     >=    5));
    this.ie    = (agent.indexOf("msie")       !=   -1);
    this.ie3   = (this.ie && (this.major      <     4));
    this.ie4   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   ==   -1));
    this.ie5   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   !=   -1));
    this.ie55  = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.5")   !=   -1));
}

if (!addWd) addWd=0
if (!addRt) addRt=false

var is = new Is(), ns4f, ie4f;

var mp=[];
mp["ceroMenu"]=0

if(is.ns4)
 {ns4f = (document.layers) ? 1 : 0;
 }else if(is.ie4 || is.ie5)
 {ie4f = (document.all) ? 1 : 0;}


var lastbutton='top';

lay=null
el=document.getElementById ? 1 : 0;


function moveLayer(id) {
	var x = (window.innerWidth || (document.body.clientWidth+18))/2 - 195 - addWd,
	    m, y=30*mp[id]+95;
	if (!is.ie) x+=10;
	if (!el) lay = document.layers || document.all;
	if (el) m = document.getElementById(id);
	else if (lay) m = lay[id];
	else {
		alert ("Your browser does not support our menu");
		return;
	}
	if (ns4f) {
		m.left = x;
		m.top = y;
	} else if (ie4f) {
		m.style.pixelLeft = x;
		m.style.pixelTop = y;
	} else {
		m.style.left = x+"px";
		m.style.top = y+"px"
    }

}


function popUp(menuName,on) {
	var mnu ;
		if (on) {
//			moveLayers();
			moveLayer(menuName);
			mnu = el ? document.getElementById(menuName) : lay[menuName];
			if (ns4f) {
				mnu.visibility = "show";
			} else {
				mnu.style.visibility = "visible";
			}
		} else {
//			moveLayers();
			moveLayer(menuName);
			mnu = el ? document.getElementById(menuName): lay[menuName];
			if (ns4f) {
				mnu.visibility = "hide";
			} else {
				mnu.style.visibility = "hidden";
			}
		}
}

function change(Name,No) {
	menuStop(); //Clear timeout, ML:010219
	if (No == 1) {
			popUp('ceroMenu',false);
			popUp('compMenu',false);
			popUp('prodMenu',false);
			popUp('servMenu',false);
			popUp('storeMenu',false);
			popUp('newsMenu',false);
			//popUp('investMenu',false);
		}
			lastbutton = Name;
}

function hide() {
	if (document.images && (loaded == 1)) {
		change(lastbutton,0);
	}
}

var count = 0;
var img11, img12, img13, img14, img15;


function preLoad() {

latImg=new Array();
var i;

for(i=0;i<10;i++){
 latImg[i]=new Image();
 latImg[i].src=corrPath("./graph/popup.about.lateral."+i+".gif");
}

img12=new Image()
img12.src=corrPath("./graph/popup.menu.arm.0.gif")
img13=new Image()
img13.src=corrPath("./graph/popup.menu.arm.1.gif")

img14=new Image()
img14.src=corrPath("./graph/popup.menu.barr.0.gif")
img15=new Image()
img15.src=corrPath("./graph/popup.menu.barr.1.gif")

}

/*
function loadCheck() {
	count++;
	if(count == 15) {
		moveLayers();
	}
}
*/

var timeout;
function menuStop(){
timeout = clearTimeout(timeout);
}

function menuDown(){
timeout = clearTimeout(timeout); //Prevent multiple timeouts
timeout = setTimeout('go()',1000); //Previously 500
}

function go(){
popUp('ceroMenu',false);
change('cero',1);
}

function linkselect (url) {
  if (url.length > 0) {
   window.parent.location = "http://" + url;
    }
}

function setDatum(){
var mydate=new Date()
var year=mydate.getYear()
if (year<2000)
year=1900+year
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym=""+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

document.write("<FONT COLOR='C2C2C2' FACE='Verdana,Geneva, Arial, Helvetica' STYLE='FONT-SIZE: 12px'>&nbsp;"+dayarray[day]+", "+daym+" "+montharray[month]+" , "+year+"</font>")
}


function btnIn(m,i) {
 document.images['arm'+m].src=img13.src;
 document.images['menu'+m+'_b'+i].src=img15.src;
 document.images['global'+m].src=latImg[i].src;
 menuStop()
}
function btnOut(m,i) {
 document.images['arm'+m].src=img12.src; document.images['menu'+m+'_b'+i].src=img14.src;
 document.images['global'+m].src=latImg[0].src;
 menuDown()
}

function wrMnu(no,id,mnu){
var i, ni=mnu.length, item;
mp[id]=no;
document.writeln('<DIV id="' + id + '" class=menu>')
document.writeln('<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">')

document.writeln('<TR><TD VALIGN="top" WIDTH="10"><IMG BORDER="0" SRC="'+corrPath("./graph/popup.menu.arm.0.gif")+'" NAME="arm'+no+'" WIDTH="10" HEIGHT="20"></TD>')
document.writeln('<TD WIDTH="6" VALIGN="top"><IMG BORDER="0" SRC="'+corrPath("./graph/popup.about.lateral.0.gif")+'" NAME="global'+no+'" WIDTH="2" HEIGHT="182"></TD>')
document.writeln('<TD VALIGN="top"><TABLE class=menu CELLPADDING="0" CELLSPACING="0">')
for(i=1;i<=ni;i++){
 item=mnu[i-1];
 if (ns4f) {
   document.writeln('<TR><TD BGCOLOR=#d8d8d8 NOWRAP ONMOUSEOVER="btnIn('+no+','+i+')" ONMOUSEOUT="btnOut('+no+','+i+')"><A class=sub HREF="'+corrPath(item[1])+'">'+item[0]+'</A></TD></TR>')
   document.writeln('<TR><TD><IMG BORDER="0" SRC="'+corrPath("./graph/popup.menu.barr.0.gif")+'" HEIGHT="2" NAME="menu'+no+'_b'+i+'"></TD></TR>');
 } else {
   document.writeln('<TR><TD class=menu NOWRAP ONMOUSEOVER="btnIn('+no+','+i+')" ONMOUSEOUT="btnOut('+no+','+i+')"><A class=sub HREF="'+corrPath(item[1])+'">'+item[0]+'</A></TD></TR>')
   document.writeln('<TR><TD><IMG style="width:100%" BORDER="0" SRC="'+corrPath("./graph/popup.menu.barr.0.gif")+'" HEIGHT="2" NAME="menu'+no+'_b'+i+'"></TD></TR>')
 }
}
/*
for(i=ni;i<=8;i++){
 document.writeln('<TR><TD WIDTH="157"><IMG BORDER="0" SRC="'+corrPath("./graph/menu.all.empty.gif")+'" WIDTH="135" HEIGHT="19"></TD></TR>')
 document.writeln('<TR><TD WIDTH="157"><IMG BORDER="0" SRC="'+corrPath("./graph/dot.trans.gif")+'" WIDTH="1" HEIGHT="2"></TD></TR>')
}*/
// document.writeln('<TR><TD WIDTH="157"><IMG BORDER="0" SRC="'+corrPath("./graph/popup.menu.barr.0.gif")+'" WIDTH="135" HEIGHT="2" NAME="menu'+no+'_b'+i+'"></TR>')
document.writeln('</TABLE></TD></TABLE></DIV>')
}

function corrPath(path) {
// return addRt+path
 return (addRt && (path.substr(0,1)==".")) ? addRt+path : path
}

/*
wrMnu(1, "compMenu",
 [["./graph/menu.1.history.gif", "./eng.history.html"],
  ["./graph/menu.1.technology.gif", "./eng.technology.html"],
  ["./graph/menu.1.people.gif", "./eng.staff.html"], 
  ["./graph/menu.1.our.mission.gif", "./eng.our.mission.html"],
  ["./graph/menu.1.working.at.equa.gif", "./eng.working.equa.html"],
  ["./graph/menu.1.location.gif", "./eng.location.html"]])

wrMnu(2, "prodMenu",
 [["./graph/menu.2.engin.simu.gif", "./eng.engineering.simu.html"], 
  ["./graph/menu.2.support.gif", "./eng.engineering.simu.1.html#Support"],
  ["./graph/menu.2.sales.simu.gif", "./eng.sales.simu.html"]])

wrMnu(3, "newsMenu",
 [["./graph/menu.3.news.gif", "./eng.news.html"],
  ["./graph/menu.3.events.gif", "./eng.events.html"],
  ["./graph/menu.3.articles.gif", "./eng.articles.html"],
  ["./graph/menu.3.press.releases.gif", "./eng.press.releases.html"],
  ["./graph/menu.3.images.gif", "./eng.images.html"]])

wrMnu(4, "investMenu",
 [["./graph/menu.4.invest.gif", "./eng.invest.briefing.html"], 
  ["./graph/menu.4.financial.gif", "./eng.financial.perf.html"],
  ["./graph/menu.4.presentations.gif", "./eng.download.center.html#Finance"],
  ["./graph/menu.4.com.rep.gif", "./eng.comp.rep.html"],
  ["./graph/menu.4.news.gif", "./eng.news.html"],
  ["./graph/menu.4.boards.dir.gif", "./eng.board.html"],
  ["./graph/menu.4.ownership.gif", "./eng.ownership.html"],
  ["./graph/menu.4.legal.notice.gif", "./eng.legal.notice.html"],
  ["./graph/menu.4.invest.contacts.gif", "./eng.invest.contacts.html" ]])
*/