function getUnifiedResultsHTML($show_sidebar = true)
    {
        global $wgUser, $wgStylePath, $wgRequest, $wgContLang;
        global $mvDefaultClipRange;
        $sk = $wgUser->getSkin();
        $o = '';
        $o .= '<h5 class="search_results_header">' . wfMsg('mv_results_for', $this->getFilterDesc()) . '</h5>';
        $o .= '<div id="resultsArea">
						<ul id="metaResults">';
        if (count($this->results) == 0) {
            $o .= '<h2><span class="mw-headline">' . wfMsg('mv_search_no_results') . '</span></h2>';
            // close
            $o .= '</ul></div>';
            return $o;
        }
        // num of results
        if ($this->numResultsFound) {
            $re = $this->limit + $this->offset > $this->numResultsFound ? $this->numResultsFound : $this->limit + $this->offset;
            $rs = $this->offset == 0 ? 1 : $this->offset;
            $o .= '<li class="results">' . wfMsg('mv_results_found', $rs, $re, number_format($this->numResultsFound)) . '</li>';
        }
        // check order
        $prevnext = '';
        // pagging
        if ($this->numResultsFound > $this->limit) {
            $prevnext = mvViewPrevNext($this->offset, $this->limit, SpecialPage::getTitleFor('MediaSearch'), $this->get_httpd_filters_query(), $this->num < $this->limit);
            $o .= '<li class="prevnext">' . $prevnext . '</li>';
        }
        $br = '<br />';
        $enddash = '';
        $sTitle = Title::MakeTitle(NS_SPECIAL, 'MvExportSearch');
        // force host for script (should be a better way to do this)
        if (!isset($_SERVER['HTTP_HOST'])) {
            $_SERVER['HTTP_HOST'] = 'metavid.org';
        }
        // make miro link:
        $o .= '<li class="subscribe"><a href="http://subscribe.getMiro.com/?url1=' . 'http%3A%2F%2F' . $_SERVER['HTTP_HOST'] . urlencode($sTitle->getFullUrl($this->get_httpd_filters_query())) . '" ' . 'title="Subscribe with Miro"><img src="' . $wgStylePath . '/mvpcf/images/button_subscribe.png" alt="Miro Video Player" border="0" /></a></li>';
        // make rss link:
        $o .= '<li class="rss">';
        $o .= $sk->makeKnownLinkObj($sTitle, 'RSS', $this->get_httpd_filters_query());
        $o .= '</li>';
        $o .= '<br />';
        foreach (array('relevant', 'recent', 'viewed') as $type) {
            if ($this->order == $type) {
                $o .= $enddash . '<li class="relevant">' . wfMsg('mv_most_' . $type) . '</li>';
            } else {
                $q_req = $this->get_httpd_filters_query();
                if ($wgRequest->getVal('limit') != '' || $wgRequest->getVal('order') != '') {
                    $q_req .= '&' . http_build_query(array('limit' => $this->limit, 'offset' => $this->offset));
                }
                $q_req .= '&order=' . $type;
                $o .= $enddash . '<li class="relevant">' . $sk->makeKnownLinkObj(SpecialPage::getTitleFor('MediaSearch'), wfMsg('mv_most_' . $type), $q_req) . '</li>';
            }
            $br = '';
            $enddash = ' - ';
        }
        $o .= '</ul>';
        // output results:
        // collect categories and people for sidebarbucket
        $sideBarLinkBucket = array('person' => array(), 'category' => array(), 'bill' => array());
        $o .= '	<ul id="results">';
        //setup the MV_index:
        $mvIndex = new MV_Index();
        foreach ($this->results as $inx => &$mvd) {
            $mvTitle = new MV_Title($mvd->wiki_title);
            //get parent meta if requested:
            global $mvGetParentMeta;
            $pmeta_out = '';
            if ($mvGetParentMeta && strtolower($mvTitle->getMvdTypeKey()) == 'ht_en') {
                $pmvd = $mvIndex->getParentAnnotativeLayers($mvTitle);
                if ($pmvd->wiki_title) {
                    $pMvTitle = new MV_Title($pmvd->wiki_title);
                    $pAnnoStreamLink = Title::MakeTitle(MV_NS_STREAM, $pMvTitle->getNearStreamName(0));
                    $clip_desc_txt = 'Segment';
                    if ($pmvd->Speech_by) {
                        $personTitle = Title::newFromText($pmvd->Speech_by);
                        $clip_desc_txt = 'Speech By ' . $personTitle->getText();
                    }
                    $pmeta_out .= 'This ' . $sk->makeKnownLinkObj($pAnnoStreamLink, seconds2Description($mvTitle->getSegmentDuration(), true, true)) . ' clip is part of a larger ' . $sk->makeKnownLinkObj($pAnnoStreamLink, seconds2Description($pMvTitle->getSegmentDuration(), true, true)) . ' Speech';
                    if ($pmvd->category) {
                        $pmeta_out .= '<br />Covering: ';
                        $coma = '';
                        foreach ($pmvd->category as $cat_titlekey) {
                            $cTitle = $cTitle = Title::MakeTitle(NS_CATEGORY, $cat_titlekey);
                            $pmeta_out .= $coma . $sk->makeKnownLinkObj($cTitle, $cTitle->getText());
                            $coma = ', ';
                            assoc_array_increment($sideBarLinkBucket, 'category', $cat_titlekey);
                        }
                    }
                    if ($pmvd->Bill) {
                        $pmeta_out .= '<br />Bill: ';
                        $bTitle = Title::newFromText($pmvd->Bill);
                        $pmeta_out .= $sk->makeKnownLinkObj($bTitle, $bTitle->getText());
                        assoc_array_increment($sideBarLinkBucket, 'bill', $pmvd->Bill);
                    }
                }
            }
            $mvd_cnt_links = '';
            if (isset($mvd->spoken_by)) {
                $ptitle = Title::MakeTitle(NS_MAIN, $mvd->spoken_by);
                $mvd_cnt_links .= wfMsg('mv_search_spoken_by') . ': ' . $sk->makeKnownLinkObj($ptitle);
                $mvd_cnt_links .= '<br />';
                assoc_array_increment($sideBarLinkBucket, 'person', $mvd->spoken_by);
            }
            $mvd_cat_links = $mvd_bill_links = '';
            $coma = '';
            if (isset($mvd->categories)) {
                foreach ($mvd->categories as $cat_id => $na) {
                    $cTitle = Title::MakeTitle(NS_CATEGORY, $cat_id);
                    if ($mvd_cat_links == '') {
                        $mvd_cat_links .= wfMsg('mv_search_categories') . ': ';
                    }
                    $mvd_cat_links .= $coma . $sk->makeKnownLinkObj($cTitle, $cTitle->getText());
                    $coma = ', ';
                    assoc_array_increment($sideBarLinkBucket, 'category', $cat_id);
                }
            }
            $coma = '';
            if (isset($mvd->bills)) {
                foreach ($mvd->bills as $bill_id => $na) {
                    $bTitle = Title::newFromText($bill_id);
                    if ($mvd_bill_links == '') {
                        $mvd_bill_links .= wfMsg('mv_search_bills') . ': ';
                    }
                    $mvd_bill_links .= $coma . $sk->makeKnownLinkObj($bTitle, $bTitle->getText());
                    $coma = ', ';
                    assoc_array_increment($sideBarLinkBucket, 'bill', $bill_id);
                }
            }
            // link directly to the current range:
            //if the clip length is < $mvDefaultClipLength get range:
            global $mvDefaultClipLength;
            if ($mvTitle->getSegmentDuration() < $mvDefaultClipLength) {
                $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName($mvDefaultClipRange));
            } else {
                $mvStreamTitle = Title::MakeTitle(MV_NS_STREAM, $mvTitle->getNearStreamName(0));
            }
            // $mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() );
            $o .= '<li class="result">
					<span class="vid_img" id="mvimg_' . htmlspecialchars($mvd->id) . '">
						' . $sk->makeKnownLinkObj($mvStreamTitle, '<img alt="image for ' . htmlspecialchars($mvTitle->getStreamNameText()) . ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL('small', $req_time = null, $foce_server = '', $direct_link = false) . '"/>') . '
					</span>
					<div class="result_description">
						<h4>' . $sk->makeKnownLinkObj($mvStreamTitle, $mvTitle->getStreamNameText() . ' :: ' . $mvTitle->getTimeDesc()) . '</h4>
						<p>Matching Phrase:' . $this->termHighlight($mvd->text, implode('|', $this->getTerms()), 1, 100) . ' </p>
						<span class="by">' . $mvd_cnt_links . '</span>
						<span class="by">' . $mvd_cat_links . '</span>
						<span class="by">' . $mvd_bill_links . '</span>
					</div>
					<div class="result_meta">
						<span class="views">Views: ' . htmlspecialchars($mvd->view_count) . '</span>
						<span class="duration">' . wfMsg('mv_duration_label') . ':' . htmlspecialchars($mvTitle->getSegmentDurationNTP($short_time = true)) . '</span>
						<span class="playinline"><a href="javascript:mv_pl(\'' . htmlspecialchars($mvd->id) . '\')">' . wfMsg('mv_play_inline') . '</a></span>
										</div>';
            if ($pmeta_out != '') {
                $o .= '<div class="parent_meta">' . $pmeta_out . '</div>';
            }
            $o .= '</li>';
        }
        $o .= '</ul>';
        // add in prev-next at bottom too:
        if ($this->numResultsFound > $this->limit) {
            $o .= '<li class="prevnext">' . $prevnext . '</li>';
        }
        $o .= '</div>';
        if (!$show_sidebar) {
            return $o;
        }
        /*search sidebar*/
        $perSectionCount = 3;
        $o .= '<div id="searchSideBar">
					<div id="searchSideBarTop">
					</div>
						<div class="suggestionsBox" id="searchSideBarInner">';
        // look for people matches max of 3
        $first_block = ' first_block';
        $matches = 0;
        $person_out_ary = array();
        $person_out = MV_SpecialMediaSearch::auto_complete_person($this->unified_term_search, 3, 'person_html', $matches, $person_out_ary);
        if ($person_out != '' || count($sideBarLinkBucket['person']) != 0) {
            // for now don't include({$matches})
            $o .= "<div class=\"block{$first_block}\">\n\t\t\t\t\t\t\t\t<h6>" . wfMsg('mv_people_results') . "</h6>\n\t\t\t\t\t\t\t</div>";
            $o .= '<div class="block wide_block">';
            $o .= $person_out;
            if (isset($sideBarLinkBucket['person'])) {
                $pAry =& $sideBarLinkBucket['person'];
                arsort($pAry);
                $i = 0;
                foreach ($pAry as $person_name => $count) {
                    if (in_array($person_name, $person_out_ary)) {
                        continue;
                    }
                    if ($i == $perSectionCount) {
                        break;
                    }
                    $o .= MV_SpecialMediaSearch::format_ac_line($person_name, '', '', MV_SpecialMediaSearch::getPersonImageURL($person_name), $format = 'person_html');
                    $i++;
                }
            }
            $o .= '</div>';
            $first_block = '';
        }
        // get categories
        $category_out = MV_SpecialMediaSearch::auto_complete_search_categories($this->unified_term_search, 3, 'block_html', $matches);
        if ($category_out != '' || count($sideBarLinkBucket['category']) != 0) {
            $o .= '<div class="block' . htmlspecialchars($first_block) . '\\">
								<h6>' . wfMsg('mv_category_results') . '</h6>
							</div>';
            $o .= '<div class="block wide_block">' . $category_out;
            if (isset($sideBarLinkBucket['category'])) {
                $cAry =& $sideBarLinkBucket['category'];
                arsort($cAry);
                $i = 0;
                $catNStxt = $wgContLang->getNsText(NS_CATEGORY);
                foreach ($cAry as $cat_name => $count) {
                    if ($i == $perSectionCount) {
                        break;
                    }
                    $o .= MV_SpecialMediaSearch::format_ac_line($cat_name, '', $catNStxt . ':', 'no_image', $format = 'block_html');
                    $i++;
                }
            }
            $o .= '</div>';
            $first_block = '';
        }
        // get bills:
        $bill_out = MV_SpecialMediaSearch::auto_complete_category('Bill', $this->unified_term_search, 3, 'block_html', $matches);
        if ($bill_out != '' || count($sideBarLinkBucket['bill']) != 0) {
            global $wgContLang;
            $o .= '<div class=\\"block ' . htmlspecialchars($first_block) . '">
								<h6>' . wfMsg('mv_bill_results') . '</h6>
							</div>';
            $o .= '<div class="block wide_block">' . $bill_out;
            if ($sideBarLinkBucket['bill']) {
                $bAry =& $sideBarLinkBucket['bill'];
                arsort($bAry);
                $i = 0;
                foreach ($bAry as $bill_name => $count) {
                    if ($i == $perSectionCount) {
                        break;
                    }
                    $o .= MV_SpecialMediaSearch::format_ac_line($bill_name, '', '', 'no_image', $format = 'block_html');
                    $i++;
                }
            }
            $o .= '</div>';
            $first_block = '';
        }
        // intrest out is just simple title matching (for now)
        $intrest_out = MV_SpecialMediaSearch::auto_complete_category('Interest_Group', $this->unified_term_search, 3, 'block_html', $matches);
        if ($intrest_out != '') {
            $o .= "<div class=\"block{$first_block}\">\n\t\t\t\t\t\t\t\t<h6>" . wfMsg('mv_intrest_group_results') . "</h6>\n\t\t\t\t\t\t\t</div>";
            $o .= '<div class="block wide_block">' . $intrest_out . '</div>';
            $first_block = '';
        }
        $o .= '</div><!--searchSideBarInner-->
				</div>';
        $o .= '<div style="clear:both;"></div>';
        return $o;
    }