I'm also an occasional smoker; probably a couple of times per month on average. I don't like weed enough to go through the hassle of buying it, but I usually don't decline it when offered in social situations. I've had an experience where I had to take a test a few days after last smoking. Essentially there are two things you need to do:
1.) Dilute your urine - drink a lot of water.
2.) Mask the fact that you diluted your urine - take vitamin B to make it yellow, take creatine to fool the dilution test.
The various products that are sold are generally either this exact same method or they are useless. The 30 days figure that is often thrown out is pretty much the worst case. If you are not a daily smoker and have an above average metabolism it is quite a bit less.
Also, this is what I recall from several years ago. I don't remember anything about exact dosages. If you are going to follow this advice, do your own research first.