Okay. I was in a similar situation to yours for a long time. I won't go into too many details, but I got into basically the same things as you. I had trouble with my family's dog, like you, with the innapropriate touching. That made me feel guilty, so I told my parents about it. They told me that it was a bad thing to get into, that it would only lead to pain, and told me that it was basically abusing my pet. I would stop for quite a while, but then I would do it again. This happened a total of three times. After the third time, my parents said we were going to have to give up the dog if I couldn't stop. That was my stopping point: I never bothered my dog again.
Here's the thing: I knew that what I was doing was wrong, as I was taking advantage of a creature that looked to me as her master. However: it took me three tries and the fear of losing my dog to get me to stop.
After that, I had more problems. I found things on the computer, like you, and had a brief episode with that sort of thing. I stopped that completely through sheer will and help from my dad, which I am thankful for. Then, I had trouble with my cat, though it was much less troublesome than what I had done to my dog and no touching occured. I still have some trouble, which is why I want to talk to you.
As I found out with my first dog and the internet stuff, we can break free from these problems if we try hard enough. I understand more or less what you're going through, and I think we can help each other beat this. I thought for a long time that I was the only person on the face of the earth with this problem, and I didn't want you to think the same. Here's a few things I want you to try:
1) Occupy yourself. If you find yourself thinking about doing something you struggle with, find something else to do. Watch T.V. Read a book. Strike up a conversation with someone. Do something to help keep your mind off of whatever it is you don't want to do. I play video games.
2) Avoid things that cause trouble. If you look up things on the internet, don't use the internet unless someone is with you. If you find things in books, get the books as far away from you as possible. I've actually had to throw books away to avoid them.
3) Be vigilant. Don't give up trying to stop if you fail. I've failed many times, and I've discovered that you just have to pick yourself up, dust yourself off, and keep trying.
4) If you find yourself in a tight situation, find something else to focus on. If I'm alone with a pet, I find it helps to either get away from it or pet its head, which is as far away from the problem area as possible.
5) This is very important: do not tell yourself that you are "giving the animal a treat" if you are doing something you shouldn't. The animal does not like it. Please remember this, as I used this excuse for a long time.
6) This is the most important of all: you are not a freak, a weirdo, or "unnatural". Everyone has problems, whether that be gambling or doing drugs or drinking or whatever, and this just happens to be ours. We know it's wrong, just as everyone who does any wrong thing knows, but it's awesome because I can tell you want help and are willing to go the distance. Many people simply can't do that. They can't admit they have a problem, and are unwilling to seek help, and thus never overcome their problem. You, however, are different. You took matters in your own hands despite your parents' responses, despite the fact that your friend showed you all that stuff, despite the fact that you could have very well done nothing and simply let yourself fall into guilt and still have trouble with the animals. That makes you awesome. You have a strong will that not many people can say they have. I probably wouldn't have said anything myself had it not been for your post.
As a final note, I think that we can get each other through this. If you ever need to talk, I'm ready. PM me, post here, do anything to get a hold of me, because I want to help. I'll do anything to insure that you don't go through the same things I did, and I'll always listen. We have a problem, but that doesn't mean we can't get through it.