mediabox.clear = false; mediabox.deselect = function (){ var target = document.getElementById("mediabox-tabs"); var tabs = target.getElementsByTagName("li"); for (var i = 0; i < tabs.length; i++){ $(tabs[i]).removeClassName('selected'); }; }; mediabox.select = function (id, section, highlightVideoId) { this.id = id; this.section = section; var target = $(this.name + "-tab-"+id); this.deselect(); target.addClassName('selected'); if (this.clear == true){ if (this.current){ var old = document.getElementById(this.current); this.remove(old); }; $(this.name+'-box').setStyle({ 'background-image': 'url(images/loading_ad.gif)' }); } this.apiCall(id,section,highlightVideoId); }; mediabox.apiCall = function (id , section, highlightVideoId){ //var highlightVideoId = 326; var options = { method : 'post', parameters : 'r=feed/media' + '&contentType='+id + '§ion='+section+'&texthighlightVideoId='+highlightVideoId , onSuccess: this.onComplete.bindAsEventListener(this) }; new Ajax.Request(Loader.AJAX_PATH + 'index.php', options); }; mediabox.onComplete = function (transport){ var data = eval('(' + transport.responseText + ')'); //alert(data.contentType); //alert(data.returnData); //alert(data.html); var target = $(this.name+"-content"); target.update(""); target.setStyle({ 'background-image': 'none' }); var id = ''; if(data.contentType == 'videos'){ //alert(data.html); //alert(this.name+"-content-video"); id = this.name + "-content-video"; var tmp_div = new Element('div', { 'class': 'mediabox-content', 'id': id }).update(data.html); tmp_div.setStyle({ 'display': 'none' }); target.appendChild(tmp_div); Effect.Appear(tmp_div, { duration: 0.5 }); } else if(data.contentType == 'images'){ var target = $(this.name+"-content"); target.style.backgroundImage = "none"; target.innerHTML = data.html; var json = data.returnData; gallery = new Gallery('gallery', 'mediabox', json, 5, true); $(this.name + '-description').innerHTML = data.albumTitle; } this.current = id; };