/** presentation */
 function renderEdgeJs($flowId)
 {
     $rows = $this->flow->getFlowById($flowId);
     $sum = $this->flow->getSumOfOutgoingFlow($rows->from, $rows->to);
     $ratio = 0;
     if ($sum) {
         $ratio = $rows->count / $sum;
     }
     $color = ExtraWatchHelper::rgbColorFromRatio($ratio);
     $percent = $ratio * 100;
     return sprintf("graph.newEdge(node_%d, node_%d, {color: '%s'}, %.2f); // lightness: %d percent: %d count; {$rows->count}, sum: {$sum}\n", $rows->from, $rows->to, $color, $percent, $percent, $percent, $rows->count, $sum);
 }
    ?>



var xpathElements = [];
var xpathElementClicks = [];
var xpathElementColors = [];

    <?php 
    if (@$xpath == "all") {
        $totalClicksOfUri2TitleId = $extraWatch->heatmap->getTotalMostClickedHTMLElementsByUri2TitleId($uri2titleId);
        $xpathElements = $extraWatch->heatmap->getAllMostClickedHTMLElementsByUri2TitleId($uri2titleId, $totalClicksOfUri2TitleId);
        foreach ($xpathElements as $xpathElement) {
            echo "xpathElements.push('" . urldecode(urldecode($xpathElement->xpath)) . "');\n";
            echo "xpathElementClicks.push('" . $xpathElement->xpathCount . "');\n";
            echo "xpathElementColors.push('" . ExtraWatchHelper::rgbColorFromRatio($xpathElement->ratio) . "');\n";
        }
        ?>


    window.addEventListener('load', ew_Heatmap.highlightElementsByXPath(xpathElements, document));


   <?php 
    } else {
        ?>


    window.addEventListener('load',function(){
		var xpath = '<?php 
        echo urldecode(urldecode($xpath));