I hope you check back before your court but there is a tecnique called 'silent ridicule'. I don't have the book (loaned it to friend... this seems to be an epidemic wher I work) but I can get the title for you.
The tecnique is to make a list of emabarrasing positions or actions. Then palce a person (exH or OW)in those situations. Practice picturing them in that position/situation prior to seeing them. As soon as you feel an emotion come over you then you bring that picture to your mind to get your emotions or thoughts back.
You can use it in conjuntion with the 'thought stopping' concept that MWD talks about in Divorce Remedy. It may sound odd but it has helped me. I actually change it up a little and think of a time when my wife was least attractive to me (drunk and nasty) but it helps when you want to get a thought out of your head.