var selectedElement;
var atraccionesY=473;
var serviciosY=602;

function mOvr(src,clrOver) { 
  src.style.cursor = 'hand'; 
  src.bgColor = clrOver; 
} 

function mOut(src,clrIn) { 
 src.style.cursor = 'default'; 
 src.bgColor = clrIn; 
}

function mClk(src) {
  src.children.tags('A')[0].click(); 
} 

function showmenu(e,which){
var menuobj=document.getElementById("popmenu");
menuobj.innerHTML=which;
menuobj.style.visibility='visible';
menuobj.contentwidth=menuobj.offsetWidth;
menuobj.contentheight=menuobj.offsetHeight;
var eventX=232;
if ((screen.width==800) && (screen.height==600)) {
	if (document.getElementById('jungla')){
		serviciosY=835;
	}
	eventX=232;
}else if ((screen.width==1024) && (screen.height==768)){
	if (document.getElementById('jungla')){
		serviciosY=830;
	}
    eventX=260;
} else {
	if (document.getElementById('jungla')){
		serviciosY=830;
	}
	eventX=390;
}


var eventY;
//eventY=(document.all)? event.clientY : ns6? e.clientY : e.y;
if (document.all) {
 eventY=event.clientY;
}else{
  eventY=e.clientY;
}

//Find out how close the mouse is to the corner of the window
var rightedge=(document.all)? document.body.clientWidth-eventX : window.innerWidth-eventX;
var bottomedge=(document.all)? document.body.clientHeight-eventY : window.innerHeight-eventY;

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth){
//move the horizontal position of the menu to the left by it's width
//menuobj.thestyle.left=(document.all)? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
menuobj.style.left=(document.all)? document.body.scrollLeft+eventX-menuobj.contentwidth :window.pageXOffset+eventX-menuobj.contentwidth;
//menuobj.thestyle.left = '385px';
}
else
{
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=(document.all)? document.body.scrollLeft+eventX : window.pageXOffset+eventX ;
//menuobj.thestyle.left = '385px';(
}
//same concept with the vertical position

//window.status='mouse:'+(event.clientY)+'scroll'+document.body.scrollTop;
//menuobj.thestyle.top=(document.all)? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY;
if (menuobj.contentheight==177){
 menuobj.style.top=atraccionesY;
}else
{
menuobj.style.top=serviciosY;
}
/*if (window.delayhide){
clearTimeout(delayhide);
}*/
}

function hide(){
//delayhide=setTimeout("hideMenu()",300);
}

function hideMenu(){
var menuobj=document.getElementById("popmenu");
menuobj.style.visibility='hidden';
}

function highlightmenu(e,state){

if (document.all){
source_el=event.srcElement;
}
else if (document.getElementById){
source_el=e.target;
}

if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : "";
}
else{
while(source_el.id!="popmenu"){
source_el=document.getElementById? source_el.parentNode : source_el.parentElement;
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : "";
}
}
}
}
document.onclick=hideMenu;


