Get nid in views custom PHP argument i want to limit node reference (autocomplete widget) based on one of CCK field on current node. So, i made view to limit results and in argument->Provide default argument->PHP Code.
And write code like this:

$mynode = node_load(arg(1));
return $mynode-&gt;field_foo[0]['nid'];


But problem is in that arg(1) is not returning NID of current page but string 'autocomplete' (i guess it is name of function).
(Didn't had luck with menu_get_object() either)

So how can i get NID of current node other than using ARG() in views custom PHP argument?

Can i reference directly on CCK field (yes, as I sad it is on samo page as autocomplete text-field)?

Thanks for help.

UPDATE: 
This is specific to autocomplete widget. 

It works well with other widget types (select list, checkbox...)
If you want to have the current NID of the viewed page in your view, you should use the following:

In your view:
At the Arguments section you select "Node:nid", in the configuration of this argument at "Action to take if argument is not present:" you can choose "Provide default argument" after that you choose "Node ID from URL".

And there you have your NID in your view.