patched code

I have corrected my code fu pah and this is the code form this project with all my tweaks that were made to make better use of it in the jq grid widget and as a stand alone.