

window.addEvent("load",function(){
	player_url="http://www.mp3.it/static/player/player.php?cid=";
	
	// Se ci sono player
	if($("player-frame") && $$("a.player-trigger").length > 0){
		$$("a.player-trigger").addEvent('click',function(event) {
			
			// Fermo evento
			e = new Event(event);
			e.stop();
			
			// Controllo richiesta
			is_play = true;
			if(this.hasClass('stop')) {
				is_play = false;	
			}

			if(is_play) {
				
				// Fermo tutti i trigger
				$$("a.player-trigger").removeClass('stop');
				$$("a.player-trigger").addClass('play');

				// Modifico stato corrente
				this.addClass('stop');
				this.removeClass('play');
				
				// Lancio player
				this.getParent().grab($("player-frame"));
				$("player-frame").setProperty('src', player_url + this.getProperty('rel'));
				
			} else {

				// Modifico stato corrente
				this.addClass('play');
				this.removeClass('stop');
				
				// Fermo player
				$("player-frame").setProperty('src', '');
			}
		});
	}
});