var noticiasMVS = {
	getNews : function(){
		var i, romper, title, hyperlink, description, photo, li, a, span, spanFoto, spanRojo, img, total, content, h5, a2, pa1, pa2, a3, b;
		i = 0;
		romper = true;
		jq.ajax({
			'url'  : '/php/noticiasMvs.php',
			'dataType' : 'xml',
			'success' : function(datos){
				jq(datos).find('item').each(function() {
					if(i > 1) {
						romper = false;
					}
					else {
						i++;
					}

					title = jq(this).find('title').text();
					desc  = jq(this).find('description').text();
					d = new Array();
					d = desc.split(' ');

					description = d[0] + " " + d[1] + " " + d[2] + " " + d[3] + " " + "...";
					hyperlink   = jq(this).find('link').text();
					photo       = jq(this).find('enclosure').attr('url');

					li   = jq('<li></li>');
					a    = jq('<a></a>').attr({'href' : hyperlink, 'target': '_blank'});
					img  = jq('<img></img>').attr({'src' : photo, 'width' : 62, 'height' : 47});
					//img  = jq('<img></img>').attr({'src' : photo});
			
					span     = jq('<span></span>').attr({'class' : 'descUtimasNoticias'});
					spanFoto = jq('<span></span>').attr({'class' : 'fotoListPodcast'});
					spanRojo = jq('<span></span>').attr({'class' : 'rojo'});
					

					a2 = jq('<a></a>').attr({'href' : hyperlink, 'target' : '_blank'});
					a2.html(title);

					a3 = jq('<a></a>').attr({'href' : hyperlink, 'class' : 'rojo', 'target': '_blank'});
					a3.html('Ver M&aacute;s');
					
					b = jq('<b></b>');
					b.text("Nota completa");

/*
					content = span.append(h5.append(a2));
					content.append(pa1.text(description));
					content.append(pa2.append(a3.append(b)));
*/

					li.append(spanFoto.append(a.html(img)));
					li.append(span.append(title + '.'));
					li.append(span.append(description));
					li.append(span.append(spanRojo.append(a3)));
					

					total = li;

					jq("#noticiasMvs > ul").append(total.append(content));
					return romper;
				});

			},
			'error' : function(err1, stat, errThrown) {
					//console.log("1: " + err1 + " 2: " + stat + " 3: " + errThrown);
			}
		});
	}

};

