var Stripe = new Class({
	initialize: function(song_key,controller) {
		this.song_key = song_key;

		this.li = $('stripe'+this.song_key);
		this.clock = this.li.getElement('.clock');
		this.percentage = this.li.getElement('.loaded');
		
		this.li.addEvent('mouseover',function() {
			this.li.addClass('hover');
		}.bind(this));
		
		this.li.addEvent('mouseout',function() {
			this.li.removeClass('hover');
		}.bind(this));
		
		this.li.addEvent('click',function(e) {
			if(e.target.tagName != 'A') {
				controller.stripeToggle(this.song_key);
			}
		}.bind(this));
	},
	getArtist: function() {
		var artist = this.li.getElement('span.artist').get('text').trim();
		return artist;
	},
	getTitle: function() {
		var title = this.li.getElement('span.title').get('text').trim();
		return title;
	},	
	setLoading: function(bool) {
		if(bool) {
			this.clock.addClass('grey');
			this.clock.set('html','&mdash;');
			this.setPercentage(0);
		}
	},
	setPercentage: function(msg) {
		this.percentage.set('html',$type(msg) == 'number' ? msg+'%' : '');
		if($type(msg) == 'string' && msg.length) {
			this.percentage.set('html',msg);
		}
	},
	setClock: function(seconds) {
		var string = '';
		if($type(seconds) == 'number') {
			var sec = seconds % 60;
			var min = (seconds - sec) / 60;
			var min_formatted = min ? min + ':' : '';
			var sec_formatted = min ? (sec < 10 ? '0'+sec : sec) : sec;
			string = min_formatted + sec_formatted;
		}
		this.clock.set('html',string);
	},
	setActivated: function(bool) {
		if(bool) {
			this.li.addClass('hilite');
		} else {
			this.li.removeClass('hilite');
		}
	},
	setPlaying: function(bool) {
		if(bool) {
			this.clock.removeClass('grey');
			this.clock.addClass('green');
		} else {
			this.clock.removeClass('green');
			this.clock.addClass('grey');
		}
	},
	shutdown: function() {
		this.setPercentage(false);
		this.setClock(false);
		this.setActivated(false);
		this.setPlaying(false);
	}
});