//USAGE [lightbox=image_url|image_title|image_group|image_float]link[/lightbox]
global $pref, $tp;

$parm_array = array();
$parm_array = explode("|",$parm);

$tit = ' title="'.$tp -> toAttribute(varset($parm_array[1], '')).'"';
$parm_array[2] = varset($parm_array[2], '');
$parm_array[3] = varsettrue($parm_array[3], '');
$lmargin = explode(',', $pref['lightb_margin']);
$tmar = varset($lmargin[0], '0');
$rmar = varset($lmargin[1], '0');
$bmar = varset($lmargin[2], '0');
$lmar = varset($lmargin[3], '0');

	if ($parm_array[2] == '') {
		$rel = ' rel="lightbox"';
	} else {
		$rel = ' rel="lightbox__'.htmlspecialchars($parm_array[2], ENT_QUOTES, CHARSET).'"';
	}

	if (strtolower($parm_array[3]) == 'left' || strtolower($parm_array[3]) == 'right') {
		$imagelink = '<div style="float: '.strtolower($parm_array[3]).'; margin: '.($tmar ? intval($tmar) : '0').'px '.($rmar ? intval($rmar) : '0').'px '.($bmar ? intval($bmar) : '0').'px '.($lmar ? intval($lmar) : '0').'px;"><a href="'.$tp -> toAttribute($parm_array[0]).'"'.$rel.$tit.'>'.$code_text.'</a></div>';
	} else {
		$imagelink = '<a href="'.$tp -> toAttribute($parm_array[0]).'"'.$rel.$tit.'>'.$code_text.'</a>';
	}


return $imagelink;