$(document).ready(function() {
	$(document).pngFix();
	
	$('input.textbox[rel=hint]').each(function(index) {
		$(this).attr('placeholder', $(this).val());
	});
	
	$('input.textbox[rel=hint]').focus(function(e) {
		e.preventDefault();
		if($(this).val() == $(this).attr('placeholder')) {
			$(this).val('');
		}
	});
	
	$('input.textbox[rel=hint]').blur(function(e) {
		e.preventDefault();
		if($(this).val() == '') {
			$(this).val($(this).attr('placeholder'));
		}
	});
	
	
	$('table.actions-report th').click(function(e) {
		toggleActionsReport($(this).parents('table:first').find('tbody'));
	});
});


function fix(str) {
	var separator = '.';
	var _num = str.toString().split('').reverse();
	// console.debug(_num);
	var _len = _num.length;
	for(var i = 2; i < _len; i += 3) {
		i++;
		_num.splice(i, 0, separator);
	}
	
	return _num.reverse().join('');
}



function toggleActionsReport(el) {
	if($(el).is(':visible')) {
		$(el).hide();
		$(el).parents('table:first').find('span.arrow-indic').text('►')
	}
	else {
		$(el).show();
		$(el).parents('table:first').find('span.arrow-indic').text('▼')
	}

}
