$(document).ready(function(){
				var bandera = 1;
				$.getJSON("http://www.nodolibre.org/nodolibreroot/data/proyectos.json",function(data){
					$.each(data.proyectos, function(i,item){
						nombreItem = item.nombre;
						descripcionItem = item.descripcion;
						urlItem = item.url;
						imagenItem = item.imagen;

						sponsor = $("<div></div>").attr("class","sponsor");
						sponsorFlip = $("<div></div>").attr("class","sponsorFlip");
						imagen = $("<img>").attr("src",imagenItem).attr("alt",nombreItem);
						$(sponsorFlip).append(imagen);

						sponsorData = $("<div></div>").attr("class","sponsorData");
						sponsorDescription = $("<div></div>").attr("class","sponsorDescription").html(descripcionItem);
						sponsorURL = $("<div></div>").attr("class","sponsorURL");
						enlace = $("<a></a>").attr("href",urlItem).html(urlItem);
						$(sponsorURL).append(enlace);
						$(sponsorData).append(sponsorDescription);
						$(sponsorData).append(sponsorURL);

						$(sponsor).append(sponsorFlip);
						$(sponsor).append(sponsorData);

						$(".sponsorListHolder").append(sponsor);

						if(bandera%3==0)
						{
							$(".sponsorListHolder").append($("<div></div>").attr("class","clear"));
						}

						bandera++;

					});
					flipping();
				});


function flipping()
{

	/* The following code is executed once the DOM is loaded */
	
	$('.sponsorFlip').bind("click",function(){
		
		// $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):
		
		var elem = $(this);
		
		// data('flipped') is a flag we set when we flip the element:
		
		if(elem.data('flipped'))
		{
			// If the element has already been flipped, use the revertFlip method
			// defined by the plug-in to revert to the default state automatically:
			
			elem.revertFlip();
			
			// Unsetting the flag:
			elem.data('flipped',false)
		}
		else
		{
			// Using the flip method defined by the plugin:
			
			elem.flip({
				direction:'lr',
				speed: 350,
				onBefore: function(){
					// Insert the contents of the .sponsorData div (hidden from view with display:none)
					// into the clicked .sponsorFlip div before the flipping animation starts:
					
					elem.html(elem.siblings('.sponsorData').html());
				}
			});
			
			// Setting the flag:
			elem.data('flipped',true);
		}
	});
}
	
});

