this is really a ugly hack, since this can lead to broken URLs such as server?&version=1.0.0 or server?service=wfs&&version=1.0.0 ... 

OpenLayers has utility functions for this kind of job...