$ScrollDirection = trim($params->get('ScrollDirection', 'up'));
$ScrollAmount = intval($params->get('ScrollAmount', ''));
$ScrollDelay = intval($params->get('ScrollDelay', ''));
$ImageLinkType = $params->get('ImageLinkType', '');
$DoPause = $params->get('DoPause', '');
$ScrollWidth = intval($params->get('ScrollWidth', ''));
$ScrollWidthUnit = $params->get('ScrollWidthUnit', '');
$ScrollHeight = intval($params->get('ScrollHeight', ''));
$ScrollHeightUnit = $params->get('ScrollHeightUnit', '');
$ImageCount = intval($params->get('ImageNumber', ''));
$ImageOrder = $params->get('ImageSource', '');
$ActivateUserCss = $params->get('ActivateUserCss', '');
$UserCss = $params->get('UserCss', '');
$IncludeChildren = $params->get('includechildren', '0');
//--- Image links preparation -------------------------------------------
$Rsg2DbSelections = new Rsg2DbSelections();
//--- Db image selections preparation -------------------------------------------
$Rsg2ImageRoutes = new Rsg2ImageRoutes();
//--- Take View Access into account -------------------------------------------
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
$groupsIN = implode(", ", array_unique($groups));
$superAdmin = $user->authorise('core.admin');
//--- Select specific galleries and possibly subs -----------------------------
// Selection requested ?
if ($GalleryIds) {
    $galleryArray = explode(',', $GalleryIds);
    // Include children?
    if ($includeChildren) {
        // All galleries
        $allGalleries = $Rsg2DbSelections->ListOfAllGalleriesOrdered();
    if ($divWidth > 0) {
        $divAttributes .= 'width:' . $divWidth . 'px;';
    }
    $divAttributes .= '"';
}
$divNameAttributes = "";
if ($divNameHeight) {
    $divNameAttributes .= 'style=overflow:hidden;';
    if ($divNameHeight > 0) {
        $divNameAttributes .= 'height:' . $divNameHeight . 'px;';
    }
    //if ($divNameWidth > 0)  $divNameAttributes .= 'width:'.$divNameWidth.'px;';// The width setting of the class mod_rsgallery2_latest_galleries_attibute would overrule this, so makes no sense to do this now?
    $divAttributes .= '"';
}
//--- Db image selections preparation -------------------------------------------
$Rsg2DbSelections = new Rsg2DbSelections();
//--- Image links preparation -------------------------------------------
//$Rsg2ImageRoutes = new Rsg2ImageRoutes ();
//--- Take View Access into account -------------------------------------------
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
$groupsIN = implode(", ", array_unique($groups));
$superAdmin = $user->authorise('core.admin');
//--- Select specific galleries and possibly subs -----------------------------
// Selection requested ?
if ($galleryIds) {
    $galleryArray = explode(',', $galleryIds);
    // Include children?
    if ($includeChildren) {
        // All galleries
        $allGalleries = $Rsg2DbSelections->ListOfAllGalleriesOrdered();
    if ($divWidth > 0) {
        $divAttributes .= 'width:' . $divWidth . 'px;';
    }
    $divAttributes .= '"';
}
$divNameAttributes = "";
if ($divNameHeight) {
    $divNameAttributes .= 'style=overflow:hidden;';
    if ($divNameHeight > 0) {
        $divNameAttributes .= 'height:' . $divNameHeight . 'px;';
    }
    //if ($divNameWidth > 0)  $divNameAttributes .= 'width:'.$divNameWidth.'px;';// The width setting of the class mod_rsgallery2_random_galleries_attibute would overrule this, so makes no sense to do this now?
    $divAttributes .= '"';
}
//--- Db image selections preparation -------------------------------------------
$Rsg2DbSelections = new Rsg2DbSelections();
//--- Image links preparation -------------------------------------------
$Rsg2ImageRoutes = new Rsg2ImageRoutes();
//--- Take View Access into account -------------------------------------------
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
$groupsIN = implode(", ", array_unique($groups));
$superAdmin = $user->authorise('core.admin');
//--- Select specific galleries and possibly subs -----------------------------
// Selection requested ?
if ($galleryIds) {
    $galleryArray = explode(',', $galleryIds);
    // Include children?
    if ($includeChildren) {
        // All galleries
        $allGalleries = $Rsg2DbSelections->ListOfAllGalleriesOrdered();