Assuming that the chameleon has MBD (most likely option from your information)...it would be in the chameleon's best interest to be taken to a vet so that the nutritional imbalances can be corrected as quickly as possible. Not only will the imbalance cause physical issues it also will affect the organs. The vet could give it injections of calcium followed by a shot of calcitonin when its blood calcium levels are high enough to allow the calcium to be drawn back into the bones. This would be its quickest hope of recovery.
In the meantime, you need to correct your husbandry so that once the chameleon is brought back to good health, it has the best chance of staying healthy.
You can tell the sex by looking at the back of the foot. If there is a tarsal spur there its a male...
http://web.archive.org/web/20060819051951/www.adcham.com/html/husbandry/glossary/tarsalspur.html
You should be gutloading/feeding the insects properly if you want a healthy chameleon.
Feces should be brown and sausage-like and the urates white.
Your chameleon needs a UVB light and a basking light (unless you have been keeping/taking it outside every day). The most often recommended UVB light is the long linear fluorescent Repti-sun 5.0 tube light. For basking you can use a regular incandescent household bulb in a dome hood. Its wattage will be whatever it takes to put the basking temperature in the mid 80's for that age chameleon.
Its important to know that the temperature is in the right range because the chameleon needs appropriate heat to aid in digestion.
For a veiled, I recommend real non-toxic plants that have been well-washed (both sides of the leaves) since they will often nibble on the plants.
Now for the husbandry...
Exposure to the UVB allows the chameleon to produce D3 which allows the calcium in the system to be used.
Appropriate temperatures aid in digestion (as I mentioned) so it plays an indirect part in nutrient absorption.
Since most feeder insects have a poor ratio of calcium to phosphorus, dusting the insects at most feedings with a phos.-free calcium powder (like Rep-cal) helps to make up for this.
I also dust twice a month with a phos.-free calcium/D3 powder. D from supplements can build up in the system so don't overdo it. D3 produced from exposure to UVB shouldn't build up as long as the chameleon can move in and out of the UVB.
I dust twice a month with a vitamin powder that contains a beta carotene (prOformed) source of vitamin A. Beta carotene won't build up in the system like prEformed sources of vitamin A will. However, there is controversy as to whether all/any chameleons can convert it so some people give a little prEformed once in a while. Excess prEformed vitamin A may prevent the D3 doing its job and push the chameleon towards MBD.
I gutload/feed crickets, superworms, roaches, etc. with a wide assortment of greens (dandelions, kale, collards, endive, escarole, etc.) and veggies (carrots, squash, sweet red pepper, sweet potato, zucchini, etc.).
Calcium, phos., D3 and vitamin A are all important players in bone health and other systems in the chameleon and need to be in balance. When trying to balance them you need to look at the supplements, what you feed to the chameleon and what you feed to the insects
Here are some sites that might help you also....
http://chameleonnews.com/07FebWheelock.html
http://web.archive.org/web/200605020...Vitamin.A.html
http://web.archive.org/web/200604210...d.Calcium.html
http://www.uvguide.co.uk/
http://raisingkittytheveiledchameleon.blogspot.com/
http://web.archive.org/web/200601140...ww.adcham.com/