function embed_kaltura($entryId, $width, $height, $type, $design, $show_links = false)
{
    global $CFG;
    $client = KalturaHelpers::getKalturaClient();
    $playerId = KalturaHelpers::getPlayer($type, $design);
    $partnerId = KalturaHelpers::getPlatformKey("partner_id", "0");
    $swfUrl = KalturaHelpers::getSwfUrlForWidget($partnerId);
    $swfUrl .= "/uiconf_id/{$playerId}/entry_id/" . $entryId;
    $flashVarsStr = KalturaHelpers::flashVarsToString(KalturaHelpers::getKalturaPlayerFlashVars($client->getKS(), -1, $entryId));
    $div_id = "kaltura_wrapper_" . $entryId;
    $kaltura_poweredby = '<div style="width:' . $width . 'px;padding-top:6px;font-size:9px;text-align:right"><a href="http://corp.kaltura.com/technology/video_player" target="_blank">Video Player</a> by <a href="http://corp.kaltura.com" target="_blank">Kaltura</a></div>';
    if ($show_links == false) {
        $kaltura_poweredby = '';
    }
    $align = '';
    $custom_style = '';
    $links = '<a href=" http://corp.kaltura.com/solutions/education">education video</a><a href="http://corp.kaltura.com/userzone/tutorials">video tutorials</a><a href="http://corp.kaltura.com/technology/video_player">flv player</a>';
    $html = '
      <div id="' . $div_id . '" class="kaltura_wrapper" style="' . $align . $custom_style . '"' . $embed_options['js_events'] . '>' . $links . '</div>' . $kaltura_poweredby;
    $html .= '<script type="text/javascript">';
    $html .= 'function gotoEditorWindow(param1)';
    $html .= '{';
    $html .= '     onPlayerEditClick(param1);';
    $html .= '}';
    $html .= 'function onPlayerEditClick(param1)';
    $html .= '{';
    $html .= '      kalturaInitModalBox(\'' . $CFG->wwwroot . '/mod/kaltura/keditor.php?entry_id=' . '\'+param1 , {width:890, height:546});';
    $html .= '}';
    $html .= '        var kaltura_swf = new SWFObject("' . $swfUrl . '", "' . $player_id . '", "' . $width . '", "' . $height . '", "9", "#ffffff");';
    $html .= '        kaltura_swf.addParam("wmode", "opaque");';
    $html .= '        kaltura_swf.addParam("allowScriptAccess", "always");';
    $html .= '        kaltura_swf.addParam("allowFullScreen", "TRUE");';
    $html .= '        kaltura_swf.addParam("allowNetworking", "all");';
    $html .= '        if(kaltura_swf.installedVer.major >= 9) {';
    $html .= '          kaltura_swf.write("' . $div_id . '");';
    $html .= '        } else {';
    $html .= '          document.getElementById("' . $div_id . '").innerHTML = "Flash player version 9 and above is required. <a href=\'http://get.adobe.com/flashplayer/\'>Upgrade your flash version</a>";';
    $html .= '        }</script>';
    return $html;
}