Hi,
if you code custom plugins, tempaltes etc you should really learn how to solve such problems, simple search on the functions or look into some code template will reveal that this is not needed anymore and you cann access this functions directly from $cck object in template
e.g.
$cck = CCK_Rendering::getInstance( $this->template ); (this line is already in core templates)
$cck->addScriptDeclaration( $js );