Problem converting to Vertex/Fragment shaders

I have written this little vertex/fragment program code a little while ago to simulate per-pixel reflection using normal maps.
Everything worked just fine and seeing how everyone seems to jump on the OGLSL bandwagon, I thought I'd give it a try and see if I can convert my mentioned shaders into OGLSL.

Spent few hours reading the pdf posted on the forums webhost, and then proceeded to convert my code.
After many attempts, I got it to work, well not with a serious visual bug though.
The problem is, I'm not getting the correct result and the cube map texture seems to rotate as I move my object around instead of staying fix.

Here's the code, can someone help me out figure what errors I might have skipped during the conversion?

Re: Problem converting to Vertex/Fragment shaders

Why don't you compute the light and view vector in tagent space and pass it to the fragment shader instead of calculating a tangent-space matrix, passing it to the fragment shader and then compute the normal in world space? That would be a lot easier!

There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

There is another theory which states that this has already happened...

There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

There is another theory which states that this has already happened...

Re: Problem converting to Vertex/Fragment shaders

Thanks for the help people, I do really appreciate it
Having said that, keep in mind that I'm trying to put together my very first OGLSL shader, therefore don't expect me to write cutting-edge code on the first try(hint plenty of dot products here and there).
I took sometime and analyzed the sample code posted above which helped me out learning a lot more about the syntax and the cool optimizations that could be done.