contract token is owned, ERC20
{
	using MathFunction for uint256;
	
	// Public variables
	string public name;
	string public symbol;
	uint8 public decimals;
	uint256 public totalSupply;
	
	mapping (address => uint256) public contrubutedAmount;
	mapping (address => uint256) public balanceOf;													// This creates an array with all balances
	mapping (address => mapping (address => uint256)) public allowance;								// Creates an array with allowed amount of tokens for sender
	
	modifier onlyContributer
	{
		require(balanceOf[msg.sender] > 0);
		_;
	}
	
	// Initializes contract with name, symbol, decimal and total supply
	function token() 
	{		
		totalSupply = 166000;  																		// Update total supply
		totalSupply = totalSupply.multiply(10 ** 18);
		balanceOf[msg.sender] = totalSupply;              											// Give the creator all initial tokens
		name = "Global Academy Place";               										// Set the name for display purposes
		symbol = "GAP";                                											// Set the symbol for display purposes
		decimals = 18;                            													// Amount of decimals for display purposes
	}
	
	function balanceOf(address _owner) constant returns (uint256 balance) 
	{
		return balanceOf[_owner];																	// Get the balance
	}
	
	function totalSupply() constant returns (uint256 _totalSupply)
	{
	    return totalSupply;
	}
  
	function transfer(address _to, uint256 _value) returns (bool success) 
	{
		require(balanceOf[msg.sender] >= _value);													// Check if the sender has enough    
		require(balanceOf[_to] <= balanceOf[_to].plus(_value));										// Check for overflows
								
		balanceOf[msg.sender] = balanceOf[msg.sender].minus(_value);                     			// Subtract from the sender
		balanceOf[_to] = balanceOf[_to].plus(_value);                            					// Add the same to the recipient
		
		Transfer(msg.sender, _to, _value);                   										// Notify anyone listening that this transfer took place
		return true;
	}
	
	// A contract attempts to get the coins
	function transferFrom(address _from, address _to, uint256 _value) returns (bool success)			
	{
		require(_value <= balanceOf[_from]);														// Check if the sender has enough
		require(balanceOf[_to] <= balanceOf[_to].plus(_value));										// Check for overflows
		require(_value <= allowance[_from][msg.sender]);											// Check allowance
  									
		balanceOf[_from] = balanceOf[_from].minus(_value);                          				// Subtract from the sender
		balanceOf[_to] = balanceOf[_to].plus(_value);                            					// Add the same to the recipient
		allowance[_from][msg.sender] = allowance[_from][msg.sender].minus(_value);					// Decrease the allowence of sender
		
		Transfer(_from, _to, _value);
		return true;
	}

	// Allow another contract to spend some tokens in your behalf 
	function approve(address _spender, uint256 _value)	returns (bool success) 						
	{
		require((_value == 0) || (allowance[msg.sender][_spender] == 0));
		
		allowance[msg.sender][_spender] = _value;
		Approval(msg.sender, _spender, _value);
		return true;
	}
	
	// Approve and then communicate the approved contract in a single tx
	function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) 
	{    
		tokenRecipient spender = tokenRecipient(_spender);
		if (approve(_spender, _value)) 
		{
			spender.receiveApproval(msg.sender, _value, this, _extraData);
			return true;
		}
	}	
	
	// Function to check the amount of tokens that an owner allowed to a spender
	function allowance(address _owner, address _spender) constant returns (uint256 remaining) 
	{
		return allowance[_owner][_spender];
	}
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) 
{
	return allowance[_owner][_spender];
}

// Function to check the amount of tokens that an owner allowed to a spender