}
    $l .= '</div>';
    return $l;
}
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'PRODUCTLINKING') {
        $result = '';
        switch ($_POST['act']) {
            case 'LOAD':
                if (isset($_POST['plid']) && $_POST['plid'] != '') {
                    $pl = $class_pl->retrieveDetail($_POST['plid']);
                    $result .= drawPLthumb($pl['products_linking_id'], $pl['links_id'], true, true);
                } else {
                    $pl_load = $class_pl->retrieveList($products_id);
                    $pl_load_auto = $class_pl->getProductsCrossSelling($products_id);
                    $links = array();
                    foreach ($pl_load as $row) {
                        if (!isset($links[$row['type']])) {
                            $links[$row['type']] = array();
                        }
                        $links[$row['type']][] = drawPLthumb($row['products_linking_id'], $row['links_id'], false, true);
                    }
                    $nolink = '<div class="red">No links for this type</div>';
                    $addfield = '<div id="pat-%1$s" class="addbox" style="margin-bottom:10px;">';
                    $addfield .= 'Product ID/Code <input type="text" name="pladd" /> ';
                    $addfield .= '<input type="button" name="pladdbtn" value="Add" /> or ';
                    $addfield .= '<span><a href="?open=product-detail-links-style&amp;products_id=' . $products_id . '&amp;type=%2$s&amp;hidemenu=true" class="view_webpage" title="Add new product based on style"></a>';
                    $addfield .= '<input type="button" name="pladd2btn" value="Add from Style" />';
                    $addfield .= '</span>';
                    $addfield .= '</div>';