How to get node information in block?

I am coding a system for my bachelor theses. And I had & solved a small problem. The problem. I have to types of content types - Record and Group of Records. If I navigate to Group of Records there should be a block with a link saying "Create a record". The problem is that I need to pass some additional argument to the form Record (the node ID of Group of Records). So, my link looks like that: node/add/record?groupid=1001. The question: how to get the node ID of Group of Records? The solution: small if() :)
if ( arg(0) == 'node' && is_numeric(arg(1)) ) { $node = node_load(arg(1)); // Your code here... }