function generar_prenda(data){
	return {
		id:data['id'],
		titulo:data['titulo'],
		talles:data['talles'],
		composicion:data['composicion'],
		colores:data['colores'],
		modelo:data['modelo'],
		precio:data['precio'],
		calidad:data['calidad'],
		imagen:data['imagen'],
		codigo:function(){
			return this.modelo + "-" +this.calidad;
		},
		lista_descripcion:function(){
			return "<li class='title'>"+this.titulo+"</li>"
				+"<li class='price'>"+this.precio+"</li>"
				+"<li>"+this.talles+"</li>"
				+"<li>"+this.composicion+"</li>"
				+"<li>"+this.colores+"</li>"
				+"<li>"+this.codigo()+"</li>";
		},
		to_html:function(){
			return "<div class='product' id='"+this.id+"'>"
				+this.imagen
				+"<ul>"
				+this.lista_descripcion()
				+"</u>"
				+"</div>"
		}
	};
}
function extraer_prenda(tr){
	var tr = jQuery(tr);
	var campos = [
		ac('id','views-field-nid'),
		ac('titulo','views-field-field-description-value'),
		ac('talles','views-field-tid'),
		ac('precio','views-field-phpcode'),
		ac('composicion','views-field-field-producto-composicion-value'),
		ac('colores','views-field-tid-1'),
		ac('modelo','views-field-field-producto-modelo-value'),
		ac('calidad','views-field-field-producto-calidad-value'),
		ac('imagen','views-field-field-producto-imagen-fid')
	];
	var len = campos.length;
	var data = [];
	while(len--){
		campo = campos[len];
		data[campo['titulo']] = tr.children('.'+campo['clase']).html();
	}
	return generar_prenda(data);
}
function ac(titulo_campo,clase_elemento){
	return {'titulo':titulo_campo,'clase':clase_elemento};
}
function extraer_prendas(trs){
	trs = jQuery(trs);
	var prendas = [];
	trs.each(function(i,tr){
		prendas.push(extraer_prenda(tr));
	});
	return prendas;
}