// conmutador visibilidad de capas 
function recomienda()
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open('recomienda.aspx', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=550');");
}

function recomienda_desde_ofertas()
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open('../recomienda.aspx', '" + id + "', '');");
}
function muestraCapa(targetId1){
  if (document.getElementById( targetId1 )){
      target1 = document.getElementById( targetId1 );
      
      if (target1.style.display == ""){
            target1.style.display = "none";
      } else {
            target1.style.display = "";
      }
 }
}

function muestraCapa(targetId1, targetId2){
	if (document.getElementById( targetId1 )){
  		target1 = document.getElementById( targetId1 );
  
		if (target1.style.display == ""){
  			target1.style.display = "none";
  		} else {
  			target1.style.display = "";
		}
		
		if (document.getElementById( targetId2 )){
    		
  		    target2 = document.getElementById( targetId2 );

		    if (target2.style.display == ""){
  			    target2.style.display = "none";
  		    } else {
  			    target2.style.display = "";
		    }
        }
	}
}

function muestraPrecios(targetId1 , targetId2){

  if (document.getElementById){
    target1 = document.getElementById( targetId1 );
    target2 = document.getElementById( targetId2 );


if (target1.style.display == "none"){
  				target1.style.display = "block";
				target2.style.backgroundImage = 'url(img/ico_menos.gif)';
  			} else {
  				target1.style.display = "none";
				target2.style.backgroundImage = 'url(img/ico_mas.gif)';
			}

}
}

function tapaPrecios(targetId1 , targetId2){
  if (document.getElementById){
   target1 = document.getElementById( targetId1 );
   target2 = document.getElementById( targetId2 );

if (target1.style.display == ""){
  				target1.style.display = "none";
				target2.style.backgroundImage = 'url(img/ico_mas.gif)';
  			} else {
  				target1.style.display = "";
				target2.style.backgroundImage = 'url(img/ico_menos.gif)';
			}

}
}


// muestra mas opciones de formulario
function masFormulario(targetId1,targetId2){
  if (document.getElementById){
  target1 = document.getElementById( targetId1 );
  target2 = document.getElementById( targetId2 );

target1.style.display = "";
target2.style.display = "none";

}
}




// rollover de pestaņas en la home

function menuSuperior( targetId1,targetId2,targetId3,targetId4 ){
  if (document.getElementById)
  {
  		target1 = document.getElementById( targetId1 );
		target2 = document.getElementById( targetId2 );
		target3 = document.getElementById( targetId3 );
		target4 = document.getElementById( targetId4 );
				
  		if (target1.style.display == "none")
  		{
  		    target1.style.display = "";
				
			new Effect.Opacity(target3 ,
                               { duration: 0.3, 
                                 transition: Effect.Transitions.linear, 
                                 from: 1.0, to: 0.0 });
	        
	        new Effect.Opacity(target4 ,
                                { duration: 0.3, 
                                  transition: Effect.Transitions.linear, 
                                  from: 0.0, to: 1.0 });	
  		}
  		else
  		{
  		    target1.style.display = "none";
  		    target4.style.display = "block";    
	    }
		
		
		if (target2.style.display == "none")
		{
  		    target2.style.display = "";
  		    
  		    new Effect.Opacity(target4 ,
                               { duration: 0.3, 
                                 transition: Effect.Transitions.linear, 
                                 from: 1.0, to: 0.0 });
	        
	        new Effect.Opacity(target3 ,
                                { duration: 0.3, 
                                  transition: Effect.Transitions.linear, 
                                  from: 0.0, to: 1.0 });
		}
		else
		{
  		    target2.style.display = "none";
		}		 
  	}
}

// rollover del menu superior de la home
function superiorRollover( Idfondo1,Idfondo2,Idimagen1,Idimagen2 )
{
  if (document.getElementById)
  {
    var fondo1=document.getElementById(Idfondo1);
 	var fondo2=document.getElementById(Idfondo2);
	
		
	if (fondo1.style.backgroundImage != 'img/'+Idimagen1)
	{
  	    fondo1.style.backgroundImage='url(img/'+Idimagen1+')';
		fondo2.style.backgroundImage ='url(img/'+Idimagen2+')';
	} 
								
  }
}




// rollover CSS de las fechas del calendario de la home
function calOver(Idfondo){
if (document.getElementById) {
var fondo=document.getElementById(Idfondo);
//var letras=document.getElementById(Idletras);

fondo.style.backgroundColor='#ffffff';
//letras.style.color='#00539f';
}
}
function calOut(Idfondo){
if (document.getElementById) {
var fondo=document.getElementById(Idfondo);
//var letras=document.getElementById(Idletras);

fondo.style.backgroundColor='';
//letras.style.color='#00539f';
}
}



function mueveCapa(targetId1, desplazamiento) {
  if (document.getElementById) {
  target1 = document.getElementById( targetId1 );
  posiciona=target1.offsetLeft;

 target1.style.left = desplazamiento + 'px';

}
}


