var NS = (document.layers)?true:false;
var IE = (document.all)?true:false;

document.onmousemove = mouseMove

var menutopini=50
var menutop=50
var menuleft=0
var menuwidth=30
var menuheight=326

var heightInicio=18
var widthInicio=30

var menu2topini=50
var menu2top=50
var menu2left=0
var menu2width=220
var menu2height=326

var Img1=new Image();
var Img2=new Image();
var Img3=new Image();
var Img4=new Image();
var Img5=new Image();
var Img6=new Image();
var Img7=new Image();
var Img8=new Image();
var Img9=new Image();
var Img10=new Image();
var Img11=new Image();
var Img12=new Image();
var Img13=new Image();
var Img14=new Image();
var Img15=new Image();
var Img16=new Image();
var Img17=new Image();
var Img18=new Image();

Img1.src="../imatges/<%=getData(2)%>"
Img2.src="../imatges/<%=getData(3)%>"
Img3.src="../imatges/<%=getData(4)%>"
Img4.src="../imatges/<%=getData(5)%>"
Img5.src="../imatges/<%=getData(6)%>"
Img6.src="../imatges/<%=getData(7)%>"
Img7.src="../imatges/<%=getData(8)%>"
Img8.src="../imatges/<%=getData(9)%>"
Img9.src="../imatges/<%=getData(10)%>"
Img10.src="../imatges/<%=getData(11)%>"
Img11.src="../imatges/<%=getData(12)%>"
Img12.src="../imatges/<%=getData(13)%>"
Img13.src="../imatges/<%=getData(14)%>"
Img14.src="../imatges/<%=getData(15)%>"
Img15.src="../imatges/<%=getData(16)%>"
Img16.src="../imatges/<%=getData(17)%>"
Img17.src="../imatges/<%=getData(18)%>"
Img18.src="../imatges/<%=getData(19)%>"

var Opcio1="<IMG SRC='../imatges/menu_op1.jpg' BORDER=0>";
var Opcio2="<IMG SRC='../imatges/menu_op2.jpg' BORDER=0>";
var Opcio3="<IMG SRC='../imatges/menu_op3.jpg' BORDER=0>";
var Opcio4="<IMG SRC='../imatges/menu_op4.jpg' BORDER=0>";
var Opcio5="<IMG SRC='../imatges/menu_op5.jpg' BORDER=0>";
var Opcio6="<IMG SRC='../imatges/menu_op6.jpg' BORDER=0>";
var Opcio7="<IMG SRC='../imatges/menu_op7.jpg' BORDER=0>";
var Opcio8="<IMG SRC='../imatges/menu_op8.jpg' BORDER=0>";

var Opcio1b="<IMG SRC='../imatges/menu_op1b.jpg' BORDER=0>";
var Opcio2b="<IMG SRC='../imatges/menu_op2b.jpg' BORDER=0>";
var Opcio3b="<IMG SRC='../imatges/menu_op3b.jpg' BORDER=0>";
var Opcio4b="<IMG SRC='../imatges/menu_op4b.jpg' BORDER=0>";
var Opcio5b="<IMG SRC='../imatges/menu_op5b.jpg' BORDER=0>";
var Opcio6b="<IMG SRC='../imatges/menu_op6b.jpg' BORDER=0>";
var Opcio7b="<IMG SRC='../imatges/menu_op7b.jpg' BORDER=0>";
var Opcio8b="<IMG SRC='../imatges/menu_op8b.jpg' BORDER=0>";

var Link1="../htms/espanya.asp";
var Link2="../htms/paises.asp";
var Link3="../htms/odontometro.asp";
var Link4="../htms/noticias.asp";
var Link5="../htms/enlaces.asp";
var Link6="../htms/colaboradores.asp";
var Link7="mailto:graus@graus.com";
var Link8="../htms/webmaster.asp";

var numLinks=8;
var linkActual=1;
var boldActiu=0;
var numinst=0;

var animMenu=0;
var animMenuFin=0;
var animNum=1;
var menuDesplegat=0;
var menuDesplegat2=0;
var pendentPlegar=0;
var pendentDesplegar=0;
var recolocantMenu=0;
var Inicio=0;

function desplegaMenu() {
increment=menu2width/10;
numcops=10;
desplegaMenuFase(increment,numcops);
aturaAnimMenu();
//menu2.style.left=menu2left;
//if (boldActiu==0) {
//	activaBold();
//}
}

function recolocaMenu() {
menutop=document.body.scrollTop+menutopini;
menu.style.top=menutop;
menu2top=document.body.scrollTop+menu2topini;
menu2.style.top=menu2top;
setTimeout("recolocaMenu()",500);
}

function Nollamp() {
animMenuFin=1;
parent.logos.aturaAnim();
}

function mouseMove(e) {
var x = event.x+document.body.scrollLeft
var y = event.y+document.body.scrollTop

if (recolocantMenu==0) {
	recolocantMenu=1;
	recolocaMenu();
}

if (((y<(menutop))||(y>(menutop+menuheight)))||((x<0)||(x>(menu2width)))) {
	if ((menuDesplegat==1)&&(menuDesplegat2==1)) {
		plegaMenu();
		menuDesplegat2=0;
	} else {
	}
}

if (((y>(menutop))&&(y<(menutop+menuheight)))&&((x>0)&&(x<(0+menuwidth)))) {
	if ((menuDesplegat==0)&&(menuDesplegat2==0)) {
		desplegaMenu();
		menuDesplegat2=1;
	} else {
	}
}

if ((y>menutop)&&(y<menutop+30)&&(x>0)&&(x<30)) {
	if (Inicio==0) {
		menu.innerHTML="<A HREF='../index.htm' TARGET='_top'><IMG SRC='../imatges/menu1b.jpg' BORDER=0></A>";
		Inicio=1;
	}
} else {
	if (Inicio==1) {
		menu.innerHTML="<IMG SRC='../imatges/menu1.jpg'>";
		Inicio=0;
	}
}


}



