Detach From Parent

I know i can use something like this to attach an object.

var player = GameObject.FindWithTag("Player").transform;

//Attach Object
transform.parent = player;

How Could i detach the object i attached?

Just set transform.parent to null:

transform.parent = null;

You can read about this in http://unity3d.com/support/documentation/ScriptReference/Transform-parent.html