If you are trying to execute some Javascript code in a SharePoint 2007 page or in a custom Web Part, you need to attach your JavaScript function to _spBodyOnLoadFunctionNames.push(). Here is an example on how to do it correctly:
<script type="text/javascript">
function startFunction()
{
// insert your javascript code
}
_spBodyOnLoadFunctionNames.push("startFunction");
</script>
The bad deal is that you are unable to add paramethers to your start function...