<?php

use Legacy\KatapyShare\SiteContext;
include_once '../katapyphp/katapysetup.php';include_once '../sitecontext.php'; SiteContext::setup("../../../"); $uP = SiteContext::getUrlPrefix();$dP = SiteContext::getDocPrefix();
include_once '../includes/nocache-header.php';
/*
if ($userHasAccess == false) {
    header('Location: ' . $uP . 'welcome');
    return;
}
*/

if (empty($_REQUEST["p1"]) == false && empty($_REQUEST["p2"]) == false) {
    $pieces = explode("-", $_REQUEST["p1"]);
    $lib = $pieces[0];
    $pieces = explode("-", $_REQUEST["p2"]);
    $seriesId = $pieces[0];
    $seriesEnc = null;
    //if (is_numeric($seriesId)) {
        //use gallery cache in Redis
    //    $seriesEnc = RedisSession::getObjectCacheValue("galleries", $seriesId);
    //}
    //if (empty($seriesEnc)) {
        if (is_numeric($seriesId)) {
            $series = KatapyVod::getGallery($seriesId, $lib);
        } else { //mobile apps use the code instead of id
            $series = KatapyVod::getGalleryByCd($seriesId, $lib);
        }
    //    RedisSession::setObjectCacheValue("galleries", $series->id, json_encode($series));
    //} else {
    //    $series = json_decode($seriesEnc);
    //}
    //echo json_encode($series); die();
    $location = KatapyCms::getGalleryLocation($series->id, $series->mediactrCd);
    $seasonId = null;
    // echo json_encode($location);
    if (empty($_REQUEST["p3"]) == false) {
        $pieces = explode("-", $_REQUEST["p3"]);
        $seasonId = $pieces[0];
        if ($series->typeCd == "FOLDE") {
            $series = KatapyVod::getGallery($seasonId, $lib);
        }
    } else if ($series->typeCd == "FOLDE") {
        header("Location: " . $uP . "home");
        die();
    }
    if (empty($_REQUEST["p4"]) == false) {
        $pieces = explode("-", $_REQUEST["p4"]);
        $contentId = $pieces[0];
        $content = KatapyVod::getContent($contentId, $lib);
    }
    if ($series==null) {
        //header("Location: " . $uP . "error404");
        header("Location: " . $uP . "home");
        die();
    }
} else {
    header("Location: " . $uP . "home");
    die();
}
// echo json_encode($location);
if ($content->nm == $series->nm) $content = null; //this is to prevent displaying the content with the same name / desc as the series
$title = ($content==null)?$series->nm:$content->nm; // . " Channel";

$metaDesc = ($content==null)?strip_tags($siteName . " " . $series->nm . " - " . strip_tags($series->shortDesc)):strip_tags($siteName . " " . $content->nm . " - " . strip_tags($content->shortDesc));
if (strlen($metaDesc)>128) {
    $metaDesc = substr($metaDesc, 0, 128) . "...";
}
$metaDesc = htmlentities($metaDesc);
$lrgimgthumb = ($content==null)?$series->lrgimgthumb:$content->lrgimgthumb;
$nm = ($content==null)?html_entity_decode($series->nm):html_entity_decode($content->nm);

//$metaDesc = str_replace("&quot; ", "", $metaDesc);
//$metaDesc = str_replace(" &quot;", "", $metaDesc);
$metaDesc = str_replace("&quot;", "", $metaDesc);
$metaDesc = str_replace("\r\n", " ", $metaDesc);
$metaDesc = str_replace("\n", " ", $metaDesc);

$pageUrl  = $_SERVER['REQUEST_URI'];
$rootUrl = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; // . '/';

//tagline
$tags = array();
if ($content == null) {
    if (empty($series->productionT)==false) array_push($tags, substr($series->productionT, -4));
    if (empty($series->runtime)==false) array_push($tags, $series->runtime . " mins");
    if (empty($series->tagline)==false) array_push($tags, $series->tagline);
    if (sizeof($tags) == 0 && $usePlaceholders) array_push($tags, $placeholder_tagline);
    $shortDesc = empty($series->shortDesc)==false?strip_tags($series->shortDesc):"";//$usePlaceholders?$placeholder_desc:"";
} else {
    if (empty($content->seriesId)) { array_push($tags, $content->catNm); } else { array_push($tags, $content->seriesNm); }
    if (empty($content->productionT)==false) array_push($tags, substr($content->productionT, -4));
    if (empty($content->runtime)==false) array_push($tags, $content->runtime . " mins");
    if (empty($content->tagline)==false) array_push($tags, $content->tagline);
    if (sizeof($tags) == 0 && $usePlaceholders) array_push($tags, $placeholder_tagline);
    $shortDesc = empty($content->shortDesc)==false?strip_tags($content->shortDesc):"";//$usePlaceholders?$placeholder_desc:"";
}
//$shortDesc = Encoding::fixUTF8($shortDesc);

