Please wrap your code in the appropriate tags (read the forum rules to see how). And for the benefit of all I highly recommend posting an SSCCE