/**
     * Outputs frontpage HTML
     *
     * @param string $option  the joomla component name
     * @param array  $rows  array of video data
     * @param array  $rowsfeatured  array of featured video data
     * @param object $pageNav  page navigation object
     * @param int    $total  the total video count
     * @return       Nothing
     */
	function fixVideoDataFormat($videoid=null) {
		$db = & JFactory::getDBO();

        if (isset($videoid)) {

			$query = 'SELECT id, title, description, tags'
					. ' FROM #__hwdvidsvideos'
					. ' WHERE id = '.$videoid
					;
			$db->SetQuery($query);
			$rows = $db->loadObjectList();

        } else {

			$query = 'SELECT *'
					. ' FROM #__hwdvidsvideos'
					;
			$db->SetQuery($query);
			$rows = $db->loadObjectList();

		}

		for ($i=0, $n=count($rows); $i < $n; $i++) {

			$row = $rows[$i];

			$title 				= hwd_vs_tools::generatePostTitle($row->title);
			$description 		= hwd_vs_tools::generatePostDescription($row->description);
			$tags 				= hwd_vs_tools::generatePostTags($row->tags);

			$thumb_snap = $row->thumb_snap;
			if ($row->thumb_snap == "0:00:00") {
				$sec = intval(hwd_vs_tools::hms2sec($row->video_length));
				if ($sec < 2) {
					$thumb_snap = "0:00:02";
				} else {
					$thumb_snap = hwd_vs_tools::sec2hms($sec/2);
				}
			}

			// update sql
			$db->SetQuery("UPDATE #__hwdvidsvideos SET title = \"$title\", description = \"$description\", tags = \"$tags\", thumb_snap = \"$thumb_snap\"  WHERE id = $row->id");
			$db->Query();
			if ( !$db->query() ) {
				echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
				exit();
			}
		}

		return true;
    }