$tagline = implode(" | ", $tags);

//season(s)
$season = null;
if ($series->typeCd == "SERIE" || $series->typeCd == "SERIA" || $series->typeCd == "MOVIE") {
    $galleries = KatapyVod::getSeasonsBySeries($series->cd, $lib);
    $seasons = EpisodeService::getSeasons($galleries);
} else {
    $seasons = array();
    $season = clone $series; //copy($series);
    $season->nm = "Videos";
    array_push($seasons, $season);
}

//echo json_encode($seasons);
if ($season == null && $seasons!=null && sizeof($seasons)>0) {
    if (empty($seasonId)) {
        $season = $seasons[0];
    } else {
        $season = KatapyApp::getObjById($seasonId, $seasons);
    }
}

//echo json_encode($season);

//content
if ($season!=null) {
    $seasonContent = KatapyVod::getContentsFromGallery($season->cd, $lib);
    $thumbnailColumns = 5;
    $thumbnailMax = 500;
    $thumbData = "videos";
    $thumbnailMax = 8;
    $vt_displaymode = "LANDS";
    // echo json_encode($seasonContent);
}
//fix short desc
if (empty($shortDesc) && sizeof($seasonContent)==1) {
    $shortDesc = strip_tags($seasonContent[0]->shortDesc);
}
// echo json_encode($shortDesc); return;


//background
if ($content == null) {
    $bgImage = KatapySections::getBackgroundImageForGallery($series->cd, $series->mediactrCd);
} else {
    $bgImage = $content->imgUrl;
}
if ($bgImage == null && sizeof($seasonContent)>0) $bgImage = $seasonContent[0]->imgUrl;
if ($bgImage == null) $bgImage = $uP . "assets/default-bg2.jpg";

//load playstates to resume current content
$playstates = null;
//$playstates = KatapyBookmark::loadPlaystates(200);
$watchlist = KatapyBookmark::loadWatchlist(100);
$isWatchlisted = EpisodeService::isSeriesOnWatchlist($watchlist, $series->id);
//echo "isWatchlisted = " . $isWatchlisted;

$isResume = false;
if (empty($playstates) == false) {
    if ($content == null) {
        if ($series->typeCd == "MOVIE") {
            $series = EpisodeService::applyPlaystateToMovie($series, $seasons, $playstates);
        } else {
            $series = EpisodeService::applyPlaystateToSeries($series, $seasonContent, $playstates);
        }
        $currentContent = $series->currentContent;
        if ($currentContent == null) {
            $currentContent = $seasonContent[0];
        }
    } else {
        $content = EpisodeService::applyPlaystateToContent($content, $playstates);
        $currentContent = $content;
    }
} else {
    if (empty($content) == false) {
        $currentContent = $content;
    } else {
        $currentContent = $seasonContent[0];
    }
}
$isResume = (empty($currentContent)==false && empty($currentContent->percent)==false);
$isAuthorized = true;

$locArray = array();
    if ($location->street1) { array_push($locArray, $location->street1); }
    if ($location->street2) { array_push($locArray, $location->street2); }
    if ($location->cityNm) { array_push($locArray, $location->cityNm); }
    if ($location->stateNm) { array_push($locArray, $location->stateNm . " " . $location->zip); }
    //array_push($locArray, $location->latitude);
    //array_push($locArray, $location->logitude);
    $address = implode(", ", $locArray);

$shareBaseUrl = $siteUrl . "/"; if (strpos($shareBaseUrl, "//")===false) { $shareBaseUrl = "https://" . $shareBaseUrl; }
//$shareBaseUrl .= $accountCd . "/";
$shareUrl = SiteContext::getUrlForSeries($shareBaseUrl, $series, $library);

