function showHide(id)
{

	if (document.getElementById("texto"+id).style.display=='block'){
			document.getElementById("info"+id).innerHTML='+ Info';
	document.getElementById("texto"+id).style.display='none';

	}else{
					document.getElementById("info"+id).innerHTML='- Info';
		document.getElementById("texto"+id).style.display='block';

	}

}

function cambioinicial(cual)
{
	document.getElementById('fotos').innerHTML='<img id="foto" src="" width="340" style="opacity: 0;visibility:hidden;border:0px solid #000;" />';
	numero=0;
	array_imagenes=(cual==1)? imagenes:imagenes2;
	
	var texto='';

	texto+='<a href="javascript:cambioimg(0)"> << </a>';
    texto+='<font id="contar" style="padding:0 5px;"> 1 / '+array_imagenes.length+' </font>';
    texto+='<a href="javascript:cambioimg(1)"> >> </a>';
	
	document.getElementById("paginar").innerHTML=texto;
	document.getElementById('foto').src='http://www.volumetric.es/img/promociones/'+array_imagenes[0];
	
	opacity('foto',  100, 0, 500);
	setTimeout(redimensionar,800);

}

function cambioimg(modo)
{
	//var ruta=document.location.href.split("=");
	//var parametro=ruta[1];
			
	numero=(modo==0)? numero-1:numero+1;
	if(numero<0)						
		numero=((array_imagenes.length)-1);
	if(numero>((array_imagenes.length)-1))	
		numero=0;
		
		opacity('foto',  100, 0, 500);
	document.getElementById('foto').style.visibility=	"hidden";
		setTimeout(redimensionar,800);
	
	document.getElementById('contar').innerHTML=(numero+1)+" / "+array_imagenes.length;
	
	document.getElementById('foto').src='http://www.volumetric.es/img/promociones/'+array_imagenes[numero];

}

function cambiocontenido(texto)
{
	document.getElementById("paginar").innerHTML='';
	document.getElementById('fotos').innerHTML=texto;

}

function redimensionar()
{
var pic = document.getElementById('foto');
var h = pic.offsetHeight;
var w = pic.offsetWidth;
//alert ('The image size is '+w+'*'+h);
document.getElementById('foto').style.opacity=0;
	if (w>h){
	document.getElementById('foto').width=340;
	}else{
		document.getElementById('foto').width=240;
	}

document.getElementById('foto').style.visibility=	"visible";

opacity('foto',  0, 100, 500);

document.getElementById('foto').className ="corner iradius10 ishadow15 ";

}

function fotopiso(foto)
  {
  //alert (foto);
	document.getElementById("fotos").innerHTML=texto;
	d=document.getElementById("fotos");
	d.style.background='';
		var texto='';
    texto+="<a target='_blank'  href=\"http://www.volumetric.es/img/pisos/grandes/"+ foto + "\"  ><img width=350 src=\"http://www.volumetric.es/img/pisos/" + foto + "\" style='padding-top:18px;'></a>";

	document.getElementById("fotos").innerHTML=texto;
	
	  }

function botones() {
	
	
	
	document.getElementById("boton1").setAttribute("style", "display:inline; height:15px; width: 120px; background:#29487A; padding:5px; margin:0; border:1px solid #dfdfdf;");
	document.getElementById("boton2").setAttribute("style", "display:inline; height:15px; width: 120px; background:#29487A; padding:5px; margin:0; border:1px solid #dfdfdf;");
	if (document.getElementById("boton3")) {
	document.getElementById("boton3").setAttribute("style", "display:inline; height:15px; width: 120px; background:#29487A; padding:5px; margin:0; border:1px solid #dfdfdf;");
	}
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}
