if(typeof(Delicious) == 'undefined') Delicious = {} Delicious.Mp3 = { oplay: null, playimg: null, startplayimg: null, starthref:null, player: null, videoplayer:null, go: function() { var all = document.getElementsByTagName('a') for (var i = 0, o; o = all[i]; i++) { if(o.href.match(/\.mp3$/i)) { Delicious.Mp3.oplay=o; Delicious.Mp3.starthref=o.href; Delicious.Mp3.startplayimg = img; //var img = document.createElement('') //img.id='playimg'+i; var img = document.createElement('img'); // img.setAttribute('id',['playimg'+i]); //var img1=document.getElementById('playimg1');alert(img1); img.src = 'http://static.delicious.com/img/play.gif'; img.title = 'listen' img.height = img.width = 12 img.style.border = 'none' img.style.marginRight = '4px' img.style.cursor = 'pointer' img.onclick = Delicious.Mp3.makeToggle(img, o.href) o.parentNode.insertBefore(img, o) }} Delicious.Mp3.videoplayer=videoplayerhtml; //Delicious.Mp3.toggle(img, Delicious.Mp3.starthref) }, toggle: function(img, url) { if (Delicious.Mp3.playimg == img) Delicious.Mp3.destroy() else { if (Delicious.Mp3.playimg) Delicious.Mp3.destroy() var a = img.nextSibling, c='' if (document.defaultView && document.defaultView.getComputedStyle) c = document.defaultView.getComputedStyle(a,null).getPropertyValue('color') else if (a.currentStyle) c = a.currentStyle['color'] c = c.replace(/^rgb|[ ()]/g, '') var hex = c.match(/^#?([a-f0-9]{6})$/), hexSm = c.match(/^#?([a-f0-9]{3})$/), rgb = c.match(/^([0-9]+),([0-9]+),([0-9]+)$/) if (rgb) { var c16 = "0123456789abcdef", c=''; for(var i=1,d;d=rgb[i];i++) { var j=d%16; c=c+c16.charAt((d-j)/16)+c16.charAt(j) } } else if (hex) c = hex[1] else if (hexSm) c = hexSm[1].charAt(0) + hexSm[1].charAt(0) + hexSm[1].charAt(1) + hexSm[1].charAt(1) + hexSm[1].charAt(2) + hexSm[1].charAt(2) else c = "000000" img.src = 'http://www.petricanicoara.ro/js/playtagger.php?Site=http://www.petricanicoara.ro&Url='+url; Delicious.Mp3.playimg = img; trafic(url); Delicious.Mp3.player = document.createElement('span') Delicious.Mp3.player.innerHTML = '' + '' + '' + '' + '' + '' img.parentNode.insertBefore(Delicious.Mp3.player, img.nextSibling); document.getElementById('videoplayer').innerHTML=Delicious.Mp3.videoplayer; }}, destroy: function() { try { //alert(Delicious.Mp3.playimg); if (!(Delicious.Mp3.playimg == null)) { Delicious.Mp3.playimg.src = 'http://static.delicious.com/img/play.gif'; Delicious.Mp3.playimg = null Delicious.Mp3.player.removeChild(Delicious.Mp3.player.firstChild); Delicious.Mp3.player.parentNode.removeChild(Delicious.Mp3.player); Delicious.Mp3.player = null } }catch (e) {alert(e);} }, makeToggle: function(img, url) { return function(){ Delicious.Mp3.toggle(img, url) }}, makeTogglestart: function(img) { //img=document.getElementById('playimg1'); return function(){ Delicious.Mp3.toggle(img, Delicious.Mp3.starthref) } } } Delicious.addLoadEvent = function(f) { var old = window.onload if (typeof old != 'function') window.onload = f else { window.onload = function() { old(); f() }} } Delicious.addLoadEvent(Delicious.Mp3.go)