Of course, it's heart-wrenching to see American programmers - many of whom are of Indian origin - lose their jobs and have to worry about how they'll pay the mortgage. But they are ill served by politicians who promise to bring their jobs back by the facile tactic of banning them from leaving. This strategy will ensure only that our schools stay terrible; it'll be an entire country run like the dairy industry, feasible only because of price controls and subsidies.
One reason for offshoring is curbs on immigration. If you control the H1-B visa (control the number and add the condition that each H1B visa holders wage cannot be less than the prevailing market wages) then the capital will leave to the places where labor is cheaper. It is pretty simple!
In fact, the capital in the IT industry is much more mobile as it is mostly intellectual (patents, source code, and so on). When IBM decides to cut jobs in the US and move them to India, it doesn't need to relocate factories to India. All it needs to do is purchase new hardware in India and transfer the documents and source code to its India's office. And work can begin in India within a few days.
In such conditions it is futile to expect that you can control wages in US by controlling number of H1B visa granted or putting some stupid conditions that prevailing wages be not disturbed!