?>
<!DOCTYPE html>
<html lang="en" class="<?php echo $globalOptions; ?>">
<head>
    <meta itemprop="name" content="<?php echo $nm; ?>">
    <meta itemprop="description" content="<?php echo $metaDesc; ?>">
    <meta itemprop="image" content="<?php echo $lrgimgthumb; ?>">

    <meta name="twitter:card" content="video" />
    <meta name="twitter:site" content="@katapy" />
    <meta name="twitter:title" content="<?php echo $nm; ?>" />
    <meta name="twitter:image" content="<?php echo $lrgimgthumb; ?>" />
    <meta name="twitter:description" content="<?php echo $metaDesc; ?>" />
    <meta name="twitter:creator" content="@katapy" />
    <meta name="twitter:url" content="<?php echo $rootUrl.$pageUrl; ?>" />
    <meta name="twitter:image:src" content="<?php echo $lrgimgthumb; ?>">

    <meta property="og:url" content="<?php echo $lrgimgthumb; ?>" />
    <meta property="og:type" content="video.other" />
    <meta property="og:title" content="<?php echo $nm; ?>" />
    <meta property="og:description" content="<?php echo $metaDesc; ?>" />
    <meta property="og:image" content="<?php echo $lrgimgthumb; ?>" />
    <meta property="og:site_name" content="<?php echo $siteName; ?>" />
    <?php $structuredData = true; ?>
    <?php $excludeMetaTagsForSocial = true; include $dP."includes/metainf.php"; ?>
    <script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "NewsArticle",
            "mainEntityOfPage": {
                "@type": "WebPage",
                "@id": "<?php echo $rootUrl.$pageUrl; ?>"
            },
            "headline": "<?php echo $nm; ?>",
            "image": [
                "<?php echo $lrgimgthumb; ?>"
            ],
            "datePublished": "<?php echo date("Y-m-d", strtotime($series->creT)); ?>",
            "dateModified": "<?php echo date("Y-m-d", strtotime($series->lstUpdtT)); ?>",
            "author": {
                "@type": "Organization",
                "name": "Amplify"
            },
            "publisher": {
                "@type": "Organization",
                "name": "Amplify",
                "logo": {
                "@type": "ImageObject",
                "url": "<?php echo $rootUrl . "/img/AmplifyLogoWhite01.png"; ?>"
                }
            },
            "description": "<?php echo $metaDesc; ?>",
            "isAccessibleForFree": "False",
            "hasPart": {
                "@type": "WebPageElement",
                "isAccessibleForFree": "False",
                "cssSelector": ".js-login"
            }
        }
</script>
    <link rel="stylesheet" type="text/css" href="<?php echo $uP; ?>css/jssocials.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $uP; ?>css/jssocials-theme-plain.css" />
    <link rel="stylesheet" href="<?php echo $uP; ?>modules/css/i2c.css">
</head>

<body class="custom-font kt-series <?php echo $globalOptions; ?>" >
<?php
/*****************************************************/
/* NAV ***********************************************/
/*****************************************************/
?>
    <?php include $dP."includes/nav.php"; ?>
    <h1 class="vis-hid" id="page-heading" data-gallery-id="<?php echo $series->id; ?>" data-accountCd="<?php echo $accountCd; ?>"><?php echo $siteName; ?></h1>
    <?php if ($isAppRequest == false) { ?>
    <!--<div class="kt-btn-back kt-hand" style="top:0"><a href="javascript:AppActions.loadPage('home');"><i class="fa fa-chevron-left mr-2"></i><span>Back</span></a></div>-->
    <?php   if ($content==null) {?>
    <div class="kt-btn-back"><a class="link-effect" href="javascript:AppActions.loadPage('home');"><span>Home</span></a><i class="fa fa-chevron-left mr-2 ml-2"></i><span class="last"><?php echo $series->nm; ?></span></div>
    <?php   } else { ?>
    <div class="kt-btn-back"><a class="link-effect" href="javascript:AppActions.loadPage('home');"><span>Home</span></a><i class="fa fa-chevron-left mr-2 ml-2"></i><a class="link-effect" href="javascript:AppActions.loadPage('<?php echo SiteContext::getUrlForSeries("", $series); ?>');"><span class="last"><?php echo $series->nm; ?></span></a><i class="fa fa-chevron-left mr-2 ml-2"></i><span class="last"><?php echo $currentContent->nm; //EpisodeService::getEpisodeName($currentContent); ?></span></div>
    <?php   } ?>
    <?php } ?>
