//Menu Principal 
function ocultamenu(){
	var menu = document.getElementById("prensa");
	menu.style.display = "none";
}

function despliega(id){
	//Oculto todas las capas
	for (i=0;i<9999 ;i++ )
	{
		if (i != id)
		{
			if(document.getElementById(i)){
				document.getElementById(i).style.display = "none"
			}
		}
	}
	//La clickada o la oculto o la muestro según su valor
	if (document.getElementById(id).style.display == "")
	{
		document.getElementById(id).style.display = "none"
		//document.images["img_principal"].src="images/home2.jpg";
	}
	else{
		if (id > 990)
		{
			document.getElementById(99).style.display = ""	
		}
		document.getElementById(id).style.display = ""
		
	}
}
function despliega2(id){
	
	document.location.href='index.php?pag='+id+'&capa='+id;
}

function despliega3(id,id2){
	//Oculto todas las capas
	for (i=0;i<9999 ;i++ )
	{
		if (i != id)
		{
			if(document.getElementById(i)){
				document.getElementById(i).style.display = "none"
			}
		}
	}
	//La clickada o la oculto o la muestro según su valor
	if (document.getElementById(id).style.display == "")
	{
		document.getElementById(id).style.display = "none"
		//document.images["img_principal"].src="images/home2.jpg";
	}
	else{
		if (id > 990)
		{
			document.getElementById(99).style.display = ""	
				if (id2 > 0)
				{
					document.getElementById(id2).style.display = ""
				}
		}
		document.getElementById(id).style.display = ""
		//document.images["img_principal"].src="images/home.jpg";
	}
}
// Fin Menu Principal

var velocidad=0;
var desplazamiento;


function mover(movimiento){
	
clearTimeout(desplazamiento);
way=movimiento>0?1:0
valor=document.getElementById('tablon2').style.top;
numero=parseInt(valor);
numero+=movimiento;
tope=parseInt(document.getElementById('tablon2').style.top);

/*if ((!way && tope >-altura) || (tope < 0 && way))
{*/
	document.getElementById('tablon2').style.top=numero;
	desplazamiento=setTimeout("mover("+movimiento+")",velocidad);
//}

}

function stop(){clearTimeout(desplazamiento)}
function CargaMapa(tipo,pais){
	if (pais=="172"){
	
	document.getElementById("ifMapa").src = "polonia.php?idtipo=" + tipo
	}
	else{
		document.getElementById("ifMapa").src = "mapa.php?idtipo=" + tipo
	}
}
function CargaProducto(idprovincia, tipo){
	
	document.getElementById("spContenido").innerHTML="<iframe id='ifcontenido' frameborder=0 width='690' height=400></iframe>"
	document.getElementById("ifcontenido").src="producto_compra_vivienda.php?idTC=" + tipo + "&idprov=" + idprovincia;
}


/**** nuevo scroll ****/
scrollList=new Array();
 
function registraScroll(idAbajo, idArriba, div, velAbajo, velArriba)
{

	if(scrollList[idAbajo]==null) scrollList[idAbajo]=new Array();
    if(scrollList[idArriba]==null) scrollList[idArriba]=new Array();
    scrollList[idAbajo].push(new Array(div, velAbajo));
    scrollList[idArriba].push(new Array(div, velArriba));
}
 
//window.onload=inicializar;
 
function getEl(elementId)
{
    return document.getElementById(elementId);
}
 
function inicializar()
{

    for(key in scrollList)
    {
       
		var elemento=getEl(key);
        elemento.onmouseover=iniciaScroll;
        elemento.onmouseout=detieneScroll;
    }
}
 
function iniciaScroll()
{

	scrollDivs=new Array();
    velDivs=new Array();
    for(key in scrollList[this.id])
    {
        scrollDivs.push(getEl(scrollList[this.id][key][0]));
        velDivs.push(scrollList[this.id][key][1]);
    }
    identificador=setInterval('scrollNow()', 50);
}
 
function detieneScroll()
{
    clearInterval(identificador);
}
 
