contract XGTToken is StandardToken { // XGTToken is the name of the contract to be deployed on the blockchain
    /* Public variables of the token */
    //string public name;                   // Token Name
	string public constant name="XGT";                   // Token Name
    //uint8 public decimals;                // How many decimals to show. To be standard complicant keep it 18
	uint8 public constant decimals=18;                // How many decimals to show. To be standard complicant keep it 18
    string public constant symbol="XGT";                 // An identifier: eg SBX, XPR etc..
    string public version = 'J1.0'; 
    uint256 public unitsOneEthCanBuy;     // How many units of your coin can be bought by 1 ETH?
    uint256 public totalEthInWei;         // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here.  
    address public fundsWallet;           // Where should the raised ETH go?

    function XGTToken() public  {
        balances[msg.sender] 	= 150000000000000000000000000;        
        _totalSupply          	= 150000000000000000000000000;               
                                               
        unitsOneEthCanBuy = 180;                             
        fundsWallet = msg.sender;   
		owner = msg.sender; 
    }
    function() public payable{
        totalEthInWei = totalEthInWei + msg.value;
        uint256 amount = msg.value * unitsOneEthCanBuy;
        if (balances[fundsWallet] < amount) {
            return;
        }
        balances[fundsWallet] = balances[fundsWallet] - amount;
        balances[msg.sender] = balances[msg.sender] + amount;
        //Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
        emit Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
        //Transfer ether to fundsWallet
        fundsWallet.transfer(msg.value);                               
    }
    /* Approves and then calls the receiving contract */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        //Approval(msg.sender, _spender, _value);
        emit Approval(msg.sender, _spender, _value);
        if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
        return true;
    }
	
}
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
    allowed[msg.sender][_spender] = _value;
    //Approval(msg.sender, _spender, _value);
    emit Approval(msg.sender, _spender, _value);
    if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
    return true;
}

/* Approves and then calls the receiving contract */