
var AuthClass =
{
	checkForm : function()
	{
		if($("#login_input").attr("value") == "")
			return false;
			
		if($("#password_input").attr("value") == "")
			return false;
			
		return true;
	},

	reloadAccountInfo : function()
	{
		var req = createRequestObject();
		if (req)
		{
			req.open("GET", "/cgi-bin/user/info.pl", true);
			req.send(null);
			req.onreadystatechange = function() { AuthClass.setAccountInfo(req) };
		}
	},

	setAccountInfo : function(req)
	{
		if (req.readyState == 4)
		{
			if (req.status == 200)
			{
				var newMoneyValue = req.responseText;

				if (newMoneyValue.match(/^\d+\.\d+$/))
				{
					user_balance = newMoneyValue;
					$('#span_user_balance').html(newMoneyValue);
				}
			}
		}

		SlipClass.hideLoading();
	}
};

var CssExtClass =
{
	selectOddHover : function(obj)
	{
		$(obj).animate( { backgroundColor: '#0b51ac', color: '#ffffff' }, { queue: true, duration: 600 } );
	},

	selectOddNormal : function(obj)
	{
		$(obj).animate( { backgroundColor: '#dfe7f3', color: '#0b51ac' }, { queue: true, duration: 600 } );
	},

	clickButton : function(obj)
	{
		if($(obj).get(0))
		{
			var type = $(obj).get(0).tagName.toLowerCase();

			switch(type)
			{
				case 'a':
					$(obj).animate( { opacity: 0.2 }, { duration: 250, queue: false } );
					//$(obj).attr("href", "");
					$(obj).attr("onclick", "");
				break;

				case 'img':
					$(obj).animate( { opacity: 0.6 }, { duration: 250, queue: false } );
					$(obj).attr("onclick", "");
				break;

				case 'div':
					$(obj).animate( { opacity: 0.6 }, { duration: 250, queue: false } );
					$(obj).attr("onclick", "");
				break;
			}
		}
	},

	unclickButton : function(obj)
	{
		if($(obj).get(0) != 'undefined')
		{
			var type = $(obj).get(0).tagName.toLowerCase();

			switch(type)
			{
				case 'a':
				case 'img':
				case 'div':
					$(obj).animate( { opacity: 1 }, { duration: 250, queue: false } );
				break;
			}
		}
	},

	unclickButtonBet : function(obj, id, v_id)
	{
		$(obj).animate( { opacity: 1 }, { duration: 250, queue: false } );
		$(obj).click(function()
		{
			SlipClass.add(v_id);
			CssExtClass.clickButton(this);
		});
	}
};
