function MM_effectAppearFade(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}

// JavaScript Document
function MM_preloadImages() { //precarga de imagenes
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

///////////////////

function MM_findObj(n, d) { //encuentra la imagen en el arreglo
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

///////////////////

function MM_swapImage() { //cambia la imagen
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
////////////////////

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
///////////////////


function MM_effectAppearFade(targetElement, duration, from, to, toggle){ // efecto blur vinculos
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}
///////////////////

// active, visited submenues A/B/C
var aux = null;
function toggle( targetId ){
if (aux != null){
aux.className = "up";
}
 else {
document.getElementById( 'a' ).className = "up";
}

if (document.getElementById){
target = document.getElementById( targetId );
if (target.className == "out"){
target.className = "up";

} else {
target.className = "down";
aux = document.getElementById( targetId );
}
}
}

///////////////////


/////efecto actived, visited..

var selected_id = null;
var dom = document.getElementById; 

function swapIt(id) { 
if (dom) { 
if(selected_id != id) { 
el = document.getElementById(id); 
el.style.cursor = "hand"; 
el.style.cursor = "pointer"; 


} 
} 
} 
function down (id){ 
if (dom) { 
if(selected_id != null) {
document.getElementById(selected_id).className = "out"; 
}
el.className = "down"; 
selected_id = id; 
} 
} 

function down2 (id){ 
if (dom) { 
if(selected_id != null) {
document.getElementById(selected_id).className = "up"; 
}
el.className = "down"; 
//document.getElementById('id').parentNode.style.display = "block";
selected_id = id; 
} 
} 

function down4 (id){ 
if (dom) { 
if(selected_id != null) {
document.getElementById(selected_id).className = "out"; 
}
el.className = "down"; 
document.getElementById("nosotros").style.display = "none";
document.getElementById("portfolio").style.display = "none";
document.getElementById("porto").className = "inactivo"; 
document.getElementById("nos").className = "inactivo"; 
selected_id = id; 
} 
} 


var selected_id1 = null;
var selected_id2 = null;
var selected_id3 = null;
var selected_id4 = null;
var lastchild = null;
var over1 = null;
var over2 = null;
var over3 = null;
var over4 = null;
var over5 = null;


function down3 (id2,id3,loc,toloc,xtra){ 


if(selected_id2 != null) {
document.getElementById(selected_id2).className = "inactivo"; 
} 

if(lastchild != null) {
document.getElementById(lastchild).style.color = "#999999"; 

} 

if(selected_id3 != null) {
document.getElementById(selected_id3).style.color = "#999999";  

} 
if(selected_id1 != null & selected_id1!= xtra) {
document.getElementById(selected_id1).style.display = "none";  
if (xtra == 'nosotros') document.getElementById(selected_id).className = "out";

} 


document.getElementById(xtra).style.display = "block";
document.getElementById(id3).style.color = "#000000";  
document.getElementById(id2).className = "activo1";
document.getElementById(loc).style.color = "#000000";

selected_id1 = xtra;
selected_id2 = id2; 
selected_id3 = id3;
selected_id4 = toloc;
lastchild = loc;


} 

////prueba////



function over(self,papa,grandpapa,tosee,tobloc){
	


document.getElementById(papa).className = "activo1";	



if(over1 != null & over1 != selected_id3) document.getElementById(over1).style.color = "#999999";   
if(over3 != null & over3 != lastchild) document.getElementById(over3).style.color = "#999999";



if(over4 != null) document.getElementById(over4).style.display = "none";
if(over5 != null) document.getElementById(over5).style.display = "none";



if(tobloc != 'nada') {
	document.getElementById(tobloc).style.display = "block";
	over4 = tobloc;
}

switch (papa){
	
case 'porto':
document.getElementById("portfolio").style.display = "block";
if (selected_id1!= "nosotros") {
	document.getElementById("nosotros").style.display = "none";
	document.getElementById("nos").className = "inactivo"; 
}
break;

case 'nos':
document.getElementById("nosotros").style.display = "block";
if (selected_id1!= "portfolio") {
	document.getElementById("portfolio").style.display = "none";
	document.getElementById("porto").className = "inactivo"; 
}
break;
default:
    document.getElementById("portfolio").style.display = "none";
	document.getElementById("porto").className = "inactivo"; 
	document.getElementById("nosotros").style.display = "none";
	document.getElementById("nos").className = "inactivo"; 
break;
 
}



document.getElementById(tosee).style.display = "block";


if (grandpapa != 'nada') {
document.getElementById(grandpapa).style.color = "#000000";
over3 = grandpapa;
}

if (self != 'nada') {
document.getElementById(self).style.color = "#000000";
over1 = self;
}


over5 = tosee; 
over2 = papa; 


} 
