var PopularPhotoLoader = Class.create({ albums: [{"id":"7896","name":"The friendliest golden retriever in the world","url":"\/photo\/album\/7896\/","imgTag":"\"The","photoCount":"7"},{"id":"7906","name":"Fire and water rage grips the globe","url":"\/photo\/album\/7906\/","imgTag":"\"Fire","photoCount":"9"},{"id":"7897","name":"The drowned park","url":"\/photo\/album\/7897\/","imgTag":"\"The","photoCount":"5"},{"id":"7891","name":"Living in a Skylodge","url":"\/photo\/album\/7891\/","imgTag":"\"Living","photoCount":"7"},{"id":"7904","name":"Disfigured beauty of tribal women","url":"\/photo\/album\/7904\/","imgTag":"\"Disfigured","photoCount":"9"},{"id":"7895","name":"US Air Force: Past and present","url":"\/photo\/album\/7895\/","imgTag":"\"US","photoCount":"12"},{"id":"7898","name":"Unusual and creepy designer creations","url":"\/photo\/album\/7898\/","imgTag":"\"Unusual","photoCount":"9"},{"id":"7890","name":"San Fermin Festival: Running of the bulls","url":"\/photo\/album\/7890\/","imgTag":"\"San","photoCount":"7"},{"id":"7899","name":"Lions kill croc for dinner","url":"\/photo\/album\/7899\/","imgTag":"\"Lions","photoCount":"6"},{"id":"7902","name":"Drones in modern air force","url":"\/photo\/album\/7902\/","imgTag":"\"Drones","photoCount":"9"},{"id":"7905","name":"Beautiful natural parks","url":"\/photo\/album\/7905\/","imgTag":"\"Beautiful","photoCount":"8"},{"id":"7900","name":"Tornadoes, fires and Nicolas Cage movie mishap","url":"\/photo\/album\/7900\/","imgTag":"\"Tornadoes,","photoCount":"8"},{"id":"7903","name":"Amazing and curious designer creations","url":"\/photo\/album\/7903\/","imgTag":"\"Amazing","photoCount":"9"},{"id":"7894","name":"Gigantic bridges of the world","url":"\/photo\/album\/7894\/","imgTag":"\"Gigantic","photoCount":"6"},{"id":"7901","name":"Shark attacks surfer live on TV","url":"\/photo\/album\/7901\/","imgTag":"\"Shark","photoCount":"5"},{"id":"7888","name":"This week has claimed too many lives","url":"\/photo\/album\/7888\/","imgTag":"\"This","photoCount":"9"},{"id":"7889","name":"Biologist puts 50 sharks in a trance","url":"\/photo\/album\/7889\/","imgTag":"\"Biologist","photoCount":"6"},{"id":"7887","name":"Zaha Hadid: Evoking chaos of modern life","url":"\/photo\/album\/7887\/","imgTag":"\"Zaha","photoCount":"9"},{"id":"7886","name":"Beauty of foggy mornings","url":"\/photo\/album\/7886\/","imgTag":"\"Beauty","photoCount":"7"},{"id":"7893","name":"Trains crash, fires and heat rage","url":"\/photo\/album\/7893\/","imgTag":"\"Trains","photoCount":"7"},{"id":"7689","name":"Irina Shayk, Stephen James and shoes","url":"\/photo\/album\/7689\/","imgTag":"\"Irina","photoCount":"9"},{"id":"7851","name":"News from space","url":"\/photo\/album\/7851\/","imgTag":"\"News","photoCount":"8"},{"id":"7857","name":"Russia's Black Sea Fleet marks its birthday","url":"\/photo\/album\/7857\/","imgTag":"\"Russia","photoCount":"11"},{"id":"7882","name":"Sikorsky MH-53: Super Jolly Green Giant","url":"\/photo\/album\/7882\/","imgTag":"\"Sikorsky","photoCount":"6"}], count: 5, horizontal: true, nodeId: 'gallery-id', newWindow: false, target: '_self', url: null, initialize: function(count, horizontal, nodeId, newWindow, url) { this.count = count; this.horizontal = horizontal; if (nodeId) this.nodeId = nodeId; if (newWindow) this.newWindow = newWindow; this.target = newWindow ? '_blank' : '_self'; if (url) this.url = url; this.render(); }, render: function() { var table = new Element('table', {'class' : 'frame', 'style' : 'width:100%;font-size:12px;'}); if (this.horizontal) var row = table.insertRow(-1); var limit = this.albums.length > this.count ? this.count : this.albums.length; this.albums.shuffle(); for (var i=0; i < limit; i++) { if (!this.horizontal) var row = table.insertRow(-1); var cell = row.insertCell(-1); cell.setAttribute('valign', 'top'); if (limit == 2) cell.setAttribute('style', 'width:50%'); if (this.albums[i].imgTag) { var a = new Element('a', {'href' : ((this.url ? this.url : '')+this.albums[i].url), 'target' : this.target}); a.innerHTML = this.albums[i].imgTag; cell.appendChild(a); } var a = new Element('a', {'href' : ((this.url ? this.url : '')+this.albums[i].url), 'target' : this.target}); a.appendChild(document.createTextNode(this.albums[i].name)); cell.appendChild(a); cell.appendChild(new Element('br')); var a = new Element('a', {'href' : ((this.url ? this.url : '')+this.albums[i].url), 'class' : 'hot', 'target' : this.target}); a.appendChild(document.createTextNode('('+this.albums[i].photoCount+' photos)')); cell.appendChild(a); } $(this.nodeId).innerHTML = ''; $(this.nodeId).appendChild(table); } });