﻿function getnews() {
	var url = '?request=news';

	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
		newsRoot = transport.responseXML.documentElement;
		//$('news').appendChild(newsRoot);
		
		var image1 = '';
		
		var img = newsRoot.firstChild.firstChild.nextSibling.firstChild;
		image1 += '<div style="height: 127px; width: 250px; overflow: hidden;">' +
					'<a href="' +
					img.getAttribute('src').replace('-small', '') + 
					'" rel="lightbox[news1]"><img src="' + 
					img.getAttribute('src') + //'" title="' +
					//img.getAttribute('title') +
					'"/></a>';
					
		img = img.nextSibling;
		while(img != null)
		{
			image1 += '<a href="' +
					img.getAttribute('src').replace('-small', '') + 
					'" rel="lightbox[news1]"/>';
			img = img.nextSibling;
		}
		
		image1 += '</div>';
		
		var image2 = '';
		
		var img = newsRoot.firstChild.nextSibling.firstChild.nextSibling.firstChild;
		image2 += '<div style="height: 127px; width: 250px; overflow: hidden;">' +
					'<a href="' +
					img.getAttribute('src').replace('-small', '') + 
					'" rel="lightbox[news2]"' +
					'">' +
					'<img src="' +
					img.getAttribute('src') + //'" title="' +
					//img.getAttribute('title') + 
					'"/>' +
					'</a>';
		img = img.nextSibling;
		while(img != null)
		{
			image2 += '<a href="' +
					img.getAttribute('src').replace('-small', '') + 
					'" rel="lightbox[news2]"/>';
			img = img.nextSibling;
		}
		
		image2 += '</div>';
		
		$('news1').appendChild(new Element('div', { 'class': 'title'}).update(newsRoot.firstChild.firstChild.firstChild.nodeValue));
		$('news1').appendChild(new Element('div', { 'class': 'subtitle'}).update(newsRoot.firstChild.firstChild.getAttribute('subtitle')));
		$('news1').appendChild(new Element('div', { 'class': 'image'}).update(image1));
		//$('news1').appendChild(new Element('div', { 'class': 'newsbody'}).update(newsRoot.firstChild.firstChild.nextSibling.nextSibling.firstChild.firstChild.nodeValue));
		$('news1').appendChild(new Element('div', { 'class': 'newsbody'}).update("Carnaby Street prosegue la proposta femminile affidandosi anche per la primavera estate al fashion brand Gold Case: un piccolo fenomeno di culto tra gli addetti della moda per la sua vision romanticamente contemporanea.<br/>In passerella da solo due anni ha bruciato le tappe definendo uno nuovo raffinato standard per il fashion street, tra sartoria e innovazione, tra eleganza e semplicit&agrave;"));
		
		$('news2').appendChild(new Element('div', { 'class': 'title'}).update(newsRoot.firstChild.nextSibling.firstChild.firstChild.nodeValue));
		$('news2').appendChild(new Element('div', { 'class': 'subtitle2'}).update(newsRoot.firstChild.nextSibling.firstChild.getAttribute('subtitle')));
		$('news2').appendChild(new Element('div', { 'class': 'image'}).update(image2));
		//$('news2').appendChild(new Element('div', { 'class': 'newsbody'}).update(newsRoot.firstChild.nextSibling.firstChild.nextSibling.nextSibling.firstChild.firstChild.nodeValue));
		$('news2').appendChild(new Element('div', { 'class': 'newsbody'}).update("Fra le nuove proposte per la primavera/estate 2010 Carnaby presenta Paolo Pecora, un brand tutto italiano che trae ispirazione da un delicato bilanciamento fra qualit&agrave ed innovazione, energia ed emozione.<br/>Capi dai colori freddi, con una cura al dettaglio di pregio, progettati per un wearing confidenziale e informale."));
	  }
	});

}
