Well, the IF stuff is simple.
code:
if $count > 0 and $count < 10
'do something' ?
endif
The email stuff is pretty straight forward as well. Search the board for the word "blat" and you'll get lots of examples. There are other ways besides blat but you will likely get some in your search.
The escalation though will take a bit of thought. How do you plan to stop the escalation?
I have in place on my network two notification systems that use escalation. Both are commercial 3rd part apps. One is Whatsup Gold from www.ipswitch.com and the other, our paging system that uses software from http://www.emergin.com als has ways for recipients to stop the escalation.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.