function showBlockRSS($sCaption, $sContent, $bNoDB = false)
 {
     global $p_arr, $site;
     list($sUrl, $iNum) = explode('#', $sContent);
     $iNum = (int) $iNum;
     $sUrl = str_replace(array('{SiteUrl}', '{NickName}'), array($site['url'], $p_arr['NickName']), $sUrl);
     $ret = genRSSHtmlOut($sUrl, $iNum);
     if ($bNoDB) {
         return $ret;
     } else {
         echo DesignBoxContent(_t($sCaption), $ret, 1);
     }
 }
function PageCompRSS($sContent)
{
    global $p_arr, $site;
    list($sUrl, $iNum) = explode('#', $sContent);
    $iNum = (int) $iNum;
    $sUrl = str_replace(array('{SiteUrl}', '{NickName}'), array($site['url'], $p_arr['NickName']), $sUrl);
    return genRSSHtmlOut($sUrl, $iNum);
}
    /**
     * Generate presentation Advertisement code with images and other
     *
     * @param $id	ID of Advertisement
     * @return HTML presentation of data
     */
    function ActionPrintAdvertisement($id)
    {
        global $site;
        global $prof;
        global $logged;
        $iAdvertisementID = (int) $id;
        $sRetHtml = '';
        $aSqlResStr = $this->GetAdvertisementData($iAdvertisementID);
        if ($aSqlResStr) {
            $sAdminLocalAreaC = _t('_AdminArea');
            $sBigImg = $this->getBigImageCode($aSqlResStr['Media']);
            $sImg = $this->getImageCode($aSqlResStr['Media']);
            $aNameRet = $this->GetProfileData($aSqlResStr['IDProfile']);
            $sCountryName = $aNameRet['Country'] == "" ? $sAdminLocalAreaC : _t('__' . $prof['countries'][$aNameRet['Country']]);
            $sCountryPic = $aNameRet['Country'] == '' ? '' : ' <img alt="' . $aNameRet['Country'] . '" src="' . ($site['flags'] . strtolower($aNameRet['Country'])) . '.gif"/>';
            if ($logged['member']) {
                $sVisible = 'memb';
            } else {
                $sVisible = 'non';
            }
            $sSqlCols = "\r\n\t\t\t\tSELECT * \r\n\t\t\t\tFROM `ClsAdvCompose` \r\n\t\t\t\tWHERE\r\n\t\t\t\t\t`Column` != 0 AND\r\n\t\t\t\t\tFIND_IN_SET( '{$sVisible}', `Visible` )\r\n\t\t\t\tORDER BY `Column` , `Order`\r\n\t\t\t";
            $sqlCaptRes = db_res($sSqlCols);
            $aCaptions = array();
            while ($aCapSelect = mysql_fetch_assoc($sqlCaptRes)) {
                $aCaptions[$aCapSelect['Func']] = _t($aCapSelect['Caption']);
            }
            $sPostedByC = _t('_Posted by');
            $sAdminC = _t('_Admin');
            $sPhoneC = _t('_Phone');
            $sICQC = _t('_ICQ');
            $sDetailsC = _t('_Details');
            $sReplyC = _t('_Reply');
            $sSubjectC = _t('_Subject');
            $sDateC = _t('_Date');
            $sLocationC = _t('_Location');
            $sDescriptionC = $aCaptions['Description'];
            //_t('_Description');
            $sUserOtherListC = $aCaptions['Users Other Listing'];
            //_t('_Users other listing');
            $sActionsC = $aCaptions['Actions'];
            //_t('_Actions');
            $sPhotosC = _t('_Photos');
            $sEditC = _t('_Edit');
            $sAdvertisementC = _t('_Advertisement');
            $sTagsC = _t('_Tags');
            $sBuyNowC = _t('_Buy Now');
            $sDeleteC = _t('_Delete');
            $sSureC = _t("_Are you sure");
            $sActivateC = _t('_Activate');
            $sPostedBy = '';
            if (!$aNameRet['NickName']) {
                $sPostedBy .= '<div class="cls_res_info">' . $sPostedByC . ': ' . $sAdminC . '</div>';
            } else {
                $sPostedBy .= '<div class="cls_res_info">';
                $sPostedBy .= $sPostedByC . ': <span style="color:#333333;"><a href="' . getProfileLink($aNameRet['ID']) . '">' . $aNameRet['NickName'] . '</a></span>';
                $sPostedBy .= '</div>';
                if ($aNameRet['Phone'] != "") {
                    $sPostedBy .= '<div class="cls_res_info">';
                    $sPostedBy .= $sPhoneC . ": <div class=\"clr3\">{$aNameRet['Phone']}</div>";
                    $sPostedBy .= '</div>';
                }
                if ($aNameRet['IcqUIN'] != "") {
                    $sPostedBy .= '<div class="cls_res_info">';
                    $sPostedBy .= $sICQC . "#<div class=\"clr3\">{$aNameRet['IcqUIN']}</div>";
                    $sPostedBy .= '</div>';
                }
            }
            $sTimeAgo = _format_when($aSqlResStr['sec']);
            $sCustDetails .= $aSqlResStr['CustomFieldName1'] || $aSqlResStr['CustomFieldName2'] ? "{$sDetailsC}: " : '';
            $sCustDetails .= $aSqlResStr['CustomFieldName1'] && $aSqlResStr['CustomFieldValue1'] ? "<div class=\"clr3\">{$aSqlResStr['Unit']} {$aSqlResStr['CustomFieldValue1']}</div>" : '';
            $sCustDetails .= $aSqlResStr['CustomFieldName1'] && $aSqlResStr['CustomFieldName2'] && $aSqlResStr['CustomFieldValue1'] && $aSqlResStr['CustomFieldValue2'] ? " - " : '';
            $sCustDetails .= $aSqlResStr['CustomFieldName2'] && $aSqlResStr['CustomFieldValue2'] ? "<div class=\"clr3\">{$aSqlResStr['Unit']} {$aSqlResStr['CustomFieldValue2']}</div>" : '';
            $sTags .= $sTagsC . ': <div class="clr3">';
            $aTags = array();
            $aTagsLinks = array();
            $aTags = explode(",", $aSqlResStr['Tags']);
            foreach ($aTags as $sTag) {
                $aTagsLinks[] = '<a href="' . "{$site['url']}classifieds_tags.php?tag={$sTag}" . '">' . $sTag . '</a>';
            }
            $sTags .= implode(", ", $aTagsLinks);
            $sTags .= '</div>';
            $sMemberActions = '';
            $iMemberID = $logged['member'] ? (int) $_COOKIE['memberID'] : -1;
            //$iMemberID = (int)$_COOKIE['memberID'];
            if ($iMemberID > 0 and $iMemberID != $aNameRet['ID']) {
                //print Send PM button and other actions
                $bBnp = getParam('enable_paid_system');
                $sBuyNow = '';
                if ($bBnp == 'on') {
                    $sBuyNow = <<<EOF
<img src="{$site['icons']}cool.gif" alt="Buy" title="Buy" class="marg_icon" />
<a class="actions" href="{$this->sCurrBrowsedFile}" onclick="document.forms['BuyNowForm'].submit(); return false;">
\t{$sBuyNowC}
</a>
<form action="{$this->sCurrBrowsedFile}" name="BuyNowForm" method="post">
\t<input type="hidden" name="BuyNow" value="BuyNow" />
\t<input type="hidden" name="IDAdv" value="{$id}" />
\t<input type="hidden" name="IDSeller" value="{$aSqlResStr['IDProfile']}" />
</form>
<br/>
EOF;
                }
                $sMemberActions .= <<<EOF
{$sBuyNow}
<img src="{$site['icons']}action_send.gif" alt="Post PM" title="Post PM" class="marg_icon" />
<a class="actions" href="{$this->sCurrBrowsedFile}" onclick="document.forms['post_pm'].submit(); return false;">
{$sReplyC}
</a>
<form action="{$site['url']}compose.php" name="post_pm" id="post_pm" method="post">
\t<input type="hidden" name="ID" value="{$aSqlResStr['IDProfile']}" />
\t<input type="hidden" name="subject" value="{$aSqlResStr['Subject']}" />
\t<input type="hidden" value="{$sReplyC}" />
</form>
EOF;
            } elseif ($iMemberID == $aNameRet['ID'] and $this->bAdminMode == FALSE) {
                $sMemberActions .= '<div class="cls_result_row">';
                $sMemberActions .= $this->CenteredActionsBlock('<img src="' . $site['icons'] . 'description_edit.png" alt="' . $sEditC . '" title="' . $sEditC . '" class="marg_icon" />', '<a class="actions" href="' . $this->sCurrBrowsedFile . '" onclick="UpdateField(\'EditAdvertisementID\',' . $iAdvertisementID . '); document.forms.command_edit_advertisement.submit(); return false;">' . $sEditC . '</a>');
                $sMemberActions .= '</div>';
                $sMemberActions .= '<div class="cls_result_row">';
                $sMemberActions .= $this->CenteredActionsBlock('<img src="' . $site['icons'] . 'action_block.gif" alt="' . $sDeleteC . '" title="' . $sDeleteC . '" class="marg_icon" />', '<a class="actions" href="' . $this->sCurrBrowsedFile . '" onclick="if (confirm(\'' . $sSureC . '\')) { UpdateField(\'DeleteAdvertisementID\',' . $iAdvertisementID . ');document.forms.command_delete_advertisement.submit(); } return false;">' . $sDeleteC . '</a>');
                $sMemberActions .= '</div>';
            }
            $sAdminPart = '';
            if ($this->bAdminMode) {
                $sAdminPart .= <<<EOF
<div class="clear_both"></div>
<div class="ar">
\t<span style="vertical-align: middle;margin-right:5px;">
\t<img src="{$site['icons']}online.gif" style="position:static;" />
\t</span>
\t<span>
\t<a class="actions" href="{$this->sCurrBrowsedFile}" onclick="UpdateField('ActivateAdvertisementID',{$iAdvertisementID});document.forms.command_activate_advertisement.submit(); return false;">
\t{$sActivateC}</a>
\t</span>
</div>
<div class="ar">
\t<span style="vertical-align: middle;margin-right:5px;">
\t<img src="{$site['icons']}delete.png" style="position:static;" />
\t</span>
\t<span>
\t<a class="actions" href="{$this->sCurrBrowsedFile}" onclick="if (confirm('{$sSureC}')) { UpdateField('DeleteAdvertisementID',{$iAdvertisementID});document.forms.command_delete_advertisement.submit(); } return false;">
\t{$sDeleteC}</a>
\t</span>
</div>
<div class="ar">
\t<span style="vertical-align: middle;margin-right:5px;">
\t<img src="{$site['icons']}_logout.jpg" style="position:static;" />
\t</span>
\t<span>
\t<a class="actions" href="{$this->sCurrBrowsedFile}" onclick="UpdateField('EditAdvertisementID',{$iAdvertisementID}); document.forms.command_edit_advertisement.submit(); return false;">
\t{$sEditC}</a>
\t</span>
</div>
<div class="clear_both"></div>
EOF;
            }
            $sPictureSectContent = <<<EOF
<script type="text/javascript">
\tif (window.attachEvent)
\t\twindow.attachEvent( "onload", onloadPhotos );
\telse
\t\twindow.addEventListener( "load", onloadPhotos, false);

\tfunction onloadPhotos()
\t{
\t\thideScroll();
\t}

\t//hide scrollers if needed
\tfunction hideScroll()
\t{
\t\tb = document.getElementById( "aIconBlock" );
\t\ts = document.getElementById( "aScrollCont" );
\t\t
\t\tif( !b || !s ) {
\t\t\taibc = document.getElementById( "aIconBlockCont" );
\t\t\taibc.style.display = "none";
\t\t\ts.style.display = "none";
\t\t\treturn false;
\t\t}

\t\tif( b.parentNode.clientWidth >= b.clientWidth )
\t\t\ts.style.display = "none";
\t\telse
\t\t\ts.style.display = "block";
\t}
</script>
<div class="photoBlock">
\t{$sBigImg}
</div>
<div class="iconBlockCont" id="aIconBlockCont">
\t{$sImg}
</div>
<div id="aScrollCont" class="scrollCont">
\t<div class="scrollLeft" onmouseover="moveScrollLeftAuto('aIconBlock', true);" onmouseout="moveScrollLeftAuto('aIconBlock', false);">
\t\t<img src="{$site['icons']}left_arrow.gif" style="position:static;" alt="" />
\t</div>
\t<div class="scrollRight" onmouseover="moveScrollRightAuto('aIconBlock', true);" onmouseout="moveScrollRightAuto('aIconBlock', false);">
\t\t<img src="{$site['icons']}right_arrow.gif" style="position:static;" alt="" />
\t</div>
</div>
<div class="clear_both"></div>
EOF;
            $sPictureSect = DesignBoxContent($aCaptions['Advertisement Photos'], $sPictureSectContent, 1);
            $sActionsSect = $iMemberID > 0 || $this->bAdminMode ? DesignBoxContent($sActionsC, $sMemberActions . $sAdminPart, 1) : '';
            if ($iMemberID > 0 || $this->bAdminMode) {
                $oComments = new BxDolComments(1, $this->sCurrBrowsedFile);
                $oComments->bAdminMode = $this->bAdminMode;
                $sCommSect = $oComments->PrintCommentSection($iAdvertisementID, $aCaptions['Comments']);
            }
            $sUserOtherListing = $this->PrintMyAds($aSqlResStr['IDProfile'], 2);
            $sSubjectSectContent = <<<EOF
{$sPostedBy}
<div class="cls_res_info">
\t{$sDateC}: <div class="clr3">{$aSqlResStr['DateTime']} ({$sTimeAgo})</div>
</div>
<div class="cls_res_info">
\t{$sLocationC}: <div class="clr3">{$sCountryName}{$sCountryPic}</div>
</div>
<div class="cls_res_info">
\t{$sTags}
</div>
<div class="cls_res_info">
\t{$sCustDetails}
</div>
EOF;
            $sSubjectSect = DesignBoxContent($aSqlResStr['Subject'], $sSubjectSectContent, 1);
            $sDescriptionSect = DesignBoxContent($sDescriptionC, $aSqlResStr['Message'], 1);
            $sOtherListingContent = <<<EOF
{$sUserOtherListing}
<a class="actions" href="{$this->sCurrBrowsedFile}" onclick="document.forms['UsersOtherListingForm'].submit(); return false;">{$sUserOtherListC}</a>
<form action="{$this->sCurrBrowsedFile}" name="UsersOtherListingForm" method="post">
\t<input type="hidden" name="UsersOtherListing" value="1" />
\t<input type="hidden" name="IDProfile" value="{$aSqlResStr['IDProfile']}" />
</form>
EOF;
            $sOtherListingSect = DesignBoxContent($sUserOtherListC, $sOtherListingContent, 1);
            $sBrowseAllAds = _t('_Browse All Ads');
            $sBreadCrumbs = <<<EOF
<div class="breadcrumbs">
<a href="{$site['url']}">{$site['title']}</a>
/
<a href="{$this->sCurrBrowsedFile}?Browse=1">{$sBrowseAllAds}</a>
/
<a href="{$this->sCurrBrowsedFile}?bClassifiedID={$aSqlResStr['CatID']}">{$aSqlResStr['Name']}</a>
/
<a href="{$this->sCurrBrowsedFile}?bSubClassifiedID={$aSqlResStr['SubID']}">{$aSqlResStr['NameSub']}</a>
</div>
EOF;
            $iScrollWidth = $this->iScrollWidth;
            $iScrollHeight = $this->iScrollWidth + 0;
            $sqlColRes = db_res($sSqlCols);
            $aBlocks = array();
            while ($aBlockSelect = mysql_fetch_assoc($sqlColRes)) {
                switch ($aBlockSelect['Func']) {
                    case 'Advertisement Photos':
                        $aBlocks[$aBlockSelect['Column']] .= $sPictureSect;
                        break;
                    case 'Actions':
                        $aBlocks[$aBlockSelect['Column']] .= $sActionsSect;
                        break;
                    case 'Comments':
                        $aBlocks[$aBlockSelect['Column']] .= $sCommSect;
                        break;
                    case 'Adv Info':
                        $aBlocks[$aBlockSelect['Column']] .= $sSubjectSect;
                        break;
                    case 'Description':
                        $aBlocks[$aBlockSelect['Column']] .= $sDescriptionSect;
                        break;
                    case 'Users Other Listing':
                        $aBlocks[$aBlockSelect['Column']] .= $sOtherListingSect;
                        break;
                    case 'Echo':
                        $aBlocks[$aBlockSelect['Column']] .= DesignBoxContent(_t($aBlockSelect['Caption']), $aBlockSelect['Content'], 1);
                        break;
                    case 'RSS':
                        list($sUrl, $iNum) = explode('#', $aBlockSelect['Content']);
                        $iNum = (int) $iNum;
                        $ret = genRSSHtmlOut($sUrl, $iNum);
                        $aBlocks[$aBlockSelect['Column']] .= DesignBoxContent(_t($aBlockSelect['Caption']), $ret, 1);
                        break;
                }
            }
            $sRetHtml = <<<EOF
{$sBreadCrumbs}
<div>
\t<div class="clear_both"></div>
\t<div class="cls_info_left">
\t\t{$aBlocks['1']}
\t</div>
\t<div class="cls_info">
\t\t{$aBlocks['2']}
\t</div>
\t<div class="clear_both"></div>
</div>
<div class="clear_both"></div>
EOF;
        }
        return $sRetHtml;
    }
function PageCompRSS($sContent)
{
    list($sUrl, $iNum) = explode('#', $sContent);
    $iNum = (int) $iNum;
    return genRSSHtmlOut($sUrl, $iNum);
}
function PageCompRSS($sCaption, $sContent)
{
    global $site;
    list($sUrl, $iNum) = explode('#', $sContent);
    $iNum = (int) $iNum;
    $sUrl = str_replace(array('{SiteUrl}'), array($site['url']), $sUrl);
    $ret = genRSSHtmlOut($sUrl, $iNum);
    return DesignBoxContent(_t($sCaption), $ret, 1);
}