function stock(code) {
	var move = function(value) {
		$.post('/hints', { 'stock_id' : code, 'expecting' : value}, function(data) {
		    $('.result_' + code).html(data.message).show('blind');
			$('.st_' + code).html(data.today);
			$('.st_' + code).css("color", data.color);
		});
	};
	return {
		up : function() { move(1);},
		down : function() { move(-1);}
	};
}

function user() {
	return {
		notify : function(what_type, should_notify) {
			method = should_notify ? "post" : "delete";
			$.post('/notification', { '_method' : method, 'type' : what_type}, function(data) {
			    $('#notify_cb').html(data.message).show('blind');
			});
		},
		accept : function(who) {
			$.post('/users/' + who, { '_method' : 'put'}, function(data) {
			    $('#accept_cb').dialog("close");
			});
		}
	};
}

function configureSlide() {
	$('.slide-out-div').tabSlideOut({
		onAction: function() {
			$('.slide-out-div').html('<iframe src="https://spreadsheets1.google.com/embeddedform?formkey=dDVDS2ZtM1B6aTdYZWhVZlN6WUN0QWc6MQ" width="760" height="625" frameborder="0" marginheight="0" marginwidth="0">Carregando...</iframe>');
			$('.slide-out-div').css("width", "760");
			$('.slide-out-div').css("height", "640");
		},
        tabHandle: '.handle',
        pathToTabImage: '/images/contact_tab.gif',
        imageHeight: '122px',
        imageWidth: '40px',
        tabLocation: 'right',
        speed: 300,
        action: 'click',
        topPos: '200px',
        leftPos: '20px',
        fixedPosition: false
    });
}
