function mateAnimal(uint parent1Id, uint parent2Id, string animalName,string animalDesc) public payable 
    {
        require (!isContractPaused);
        require(msg.sender != 0x0);
        
        
        require (token.ownerOf(parent2Id) == msg.sender);
        
        
        require(token.ownerOf(parent2Id)!=token.ownerOf(parent1Id));
        
        
        require(animalAgainstId[parent1Id].upForMating==true);
		
		require(animalAgainstId[parent1Id].isSpecial==false);
		require(animalAgainstId[parent2Id].isSpecial==false);
		

        
        uint price=animalAgainstId[parent1Id].priceForMating;
        
        
        uint OwnerPercentage=animalAgainstId[parent1Id].priceForMating.mul(ownerPerThousandShareForMating);
        OwnerPercentage=OwnerPercentage.div(1000);
        
        uint priceWithOwnerPercentage = animalAgainstId[parent1Id].priceForMating.add(OwnerPercentage);
        
        
        require(msg.value>=priceWithOwnerPercentage);
        uint generationnum = 1;

        if(animalAgainstId[parent1Id].generationId >= animalAgainstId[parent2Id].generationId)
        {
        generationnum = animalAgainstId[parent1Id].generationId+1;
        }
        else{
        generationnum = animalAgainstId[parent2Id].generationId+1;
        
        }
        
         uniqueAnimalId++;

        
        animalObject = AnimalProperties({
            id:uniqueAnimalId,
            name:animalName,
            desc:animalDesc,
            upForSale: false,
            priceForSale:0,
            upForMating: false,
            eggPhase: true,     
            priceForMating:0,
            isBornByMating:true,
            parentId1: parent1Id,
            parentId2: parent2Id,
            birthdate:now,
            costumeId:0,
            generationId:generationnum,
			isSpecial:false
          });
        
        token.sendToken(msg.sender,uniqueAnimalId,animalName);
        
        animalAgainstId[uniqueAnimalId]=animalObject;
        
        eggPhaseAnimalIds.push(uniqueAnimalId);
        
        
        childrenIdAgainstAnimalId[parent1Id].push(uniqueAnimalId);
        childrenIdAgainstAnimalId[parent2Id].push(uniqueAnimalId);

        
        for (uint i=0;i<upForMatingList.length;i++)
        {
            if (upForMatingList[i]==parent1Id)
                delete upForMatingList[i];   
        }
        
        
        animalAgainstId[parent1Id].upForMating = false;
        animalAgainstId[parent1Id].priceForMating = 0;
        
        
        token.ownerOf(parent1Id).transfer(price);
        
        
        owner.transfer(OwnerPercentage);
        
        
        if(msg.value>priceWithOwnerPercentage)
        {
            msg.sender.transfer(msg.value.sub(priceWithOwnerPercentage));
        }
        
    }