Your script needs to be attached to your player object. Then you should make an empty GameObject and attach a collider it. In the Inspector view of the GameObject you can toggle the property isTrigger from your collider on and off. I advice you to set it to on, then your player won't collide with the object but be able to walk "through" it. If you do so you have to use OnTriggerEnter() instead of OnCollisionEnter(). In the manual it says:
function OnTriggerEnter (other : Collider) : void Description
OnTriggerEnter is called when the
Collider other enters the trigger.
This message is sent to the trigger
collider and the rigidbody (or the
collider if there is no rigidbody)
that touches the trigger. Note that
trigger events are only sent if one of
the colliders also has a rigidbody
attached.
As the Collider parameter offers the variable other.gameObject too you should be able to reuse your code without further changes.