// JavaScript Document
function Open(src,nom,width,height)
{	
	t=(screen.height-(height))/2 ;
	l=(screen.width-(width))/2;
	var sOptions = "scrollbars=yes,toolbar=no,status=yes,resizable=yes,dependent=yes" ;
	sOptions += ",width=" + width ; 
	sOptions += ",height=" + height ;
	sOptions += ",left=" + l ;
	sOptions += ",top=" + t ;

	// Open the browser window.
	var oWindow = window.open(src,nom, sOptions ) ;
	oWindow.focus();
	
}
//TREURE FOCUS DE TOTS ELS LINKS
function BlurLinks() {
	var links = document.getElementsByTagName('a');
		for(var i in links) {
			links[i].onclick = function() {
			this.blur();
			}
		}
}

var last=false;
function Show(id){
	var ruta = document.getElementById('situ'+id);
	ruta.style.display = 'block';
	
	var target  = document.getElementById('links'+id);
	if(last) { 
		document.getElementById('links'+last).className=''; 
		document.getElementById('situ'+last).style.display = 'none';
	}
	last=id;
	target.className='sel'; 

}
function canvia_imatge(sr,mida)
{
		document.getElementById("imatge_prin").innerHTML="<img src='foto.php?src="+sr+"&width="+mida+"' onclick='javascript:preview(\""+sr+"\")'>";
}
function preview(ruta,x,y)
{
	x=100;
	y=100;
	t=(screen.height-y)/2;
	l=(screen.width-x)/2;
	win=window.open('preview.php?src='+ruta,'preview','status=yes,scrollbars=no,left='+l+',top='+t+',width='+x+',height='+y);


}
function download(ruta)
{
w=window.open(ruta,'download_win','width=780,height=580,top=20,left=20,status=yes,scrollbars=yes,resizable=yes,menubar=yes');
w.focus();
}