function radioCapa (valor, targetId1, targetId2 ,Idfondo1, Idfondo2, Idimagen1, Idimagen2 ) {
	 if (document.getElementById) {
  target1 = document.getElementById( targetId1 );
   target2 = document.getElementById( targetId2 );
     var fondo1=document.getElementById(Idfondo1);
 	var fondo2=document.getElementById(Idfondo2);
   
if (valor=="mostrar") {
target1.style.display = "block";
target2.style.display = "none";

if (fondo1.style.backgroundImage != 'img/'+Idimagen1){
  			fondo1.style.backgroundImage='url(img/'+Idimagen1+')';
			fondo2.style.backgroundImage ='url(img/'+Idimagen2+')';
  			} 


} 
}
}






function pestaFacilitadores ( targetId1, targetId2, targetId3, pestana1, pestana2, pestana3, Idimagen1, Idimagen2 , Idimagen3 ) {
	 if (document.getElementById){
  		target1 = document.getElementById( targetId1 );
		target2 = document.getElementById( targetId2 );
		target3 = document.getElementById( targetId3 );
		pestana1 = document.getElementById( pestana1 );
		pestana2 = document.getElementById( pestana2 );
		pestana3 = document.getElementById( pestana3 );

  		if (target1.style.display == "none" || targetId1=='facilmainresultados'){
  				target1.style.display = "";
				pestana1.style.backgroundImage ='url(img/'+Idimagen1+'.gif)';
				
  			} else {
  				target1.style.display = "none";
			pestana1.style.backgroundImage ='';
			
			}
			
		if (target2.style.display != "none"){
  				target2.style.display = "none";
				pestana2.style.backgroundImage ='url(img/'+Idimagen2+'.gif)';
  			} 
			
        if (target3.style.display != "none"){
  				target3.style.display = "none";
				pestana3.style.backgroundImage ='url(img/'+Idimagen3+'.gif)';
  			} 
  			 
  		document.getElementById('facilmainresultados').style.display="block";	 
  	}

}


// conmutador visibilidad de filtros

function muestraFiltro(targetId1 , target2){
  if (document.getElementById){
  target1 = document.getElementById( targetId1  );

if (target1.style.display == ""){
  				target1.style.display = "none";
				target2.style.backgroundImage = 'url(img/ico_pliega_down.gif)';
  			} else {
  				target1.style.display = "";
				target2.style.backgroundImage = 'url(img/ico_pliega_up.gif)';
			}

}
}

// reescalado vertical de capas

		function getWindowHeight() {
			var windowHeight = 0;
			if ( typeof( window.innerHeight ) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if ( document.documentElement && document.documentElement.clientHeight ) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if ( document.body && document.body.clientHeight ) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			
			return windowHeight;
			//window.alert( 'altura = ' + windowHeight );
		}
		
		
		
		function getScrollY() {
  var  scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
   
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
   
  }
  return  scrOfY ;
}



		function escalaVert() {
			if (document.getElementById) {
				windowHeight = getWindowHeight();
				scrollHeight = getScrollY()
				contenido = document.getElementById('velado');
				if (contenido!=null)
				{
					if (windowHeight > 0 ) {
						//if (windowHeight - (cabeceraHeight + statusHeight + pieHeight) >= 0) {
						contenido.style.height = (windowHeight + scrollHeight) + 'px';
						//alert(scrollHeight);
					}
					else {
						contenido.style.height = "";
					}
				}
			}
			}

window.onload = function() {
						escalaVert();
}

window.onresize = function() {
						escalaVert();
		}
		
		window.onscroll = function() {
						escalaVert();
		}
		
		
		
		
		
function tapaVentanas ( targetId1,targetId2 ) {
	 if (document.getElementById){
  		target1 = document.getElementById( targetId1 );
		target2 = document.getElementById( targetId2 );
		

  			if (target1.style.display != "none"){
  				target1.style.display = "none";
				
  			} else {
  				target1.style.display = "";
			}
			
		if (target2.style.display != "none"){
  				target2.style.display = "none";
				
  			} 
			

  	}

}
		
		
		
		function conmutaFiltro ( targetId1, targetId2  ) {
	 if (document.getElementById){
  		target1 = document.getElementById( targetId1 );
		target2 = document.getElementById( targetId2 );
		
		

  			if (target1.style.display == "none"){
  				target1.style.display = "";
				
				
  			} else {
  				target1.style.display = "";

			
			}
			
		if (target2.style.display != "none"){
  				target2.style.display = "none";
				
  			} 
			

  	}

}
function pestaMapa ( targetId1 , Idfondo1 , Idimagen1 , Idimagen2 ) {
	 if (document.getElementById){
  		target1 = document.getElementById( targetId1 );
		fondo1 = document.getElementById( Idfondo1 );
 		
		

  			if (target1.style.display == "none"){
  				target1.style.display = "";
				fondo1.style.backgroundImage='url(img/'+Idimagen1+')';
				
				
  			} else {
  				target1.style.display = "none";
				fondo1.style.backgroundImage='url(img/'+Idimagen2+')';
			
			}
			
		

  	}

}

