function abreURL(url)
{

 window.open(url,'_self');

}

function galeria(dist)
{
	
	
	var minis =$('.miniG');
	var nMinis = minis.length;
	
	//numIma = 8;
	//margen = dist;
	//factor = Math.round((ancho-40)/numIma)-margen;// 40 es al ancho de la barra desplazadora
	factor= 150;
	
	cuantas = Math.floor((ancho-20)/(150+dist));
	
	modW =  (cuantas*155)+20;
	//if(modW > ancho){modW=ancho;}
	modL = Math.round((ancho-modW)/2);
	//if(modL < 0){modL=0;}
	
	
	//$('#albumPro').css("border","1px solid red");
	$('#albumPro').css("width", modW + "px");
	$('#albumPro').css("left", modL + "px");
	$("#albumPro").css("height",cos);

	for	(n=0;n<=nMinis;n++)
	{
		
		$("#miniG"+n ).css("margin-right",dist + "px");
		$("#miniG"+n ).css("margin-bottom",dist+"px");
	
		$("#miniG"+n ).css("visibility","visible");
		
		
		$("#bildG"+n ).css("width",factor);
		$("#velo"+n ).css("height",factor);
		
		
	}	
	
	$("#fondo").css("z-index",20);
	$('#albumPro').jScrollPane();
	
	
}


function fondoUp()
{
	$("#fondo").css("z-index",51);
	
	
}


function closePro()
{
	
	document.getElementById("centroCos").innerHTML="";
	fondoUp();
}
//-----------------------------------------------------------------

function titulo(ref)
{
	$("#velo"+ref).css("visibility","visible")
}

function foto(ref)
{
	$("#velo"+ref).css("visibility","hidden")
}
//------------------------------------------------------------

var diapos;
var pies;
var pasos;
var prev=0;
var next=0;
var auto=true;
var carpeta;

function verPro(pro)
{
	
	
	
	
	
	$('#cos').css("background-image","url(./maqueta/velo.png)");
	$('#cos').css("background-repeat","repeat");
	
	
	diapos = document.getElementById("proImg").getElementsByTagName("li");
	pies = document.getElementById("proPie").getElementsByTagName("li");
	
	pasos = diapos.length;
	
	var fo = document.getElementById("container"); // 1

	for	(b=0;b<pasos;b++)
	{
		var img = diapos[b].innerHTML;
		
		var imgM = document.createElement('img');
			
			imgM.src = './contenido/pro/pro_'+ pro + '/' + img;
			
			fo.appendChild(imgM); // 4
			
		cont++;
		
	}
	
	$('#fotoPro').css("opacity",1);
	
	carpeta=pro;
	play();
}


var mira =true;

function showThis(B)
{
	//mira=true;
	$('#led'+ B).css("background-color","#369");
	next=B;
	clearTimeout(timer);
	play();
	
}

function play()
{
	
	//$('#led'+ prev).removeClass("on").addClass("off");
	//$('#led'+ next).removeClass("off").addClass("on");

	$('#led'+ prev).css("background-color","#888");
	
	prev = next;
	
	$('#led'+ next).css("background-color","#f00");
	
	document.getElementById("fotoPro").innerHTML	='<img src="./contenido/pro/pro_' + carpeta + '/' + diapos[next].innerHTML  +'" />';
	document.getElementById("textoPro").innerHTML	= pies[next].innerHTML;
	
	
	next = next+1;
	if(next==pasos)
	{
		next=0;
	}
	
	if(auto && pasos>1)
	{
		timer = setTimeout("play()",9000); 
	}
	
}


function cambia()
{
	next = next+1;
	if(next==pasos)
	{
		next=0;
	}
	
	
}





function autoPlay()
{
	auto=!auto;
	
	if(auto)
	{
		$("#control").css("top","-20px");
		play();
	}
	if(!auto)
	{
		$("#control").css("top","0px");

	}
	
}