<?php
/*****************************************************/
/* Title *********************************************/
/*****************************************************/ ?>
    <div class="kt-hero fade">
      <div class="kt-top-img kt-top-img-lg">
        <div class="kt-img" style="background-image:url('<?php echo $bgImage; ?>');"></div>
        <div class="kt-shadow"></div>
      </div>
      <div class="kt-img-overlay pl-3 pl-md-4">
        <div class="kt-img-overlay_content">
          <h1 class="kt-lg-heading two-lines"><?php echo empty($content)?htmlentities($series->nm):htmlentities($currentContent->nm);//EpisodeService::getEpisodeName($currentContent); ?></h1><!--title="<?php echo htmlentities($series->nm); ?>" data-toggle="tooltip" data-placement="bottom"-->
          <p class="kt-hero-details three-lines"><?php echo htmlentities($tagline); ?></p>
          <p class="kt-lg-info four-lines"><?php echo htmlentities($shortDesc); ?></p>
            <?php
            /*****************************************************/
            /* TAGS **********************************************/
            /*****************************************************/ ?>

          <div class="mb-3">

            <?php //display categories with links
                //$tags_field = str_replace("  ", " ", $series->folderNm) . "," . str_replace("  ", " ", $series->categories);
                $tags_field = str_replace("  ", " ", $series->categories);
                if ($tags_field!=null && $tags_field!="" && $tags_field!="N/A") { ?>
                <p class="kt-keywords">Categories:
                <?php
                    $tags = array();
                    $tags = array_unique(preg_replace('/^ /', '', explode(",", $tags_field)));

                    foreach ($tags as $rowcount => $tag) { 
                        if ($tag != " ") { echo '<a class="kt-keyword link-effect" href="'.$uP . 'category/1-'.SiteContext::encodePrettyUrlParam(trim($tag)).'">'.$tag.'</a>'; } 
                } ?>
            </p>
            <?php } ?>

            <?php //display genres with links
                $tags_field = $series->genres; if ($tags_field!=null && $tags_field!="" && $tags_field!="N/A") { ?>
                <p class="kt-keywords">Boroughs:
                <?php
                    $tags = array(); $tags = array_unique(preg_replace('/^ /', '', explode(",", $tags_field)));
                    foreach ($tags as $rowcount => $tag) { 
                        //$vt_url = SiteContext::getUrlForGenre($uP, $vt);
                        if ($tag != " ") { echo '<a class="kt-keyword link-effect" href="'.$uP . 'borough/1-'.SiteContext::encodePrettyUrlParam(trim($tag)).'">'.$tag.'</a>'; } 
                } ?>
            </p>
            <?php } ?>

            <?php if (empty($address)==false) { ?>
            <p class="kt-keywords">Location: <?php echo $address; ?></p>
            <?php } ?>

            <?php //Celebrity Sightings
                $tags_field = ($content==null)?$series->actors:$content->actors;
                if ($tags_field!=null && $tags_field!="" && $tags_field!="N/A") { ?>
                    <p class="kt-keywords">Celebrity Sightings: <?php
                    $tags = array(); $tags = array_unique(preg_replace('/^ /', '', explode(",", $tags_field)));
                    foreach ($tags as $rowcount => $tag) {
                        if (empty(trim($tag)) == false && $tag != "undefined") { echo '<a class="kt-keyword link-effect" href="'.$uP . 'celebrity/1-'.SiteContext::encodePrettyUrlParam(trim($tag)).'">'.trim($tag).'</a>'; }
                    } ?>
                    </p>
            <?php } ?>

          </div>
          <?php if ($isResume) {
            /*****************************************************/
            /* PROGRESS BAR **************************************/
            /*****************************************************/ ?>
          <p class="kt-md-info">
            <div class="progress kt-event-progress"><div class="progress-bar" data-percentage="<?php echo $currentContent->percent; ?>"></div></div>
            <div class="text-white push-5-r kt-event-progress-label"><?php echo EpisodeService::getMinutesLeftFormatted($currentContent); //echo $currentContent->seekTime;?></div>
          </p>
          <?php } ?>
          <?php
            /*****************************************************/
            /* ACTION BUTTONS ************************************/
            /*****************************************************/
            $actionLabel = EpisodeService::getPlayActionLabel($currentContent, $series, $isResume);
          ?>
          <div class="kt-btn-list-x mt-5">
            <?php if ($isAuthorized) { ?>
            <button class="btn btn-light btn-lg" onclick="javascript:location.href='<?php if ($currentContent == null) { echo "javascript:void(0);"; } else { echo SiteContext::getUrlForContent($uP, $currentContent); }?>';" <?php if (strpos($actionLabel, "...")!==false) { ?>data-toggle="tooltip" title="<?php echo EpisodeService::getEpisodeName($currentContent); ?>"<?php } ?>><?php echo $actionLabel; ?></button>
            <?php if ($isResume) { ?>
            <button class="btn btn-outline-light btn-lg" onclick="javascript:location.href='<?php echo SiteContext::getUrlForContent($uP, $currentContent);?>-rewind';">Start Over</button>
            <?php } ?>
        <?php } else { ?>
            <button class="btn btn-light btn-lg">Rent or Buy</button>
        <?php } ?>

            <?php if ($lib != $library) { ?>
            <div class="kt-btn-group">
                <button class="btn btn-outline-light btn-lg" data-toggle="dropdown">More Options</button> <!--onclick="location.href='<?php echo $shopUrl; ?>';"-->
                <div class="dropdown-menu dropdown-menu-right font-size-sm" aria-labelledby="dropdown-default-primary" x-placement="bottom-end">
                    <!--<a class="dropdown-item" href="javascript:console.log('related documents');">Related Documents</a>
                    <div class="dropdown-divider"></div>-->

                    <a class="dropdown-item" href="<?php echo $shopUrl; ?>" target="_blank">More Purchase Options</a>
                </div>
            </div>
            <?php } ?>
            <br clear="all">
          </div>
          <?php
                $infoQ = '';
                if ($location->nm) {$infoQ .= str_replace(' ', '+', $location->nm);}
                if ($location->street1) {$infoQ .= '+'.str_replace(' ', '+', $location->street1);}
                if ($location->cityNm) {$infoQ .= ',+'.str_replace(' ', '+', $location->cityNm);}
                if ($location->stateNm) {$infoQ .= ',+'.str_replace(' ', '+', $location->stateNm);}
            ?>
          <div class="kt-btn-icons-list row">
            <div class="col-3 col-md-auto">
                <?php if (empty($location->latitude)) { ?><a href="javascript:void(0);" class="disabled btn kt-btn-icon"><?php } else { ?><a class="btn kt-btn-icon" href="https://www.google.com/maps/dir/?api=1&destination=<?php echo $location->latitude . "," . $location->logitude; ?>" target="_blank"><?php } ?><i class="fas fa-directions"></i><span>Directions</span></a>
            </div>
            <div class="col-3 col-md-auto kt-addto-btn">
                <a class="btn kt-btn-icon"><i class="fas fa-plus"></i><span>Add To...</span></a>
            </div>
            <div class="col-3 col-md-auto kt-share-btn">
                <a class="btn kt-btn-icon"><i class="fas fa-share"></i><span>Share</span></a>
            </div>
            <div class="col-3 col-md-auto">
                <?php if (empty($infoQ)) { ?><a href="javascript:void(0);" class="disabled btn kt-btn-icon"><?php } else { ?><a href="http://google.com/search?q=<?php echo $infoQ; ?>" target="_blank" class="btn kt-btn-icon"><?php } ?><i class="fas fa-store-alt"></i><span>More Info</span></a>
            </div>
          </div>
          <?php
                $evt_nm = $series->nm;
                $evt_desc = $series->shortDesc;
                $evt_location = $infoQ;
                $googleCalUrl = "http://www.google.com/calendar/event?action=TEMPLATE&text=" . urlencode($evt_nm) . "&details=" .  urlencode($evt_desc) . "&location=" . urlencode($evt_location) . "&trp=false&sprop=" . urlencode($siteName) . "&sprop=name:" .urlencode($siteUrl);
                $iCalUrl = $uP . "ical?id=" . $series->id . "&lib=" . $lib;
          ?>
          <div class="kt-dropdown">
              <div class="kt-dropdown-addto d-none">
                <a href="#" class="d-block my-1 js-add-to-watchlist <?php if ($isWatchlisted) { echo "hidden"; } ?>">Add to My Trip</a>
                <a href="#" class="d-block my-1 <?php if ($isWatchlisted==false) { echo "hidden"; } ?> js-remove-from-watchlist">Remove from My Trip</a>
                <a href="<?php echo $iCalUrl; ?>" class="d-block my-1" download>Add to iCal / Outlook Calendar</a>
                <a href="javascript:window.open('<?php echo $googleCalUrl; ?>');" class="d-block my-1">Add to Google Calendar</a>
              </div>
              <div class="kt-dropdown-share d-none">
                <?php
                    $subject = strtoupper($appcd) . " - $series->nm";
                    if ($location) $subject .= " - $location->street1, $location->stateNm $location->zip";
                    $description = $series->shortDesc;
                ?>
                <div class="share-container" data-subject='<?php echo urlencode($subject); ?>' data-description='<?php echo urlencode($description); ?>' data-url='<?php echo urlencode($shareUrl); ?>'></div>
              </div>
          </div>
        </div>
      </div><br clear="all">
    </div>

