function Thumbnail(what_show, counter, foto)
{
  this.what_show=what_show;
  this.counter=counter;
  this.foto=foto;

  return this;
}
var thumbnails_a=new Array();

function write_thumbnails()
{
  var what_show;
  var counter;
  var foto;
  var str="<table height=12 valign='top' cellpadding=5 border=0 cellspacing=1 ><tr>";
  for ( var i=0; i<thumbnails_a.length; i++ ) {
    what_show=thumbnails_a[i].what_show;
    counter=thumbnails_a[i].counter;
    foto=thumbnails_a[i].foto;
    if ( i % 3 == 0 && i > 0 ) {
      str+="</tr><tr>";
    }
    str+='<td width="33%" align="center" valign="top"><a  href="'+PHP_SELF+'&action=mostrar_pagina&counter_codi='+counter+'"><img class="thumb" src="thumbs/'+foto+'"  border="0"></a><span style="font-size:4px"><br><br></span><span class="description" align="center">'+what_show+' </span></td>';
  }
  str+="</tr></table>";

  return str;	
}

function write_thumbnail(what_show, counter, imatge)
{
  var str;
  if ( what_show != "none" ) {
    str='<a  href="'+PHP_SELF+'&action=mostrar_pagina&counter_codi='+counter+'"><img src="thumbs/'+imatge+'" border="0"></a>';
  }
  else {
    str='<a  href="#" onclick=\'open_image("fotos/'+imatge+'", "")\'><img src="thumbs/'+imatge+'" border="0"></a>';
  }

  return str;	
}
function write_titol_antic(id_categoria)
{
  if ( cat_depth == 2 ) {
    if ( typeof(scat_a) != "undefined" ) {
      for ( var i=0; i<scat_a.length; i++ ) {
	var cat_a=scat_a[i].cat_a;
	if ( typeof(cat_a) != "undefined" ) {
	  for ( var j=0; j<cat_a.length; j++ ) {
	    if ( id_categoria == cat_a[j].codi ) {
	      var str=scat_a[i].nom+" | "+cat_a[j].nom;
	      document.write(str);
	      return;
	    }
	  }
	}
      }
    }
  }
  else {
    if ( typeof(scat_a) != "undefined" ) {
      for ( var j=0; j<scat_a.length; j++ ) {
	if ( id_categoria == scat_a[j].codi ) {
	  var str=scat_a[j].nom;
	  document.write(str);
	  return;
	}
      }
    }
  }
}
function write_titol(id_categoria, n_productos)
{
  if ( cat_depth == 2 ) {
    if ( typeof(scat_a) != "undefined" ) {
      for ( var i=0; i<scat_a.length; i++ ) {
	var cat_a=scat_a[i].cat_a;
	if ( typeof(cat_a) != "undefined" ) {
	  for ( var j=0; j<cat_a.length; j++ ) {
	    if ( id_categoria == cat_a[j].codi ) {
	      var str="<span class='titol1'>&nbsp;&nbsp;&nbsp;&nbsp;<b>Usted esta en: </b></span><span class='titol1'><span class='posicio'>Catalogo</span> | "+scat_a[i].nom+" | "+cat_a[j].nom;
	      document.write(str);
	      return;
	    }
	  }
	}
      }
    }
  }
  else {
    if ( typeof(scat_a) != "undefined" ) {
      for ( var j=0; j<scat_a.length; j++ ) {
	if ( id_categoria == scat_a[j].codi ) {
	  var str=scat_a[j].nom;
	  document.write(str);
	  return;
	}
      }
    }
  }
  var n_productos=parseInt(n_productos);
  if ( !isNaN(n_productos)){
    var productos=n_productos == 1 ? "producto" : "productos";
    if ( id_categoria) {
      document.write("<span style='font-size:9px;font-family:Tahoma,Arial;color:#0A5096'>&nbsp;&nbsp;<b>("+n_productos+" "+productos+")</b><span><br>");
    }
    else {
      document.write("<span style='font-size:9px;font-family:Tahoma,Arial;color:#0A5096'>&nbsp;&nbsp;<b>Encontrados "+n_productos+" "+productos+"</b><span><br>");

    }
  }

}

function write_foto(codi_producto, img_foto, fotos_dir, fotos_hr_dir)
{
  var str;
  if ( img_foto != "" ) {
    str='<a href="#" onclick=\'open_image("'+fotos_hr_dir+'/'+img_foto+'", "'+codi_producto+'")\'><img src="'+fotos_dir+'/'+img_foto+'" width="400" height="300" border="0"></a><br><br><center><span style=\'font-size:10px;font-family:Tahoma,Arial;\'>Premere sulla foto per ingrandirlo</span></center>';
  }
  else {
    str='';
  }

  //alert(str);
  document.write(str);
}  

