function playSong(index) {
	var player = $('ply');
	player.sendEvent('ITEM', index)
}

function nowPlaying(params) {
	var actives = $$('td.active')
	
	for (i = 0; i < actives.length; i++) {
		if (i == params.index) {
			actives[i].update('<img class="nowPlaying" src="/graphics/playing_ex.gif" width="15" height="15" alt="now playing"/>');
		} else {
			actives[i].update('');
		}
	}
	
}

function stopped(params) {
	var actives = $$('td.active')
	for (i = 0; i < actives.length; i++) {
		actives[i].update('');
	}
}

function playerReady(obj) {
	var player = $(obj.id)
	player.addControllerListener('STOP', 'stopped');
	player.addControllerListener('ITEM', 'nowPlaying');
}

function hintFieldFocus(textField) {
	var hint = textField.getAttribute('title');

	if (textField.value == hint) {
		textField.value = '';
		$(textField).removeClassName('hint');
		$(textField).addClassName('hintActive');
	} 
}

function hintFieldBlur(textField, submitter) {
	var hint = textField.getAttribute('title');
		
	if (textField.value.blank()) {
		textField.value = hint;
		$(textField).addClassName('hint');
		$(textField).removeClassName('hintActive');
	}
}

function checkSubmit(textField, submitId) {
	if (textField.value.blank()) {
		$(submitId).disabled = true;
	} else {
		$(submitId).disabled = false;
	}
}
