  var index=1;
  var source= new Array();

  var lista = document.getElementById("picbrowser").getElementsByTagName("a");
	
  function makeLinks() {
	
	lista[0].setAttribute("href", "#"); 
	lista[0].setAttribute("onclick", "javascript:return previousPic();");
	
	for (var i=1; i < lista.length-1; i++) {
      lista[i].setAttribute("class", "off"); 
	  lista[i].setAttribute("href", "#"); 
	  lista[i].setAttribute("onclick", "javascript:return changePic('"+i+"');"); 
    }
	
	lista[lista.length-1].setAttribute("href", "#");  
	lista[lista.length-1].setAttribute("onclick", "javascript:return nextPic();"); 
  }
  
   function changePic(n) {
  
    if (!document.getElementById("pic")) return false;
	
	if (isNaN(parseInt(n,10))) n=1;
	else n=parseInt(n,10);
	if (n<1 || n>source.length) return false;	
	
	document.getElementById("pic").setAttribute("src", source[n-1]);
	
	lista[index].setAttribute("class", "off");
	lista[n].setAttribute("class", "on"); 	
	lista[0].blur(); 
	lista[lista.length-1].blur(); 
	lista[n].blur();
	index=n;
	
    return false;
  }

  function nextPic() {
  	changePic(index+1);
    return false;
  }
  
  function previousPic() {
  	changePic(index-1);
    return false;
  }
