Changing SpriteRenderer orderInLayer via scripting?

I need to make changes in the z-order of objects. When I change the orderInLayer variable via inspector, all is fine. But sometimes I need to change the layer order. How can I do that?

Renderer.sortingOrder

Found it here: http://forum.unity3d.com/threads/217667-Accessing-quot-Order-in-Layer-quot