contract StandardToken{
    
    using SafeMath for uint256;
    
    // create mapping from ether address to uint for balances
    mapping (address => uint256) balances;
    
    mapping (address => mapping(address => uint256)) approved;
    
    // public events on ether network for Transfer and Approval 
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
    
    uint256 public totalSupply;
    
    // returns the total supply of all prosperium presale tokens
    function totalSupply() constant returns (uint totalSupply){
        return totalSupply;
    }
    
    // returns address specified as "_owner"
    function balanceOf(address _owner) constant returns (uint256 balance){
        return balances[_owner];
    }
    
    // transfer _value PP tokens from msg.sender to _to 
    function transfer(address _to, uint256 _value) returns (bool success){
        
        require(_to != address(0));
        
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        Transfer(msg.sender, _to, _value);
        return true;
        
    }
    
    // permission from owner to approve spender(s)
    function approve(address _spender, uint _value) returns (bool success){
        
        require((_value == 0) || (approved[msg.sender][_spender] == 0));

        approved[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
        
    }
    
    // amount of coins allowed to spend from another account
    function allowance(address _owner, address _spender) constant returns (uint256 remaining){
        
        return approved[_owner][_spender];
        
    }
    
    /**
   * approve should be called when allowed[_spender] == 0. To increment
   * allowed value is better to use this function to avoid 2 calls (and wait until 
   * the first transaction is mined)
   * from https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol
   */
    function increaseApproval (address _spender, uint _addedValue) 
    returns (bool success) {
    approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue);
    Approval(msg.sender, _spender, approved[msg.sender][_spender]);
    return true;
  }

  function decreaseApproval (address _spender, uint _subtractedValue) 
    returns (bool success) {
    uint oldValue = approved[msg.sender][_spender];
    if (_subtractedValue > oldValue) {
      approved[msg.sender][_spender] = 0;
    } else {
      approved[msg.sender][_spender] = oldValue.sub(_subtractedValue);
    }
    Approval(msg.sender, _spender, approved[msg.sender][_spender]);
    return true;
  }
    // transfer tokens from owners account to given address _to
    function transferFrom(address _from, address _to, uint _value) returns (bool success){
        
        require(_to != address(0));
        
         var _allowance = approved[_from][msg.sender];

        balances[_from] = balances[_from].sub(_value);
        balances[_to] = balances[_to].add(_value);
        approved[_from][msg.sender] = _allowance.sub(_value);
        Transfer(_from, _to, _value);
        return true;
        
    }
    
}
function totalSupply() constant returns (uint totalSupply){
        return totalSupply;
    }
// returns the total supply of all prosperium presale tokens