<?php
/*****************************************************/
/* EPISODES AND SEASON PICKER ************************/
/*****************************************************/
if (sizeof($seasonContent)>1) {
?>
    <div class="container-fluid">
        <?php $owlLazyLoad = 'false'; include $dP."includes/featured-section-season.php"; ?>
        <?php //$owlLazyLoad = 'false'; include $dP."modules/slider-section_season.php"; ?>
    </div>
<?php } ?>
<?php
/*****************************************************/
/* CATEGORIES TAGS ***********************************/
/*****************************************************/
//display categories with links
$tags_fieldname = "categories";
if ($tags_fieldname == "categories") {
    $tags_field = $series->folderNm . "," . $series->$tags_fieldname;
} else {
    $tags_field = $series->$tags_fieldname;
}

if ($tags_field!=null && $tags_field!="" && $tags_field!="N/A") { 
    $tags_field = $series->folderNm . "," . $tags_field; //add folder name
    $tags = array(); $tags = array_unique(preg_replace('/^ /', '', explode(",", $tags_field)));
    foreach ($tags as $rowcount => $tag) { 
        if (empty(trim($tag)) == false) {
            $viewAllUrl = $uP . 'category/1-'.SiteContext::encodePrettyUrlParam(trim($tag));
        ?>
        <?php include $dP."modules/slider-section_tags.php"; ?>

<?php }}} ?>

