Conditional drupal_add_css and _js are adding code to every page
If you are adding drupal_add_css or_js in phptemplate_preprocess_node,


First fetch all the added css in one variable and assign this for $styles value
Same like css you need to do for js also.


Here with see the sample code below

function phptemplate_preprocess_node(&amp;$vars, $hook) { $node = $vars['node']; 
if ($node-&gt;type == 'mytype') {
    drupal_add_css(path_to_theme() . "/css/mytpess.css");

    drupal_add_js(path_to_theme() . "/javascripts/jquery.masonry.min.js");
    drupal_add_js("$(document).ready(function(){
                      $('.node').masonry({
                        itemSelector: '.field-type-flexifield'
                      });
                    });",'inline'); 
 }
$css = drupal_add_css();
$scripts = drupal_add_js();
$vars['styles'] = drupal_get_css($css);
$vars['scripts'] = drupal_get_js('header', $scripts);
}