var includesScript = document.getElementById('required');
if (includesScript) {
    var js = '';

    var root = includesScript.src.replace(/required\.js(\?.*)?$/, '');

    // Prototype js framework
    js += '<script type="text/javascript" src="' + root + 'prototype/prototype.js"></script>';

    // useful extensions to Prototype (DO WE USE ALL OF THESE? -- AB)
    js += '<script type="text/javascript" src="' + root + 'prototype/protoload.js"></script>';
    js += '<script type="text/javascript" src="' + root + 'prototype/messages.js"></script>';
    js += '<script type="text/javascript" src="' + root + 'adm/prototype_extended.js"></script>';

    // Scriptaculous js effects library
    js += '<script type="text/javascript" src="' + root + 'scriptaculous/scriptaculous.js?load=effects,builder"></script>';

    // Lightbox2 image gallery module
    js += '<script type="text/javascript" src="' + root + 'lightbox/lightbox.js" media="screen"></script>';

    // Cufon font rendering library
    js += '<script type="text/javascript" src="' + root + 'cufon/cufon-yui.js"></script>';
    js += '<script type="text/javascript" src="' + root + 'cufon/Calibri_400-Calibri_700.font.js"></script>';

    // png transparency fixes for IE browsers (7 and below)
    js += '<script type="text/javascript" src="' + root + 'pngfix/pngFix.js"></script>';
    js += '<!--[if lt IE 7.]>';
    js += '<script defer type="text/javascript" src="' + root + 'pngfix/unitpngfix.js"></script>';
    js += '<![endif]-->';

    // Google Analytics tracking code
    js += '<script type="text/javascript" src="' + root + 'googleanalytics/ga.js"></script>';

    document.writeln(js);
}
