function prekModule(station,airtime,version){
    var dimension = {     largevert:{width:240,height:448},
                           largehor:{width:475,height:254},
                           largegod:{width:240,height:265},
                       largefactory:{width:240,height:265},
                              small:{width:145,height:370}
                    };
    var width = dimension[version].width;
    var height = dimension[version].height;
    var script_name = 'prekmod_season2.js';
    var script = getModuleScript(script_name);
    var o = getObject(station,airtime,version,width,height);
    script.parentNode.insertBefore(o, script);
    script.parentNode.removeChild(script);
}
 
function getModuleScript(script_name){
    var scripts = document.body.getElementsByTagName('script');
        for (i = 0; i < scripts.length; i++) {
                if (scripts[i].src.indexOf(script_name) != -1) {
                        script = scripts[i];
                        break;
                }
        }
    return script;
}
 
function getObject(station,airtime,version,width,height){
    var flashvars = 'stationCallLetters=' + station + '&stationTuneInTime=' + airtime;
    var swf_url = 'http://pbskids.org/modules/prekblock/swfs/shells/pbskidsprekblock-' + version + '.swf';
   
    var s = document.createElement('span');
    var o = "<object type='application/x-shockwave-flash' " +
            " data='" + swf_url + "' " +
            "width='" + width + "' " +
            "height='" + height + "' >" +
	    "<param name=allowScriptAccess value=always>" +
            "<param name='flashvars' value='" + flashvars + "' />" +
            "<param name='movie' value='" + swf_url + "' />"; 
    
 
    s.innerHTML = o;
    return s;
}