function scrollNow()
{
    for(key in scrollDivs)
    {
    var desplazamientoActual=scrollDivs[key].scrollTop;
    var nuevoDesplazamiento=desplazamientoActual+velDivs[key];
    scrollDivs[key].scrollTop=nuevoDesplazamiento;
    }
} 
function agregar(url){ 

 //var url=;
      var titulo="VEMUSA"; 
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) { 
     
      window.external.AddFavorite(url,titulo); 
	 
   } 
   else { 
      if(navigator.appName == "Netscape") 
   		 window.sidebar.addPanel(titulo,url,""); 
   } 
} 
function imprimir(soloEsto){ 
	if (soloEsto =="ifContenido"){
		var url= document.getElementById(soloEsto).src;
		ventana=window.open(url,"ventana","width=700,height=600,top=0,left=0"); 
		ventana.print();
		ventana.close();
	}
	else{
		var contenido;		
	   contenido= document.getElementById(soloEsto).innerHTML ;
	   if (soloEsto=="imprimir") contenido ="<table>" + contenido + "</table>";
		ventana=window.open("about :blank","ventana","width=700,height=600,top=0,left=0"); 
		ventana.document.open(); 
		ventana.document.write('<html><head><title>VEMUSA</title><link href="styles.css" rel="stylesheet" type="text/css"></head><body onprint="self.close()">'); 	
		ventana.document.write(contenido); 
		ventana.document.write('</body></html>'); 
		
		 try{
			 ventana.document.getElementById("tablon2").style.overflow="visible";
		 ventana.document.getElementById("divtitulo").style.left = 5;
		 }
		 catch (e){
		 }
		ventana.document.close();
		
		ventana.print(); 
		ventana.focus(); 
		ventana.close();
	}
}	
function CambiarEstilo(id1, id2) {
	var elemento2 = document.getElementById(id1);
	elemento2.className = "TextYellowText";
	var elemento = document.getElementById(id2);
	elemento.className ="TextBlueTitlePromoSub";
}

function zoomText(Accion,Elemento){
//inicializacion de variables y parámetros 
var obj=document.getElementById(Elemento);
var max = 200 //tamaño máximo del fontSize
var min = 70 //tamaño mínimo del fontSize
if (obj.style.fontSize==""){
obj.style.fontSize="100%";
}
actual=parseInt(obj.style.fontSize); //valor actual del tamaño del texto 
incremento=10;// el valor del incremento o decremento en el tamaño 

//accion sobre el texto 
if( Accion=="reestablecer" ){
obj.style.fontSize="100%"
}
if( Accion=="aumentar" && ((actual+incremento) <= max )){
valor=actual+incremento;
obj.style.fontSize=valor+"%"
}
if( Accion=="disminuir" && ((actual+incremento) >= min )){
valor=actual-incremento;
obj.style.fontSize=valor+"%"
}
} 
SALTO = 2;
function Cambiotexto(tamano, estilo)
{

if (document.styleSheets)
	{
	
		var theRules = new Array();
		if (document.styleSheets[0].cssRules)
			theRules = document.styleSheets[0].cssRules
		else if (document.styleSheets[0].rules)
			theRules = document.styleSheets[0].rules
		else
			return "Your browser doesn't support rules[] or cssRules[]";

		var returnstring = '';
		for (var i=0;i<theRules.length;i++)
		{
			returnstring += i + ' = ' + theRules[i].selectorText + '<br>';
		
				if (theRules[i].selectorText == '.' + estilo)
			{
			
				t = tamano_actual + tamano;
				if (t > MAXIMO)
					t = MAXIMO;
				else if (t < MINIMO)
					t = MINIMO;
				theRules[i].style.fontSize = t + 'px';
				tamano_actual = t;
			}
		}
	
		return returnstring;
	}
	else
		return "Your browser doesn't support document.styleSheets";
}
function abrirVentana(url){
	my_windowImp =window.open(url, "vOculta", "width=8, height=5");
	//*try{
		//my_windowImp.blur();
		
		setTimeout("cerrarVentana('my_windowImp')", 3000);
		//my_windowImp.close();
	/*}
	catch (e){
	}*/
	
}
function cerrarVentana(v){
	v.close();
}

