function build_player($width, $height, $media)
    {
        /*
         * Fix #2 
         * @see http://trac.saiweb.co.uk/saiweb/ticket/2
         */
        $list = explode('|', $media);
        $hash = md5($media . flowplayer::_salt());
        $html = '<div id="saiweb_' . $hash . '" style="width:' . $width . 'px; height:' . $height . 'px;" class="flowplayer"></div>';
        $html .= '<script language="Javascript" type="text/javascript">
	WPFP(document).ready(function() {
		//load player
		$f("saiweb_' . $hash . '", "' . (flowplayer::_getkey() ? flowplayer::commercial_url() : flowplayer::gpl_url()) . '", {
				plugins: {
  					 controls: {    					
      					' . (flowplayer::_getbuttonOverColor() != '' ? 'buttonOverColor: \'' . flowplayer::_getbuttonOverColor() . '\',' : '') . '
      					' . (flowplayer::_getsliderColor() != '' ? 'sliderColor: \'' . flowplayer::_getsliderColor() . '\',' : '') . '
      					' . (flowplayer::_getbufferColor() != '' ? 'bufferColor: \'' . flowplayer::_getbufferColor() . '\',' : '') . '
      					sliderGradient: \'none\',
      					progressGradient: \'medium\',
      					' . (flowplayer::_getdurationColor() != '' ? 'durationColor: \'' . flowplayer::_getdurationColor() . '\',' : '') . '
      					' . (flowplayer::_getprogressColor() != '' ? 'progressColor: \'' . flowplayer::_getprogressColor() . '\',' : '') . '
      					' . (flowplayer::_getbackgroundColor() != '' ? 'backgroundColor: \'' . flowplayer::_getbackgroundColor() . '\',' : '') . '
      					' . (flowplayer::_gettimeColor() != '' ? 'timeColor: \'' . flowplayer::_gettimeColor() . '\',' : '') . '
      					' . (flowplayer::_getbuttonColor() != '' ? 'buttonColor: \'' . flowplayer::_getbuttonColor() . '\',' : '') . '
      					backgroundGradient: \'none\',
      					bufferGradient: \'none\',
   						opacity:1.0' . (count($list) > 1 ? ',
						playlist: true' : '') . '
   						}
				},';
        if (count($list) > 1) {
            //splash image code, adapted from user contributed code from James P
            $iRegex = '/\\.(jpe?g|gif|png)$/';
            $splash = preg_match($iRegex, $list[0]) && !preg_match($iRegex, $list[1]);
            $html .= '
			clip: {
					autoPlay: ' . ($splash == true ? 'true' : (flowplayer::_getautoplay() == 'true' ? 'true' : 'false')) . ',
       				autoBuffering: ' . (flowplayer::_getautobuffer() == 'true' ? 'true' : 'false') . '
				},';
            $html .= 'playlist:[
				 
				';
            $i = 0;
            foreach ($list as $item) {
                if (!$splash) {
                    $html .= '{url: \'' . $item . '\'},' . "\n";
                } else {
                    if ($i == 0) {
                        //this is the splash image
                        $html .= '{url: \'' . $item . '\', autoPlay: true},' . "\n";
                    } else {
                        //next items are not the splash image
                        $html .= '{url: \'' . $item . '\', autoPlay: false},' . "\n";
                    }
                }
                $i++;
            }
            $html .= '],' . "\n";
        } else {
            $html .= '
			clip: {
					url:\'' . $media . '\',
					autoPlay: ' . (flowplayer::_getautoplay() == 'true' ? 'true' : 'false') . ',
       				autoBuffering: ' . (flowplayer::_getautobuffer() == 'true' ? 'true' : 'false') . '
				},';
        }
        $html .= flowplayer::_getkey() ? 'key:\'' . flowplayer::_getkey() . '\',' : '';
        if (strlen(flowplayer::_getlogo()) > 0) {
            $html .= '
		logo: {  
        url: \'' . flowplayer::_getlogo() . '\',  
        displayTime: 0,
        fullscreenOnly: false,
        linkUrl: \'' . flowplayer::_getlogolink() . '\' 
    },';
        }
        $html .= '
				canvas: {
					backgroundColor:\'' . flowplayer::_getcanvas() . '\'
				}})
			});</script>
				';
        return $html;
    }