function desplegaMenuFase(increment,numcops) {
if ((numcops!=0)&&(parseInt(menu2.style.left)<menu2left)) {
	numcops=numcops-1
	if (IE) {
		menu2.style.left=parseInt(menu2.style.left)+increment;
	} else {
		document.menu2.left=document.menu2.left+increment;
	}
	setTimeout("desplegaMenuFase("+increment+","+numcops+")",50);
} else {
	menuDesplegat=1;
}
}

function plegaMenu() {
increment=menu2width/10;
numcops=10;
plegaMenuFase(increment,numcops);
//engegaAnimMenu();
//desactivaBold();
}

function plegaMenuFase(increment,numcops) {
if ((numcops!=0)&&(parseInt(menu2.style.left)>-menu2width)) {
	numcops=numcops-1
	if (IE) {
		menu2.style.left=parseInt(menu2.style.left)-increment;
	} else {
		document.menu2.left=document.menu2.left-increment;
	}
	setTimeout("plegaMenuFase("+increment+","+numcops+")",50);
} else {
	menuDesplegat=0;
}
}

function ContingutMenu2() {
htm="<TABLE><TR><TD WIDTH="+(menuwidth)+"></TD><TD WIDTH="+(menu2width-menuwidth-10)+"</TD></TR><TR><TD></TD><TD>";
htm=htm+"<FONT FACE='Helvetica' COLOR='black'><BR><BR>";

for (i=1;i<=numLinks;i++) {
	htm=htm+"<DIV ID='OpLink"+i+"' STYLE='position:absolute; top: "+(35*i)+"px;' onMouseOver='SobreLink("+i+")'><A HREF='"+eval("Link"+i)+"'>"+eval("Opcio"+i)+"</A></DIV>";
}

htm=htm+"</TD></TR></TABLE>";
return htm;
}

function PintaLayer(ID, top, left, width, height, content, estils, actions) {
document.write("<DIV ID='"+ID+"' STYLE='position:absolute; top:"+top+"px; left:"+left+"px; width:"+width+"px; height:"+height+"px; "+estils+"' "+actions+">"+content+"</DIV>");
}

function idle() {
//	plegaMenu();
if (animMenuFin==0) {
	engegaAnimMenu();
	animMenuFin=1;
}
}

function PintaMenus() {
PintaLayer("idle",0,0,800,520,"","","onMouseOver='idle()'");
PintaLayer("menu2",menu2top,-menu2width,menu2width,menu2height,ContingutMenu2(),'background:"#355C84"',"");
PintaLayer("menu",menutop,menuleft,menuwidth,menuheight,"<IMG SRC='../imatges/menu1.jpg'>",'background:"transparent"',"");  // onMouseOver='desplegaMenu()'
}

function SobreLink(num) {
//desactivaBold();

	htm="<TABLE><TR><TD WIDTH="+(menuwidth)+"></TD><TD WIDTH="+(menu2width-menuwidth-10)+"</TD></TR><TR><TD></TD><TD>";
	htm=htm+"<FONT FACE='Helvetica' COLOR='black'><BR><BR>";

	for (i=1;i<=numLinks;i++) {
		if (num==i) {
			htm=htm+"<DIV ID='OpLink"+i+"' STYLE='position:absolute; top:"+(35*i)+"px;' onMouseOut='SobreLink("+(numLinks+1)+")'><A HREF='"+eval("Link"+i)+"'>"+eval("Opcio"+i+"b")+"</A></DIV>";
		} else {
			htm=htm+"<DIV ID='OpLink"+i+"' STYLE='position:absolute; top:"+(35*i)+"px;' onMouseOver='SobreLink("+i+")' onMouseOut='SobreLink("+(numLinks+1)+")'><A HREF='"+eval("Link"+i)+"'>"+eval("Opcio"+i)+"</A></DIV>";
		}

	}
	htm=htm+"</TD></TR></TABLE>";
	menu2.innerHTML=htm;
}

//function desactivaBold() {
//boldActiu=0;
//numinst=numinst+1;
//if (numinst==100) {
//	numinst=0;
//}
//}

function engegaAnimMenu() {
if (animMenu==0) {
	animMenu=1;
	animMenuFase();
}
}

function animMenuFase() {
if (animMenu==1) {
	if (animNum>2) {
		animNum=1;
	}
		htm=""
		if (animNum==1) {
			htm=htm+"<IMG SRC='../imatges/menu2.jpg'>"
		}
		if (animNum==2) {
			htm=htm+"<IMG SRC='../imatges/menu1.jpg'>"
		}
		htm=htm+""
		animNum=animNum+1;
		menu.innerHTML=htm;
		setTimeout("animMenuFase()",500);

} else {
	htm=""
	htm=htm+"<IMG SRC='../imatges/menu1.jpg'>"
	htm=htm+""
	menu.innerHTML=htm;
}
}

function aturaAnimMenu() {
animMenu=0;
parent.logos.aturaAnim();
}

function aturaAnimExtern() {
animMenu=0;
}