Maybe simply to use a flag to control the function
execution like :

Code:

var status = on;

function someFunction()
{
if (status == on)
{
// function contents
//....
}
}