Note:  This article discusses techniques relevant for Sage CRM v7.1sp2 and earlier.  If you are using Sage CRM 7.2 please refer to the articles that discuss the new Client Side API.
I have only just written about Mode and how to tell whether you are in the Edit or View state of a screen in the article "Detect Screen Mode (Client Side) for Company and Person Summary Screens".  But since the I have done some checking and really the best way of detecting mode in Client Side code is to look for a mandatory field in the screen. So this would be a way of checking mode:

var e=document.getElementById("comp_name");
if(e)
{
alert("Edit")
}
else
{
alert("View");
}

You'll need to check out the previous post about mode and the other posts about client side coding to make complete sense of this.