<?php
/*****************************************************/
/* FOOTER ********************************************/
/*****************************************************/
?>
    <?php include $dP."includes/footer.php"; ?>

    <script src="<?php echo $uP; ?>js/jquery-1.11.1.min.js"></script> <?php //core framework ?>
    <script src="<?php echo $uP; ?>js/bootstrap.min.js"></script> <?php //core framework ?>
    <script src="<?php echo $uP; ?>js/owl.carousel.js"></script> <?php //thumbnail carousel ?>
    <script src="<?php echo $uP; ?>js/jquery.ui.totop.min.js"></script> <?php //button "to TOP" ?>
    <script src="<?php echo $uP; ?>js/jquery.easing.min.js"></script> <?php //button "to TOP" ?>
    <script src="<?php echo $uP; ?>js/jquery.lazy.min.js"></script> <?php //for thumbnail images ?>
    <script src="<?php echo $uP; ?>js/jquery.sticky.js"></script> <?php //for sticky nav ?>
    <script src="<?php echo $uP; ?>js/cookie-consent.js"></script> <?php //GDPR ?>
    <script src="<?php echo $uP; ?>js/jquery.ticker.js"></script> <?php //GDPR ?>
    <script type="text/javascript" src="<?php echo $uP; ?>js/jssocials.js"></script>
    <script type="text/javascript" src="<?php echo $uP; ?>modules/js/jquery.marquee.min.js"></script>
    <script src="<?php echo $uP; ?>js/v<?php echo $version; ?>_main-2.0.1.js" id="page-script" data-acc-app="<?php echo $accountCd;?>"></script>
    <script src="<?php echo $uP; ?>js/pages/v<?php echo $version; ?>_series.js"></script>
    <script src="<?php echo $uP; ?>ph/json2.js"></script>
    <script src="<?php echo $uP; ?>ph/v<?php echo $version; ?>_playhistory.js"></script>
  <script type="text/javascript" src="<?php echo $uP; ?>modules/js/v<?php echo $version; ?>_slider.js"></script>
    <script>
        playhistory.uP = "<?php echo str_replace("http:", "", SiteContext::getServerUrl()); ?>";
/*
        function addToWatchlist() {
            //add to watchlist
            var obj = new Object();
            obj.id = "<?php echo $main->id; ?>";
            //var data = <?php //echo json_encode($main); ?>;
            playhistory.addToWatchlist(JSON.stringify(obj));
            $(".loading").show();
            location.href = location.href;
        }

        function removeFromWatchlist() {
            //add to watchlist
            playhistory.removeFromWatchlist("<?php echo $main->id; ?>");
            $(".loading").show();
            location.href = location.href;
        }

        <?php if ($main->typeCd=="MOVIE" && $finished && $pigeonEnabled) { // remove from continue watching ?>
        playhistory.removePlayhistory("<?php echo $main->id; ?>");
        <?php } ?>
  */
    </script>

    <script>
        App.loader('show');
    </script>
</body>
</html>
