


function hideLayer(layerid) {

var layer = document.getElementById(layerid);

layer.style.visibility = "hidden";

}





                                                                 

                                                                                             

var thresholdY = 0;                // in pixels; threshold for vertical repositioning of a layer

var ordinata_margin = 309;        // to start the layer a bit above the mouse vertical coordinate 

                                                                                       

DOM = (document.getElementById) ? 1 : 0;                                             

NS4 = (document.layers) ? 1 : 0;                                                    

IE4 = (document.all) ? 1 : 0;                                                      

var loaded = 0;        // to avoid stupid errors of Microsoft browsers            

                                                                       

                                                                                

                                                                          

                                                                              

// it works with NS4, Mozilla, NS6, Opera 5, IE                               

currentY = -1;                                                                

function grabMouse(e) {                                                       

        if (DOM && !IE4) {                                                    

                currentY = e.clientY;                                         

        } else if (NS4) {                                                     

                currentY = e.pageY;                                           

        } else {                                                              

                currentY = event.y;                                           

        }                                                                     

        if (DOM && !IE4 && navigator.appName != "Opera") {                    

                currentY += window.pageYOffset;                               

        } else if (IE4 && DOM) {                                              

                currentY += document.body.scrollTop;                          

        }


myRE = new RegExp("http://www.crecejoven.com", "i");

var topUrl = top.location.href;

if (topUrl.match(myRE) && parent.frames.length!=0){

xMousePos = 0; // Horizontal position of the mouse on the screen

yMousePos = 0; // Vertical position of the mouse on the screen

xMousePosMax = 0; // Width of the page

yMousePosMax = 0; // Height of the page

    if (document.layers) {

        xMousePos = e.pageX;

        yMousePos = e.pageY;

        xMousePosMax = window.innerWidth+window.pageXOffset;

        yMousePosMax = window.innerHeight+window.pageYOffset;

    } else if (document.all) { 

        xMousePos = window.event.x+document.body.scrollLeft;

        yMousePos = window.event.y+document.body.scrollTop;

        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;

        yMousePosMax = document.body.clientHeight+document.body.scrollTop;

    } else if (document.getElementById) {

        xMousePos = e.pageX;

        yMousePos = e.pageY;

        xMousePosMax = window.innerWidth+window.pageXOffset;

        yMousePosMax = window.innerHeight+window.pageYOffset;

    } 

        window.status = "Pos x =" + xMousePos + ", Pos y =" + yMousePos;

}


                                                                            

}
                                                                             

if ((DOM || NS4) && !IE4) {                                                   

        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);            

}                                                                             

document.onmousemove = grabMouse;                                             

                                                                              

function popUp(menuName,on) {                                                 

        if (loaded) {        // to avoid stupid errors of Microsoft browsers   

                if (on) {      

//                        moveLayers(); 

                        if (DOM) {     

                                document.getElementById(menuName).style.visibility = "visible";

                        } else if (NS4) {                                    

                                document.layers[menuName].visibility = "show";

                        } else { 

                                document.all[menuName].style.visibility = "visible";

                        }

                } else {

                        if (DOM) {

                                document.getElementById(menuName).style.visibility = "hidden";

                        } else if (NS4) {

                                document.layers[menuName].visibility = "hide";

                        } else {

                                document.all[menuName].style.visibility = "hidden";

                        }

                }

        }

}


function popUpL1() {
shutdown();
popUp('L1',true);
}
function popUpL5() {
shutdown();
popUp('L5',true);
}
function popUpL21() {
shutdown();
popUp('L21',true);
}
function popUpL36() {
shutdown();
popUp('L36',true);
}
function popUpL40() {
shutdown();
popUp('L40',true);
}

function moveLayers() {

if (DOM) {

document.getElementById('L1').style.left = 188;
document.getElementById('L1').style.top = 120;
document.getElementById('L1').style.width = 145;
document.getElementById('L5').style.left = 188;
document.getElementById('L5').style.top = 135;
document.getElementById('L5').style.width = 145;
document.getElementById('L21').style.left = 188;
document.getElementById('L21').style.top = 150;
document.getElementById('L21').style.width = 145;
document.getElementById('L36').style.left = 188;
document.getElementById('L36').style.top = 165;
document.getElementById('L36').style.width = 145;
document.getElementById('L40').style.left = 188;
document.getElementById('L40').style.top = 180;
document.getElementById('L40').style.width = 145;


} else if (NS4) {

document.layers['L1'].left = 188;
document.layers['L1'].top = 120;
document.layers['L5'].left = 188;
document.layers['L5'].top = 135;
document.layers['L21'].left = 188;
document.layers['L21'].top = 150;
document.layers['L36'].left = 188;
document.layers['L36'].top = 165;
document.layers['L40'].left = 188;
document.layers['L40'].top = 180;


} else {

document.all['L1'].style.pixelLeft = 188;
document.all['L1'].style.pixelTop = 120;
document.all['L1'].style.pixelWidth = 145;
document.all['L5'].style.pixelLeft = 188;
document.all['L5'].style.pixelTop = 135;
document.all['L5'].style.pixelWidth = 145;
document.all['L21'].style.pixelLeft = 188;
document.all['L21'].style.pixelTop = 150;
document.all['L21'].style.pixelWidth = 145;
document.all['L36'].style.pixelLeft = 188;
document.all['L36'].style.pixelTop = 165;
document.all['L36'].style.pixelWidth = 145;
document.all['L40'].style.pixelLeft = 188;
document.all['L40'].style.pixelTop = 180;
document.all['L40'].style.pixelWidth = 145;


}

}

function shutdown() {
popUp('L1',false);
popUp('L5',false);
popUp('L21',false);
popUp('L36',false);
popUp('L40',false);
}
if (NS4) {
document.onmousedown = function() { shutdown(); }
} else {
document.onclick = function() { shutdown(); } 
}



function moveLayerY(menuName, ordinata) {

if (loaded) {        // to avoid stupid errors of Microsoft browsers

if (ordinata != -1 && !isNaN(ordinata)) {        // The browser has detected the mouse position

if (DOM) {


        appoggio = parseInt(document.getElementById(menuName).style.top);

        if (isNaN(appoggio)) appoggio = 0;

        if (Math.abs(appoggio + ordinata_margin - ordinata) > thresholdY)

                document.getElementById(menuName).style.top = ordinata - ordinata_margin;

} else if (NS4) {

        if (Math.abs(document.layers[menuName].top + ordinata_margin - ordinata) > thresholdY)

                document.layers[menuName].top = ordinata - ordinata_margin;

} else {

        if (Math.abs(document.all[menuName].style.pixelTop + ordinata_margin - ordinata) > thresholdY)

                document.all[menuName].style.pixelTop = ordinata - ordinata_margin;

}

}

}

}


// -->
