/**
  * Передает переменные в шаблон для вывода в поток 
  *
  * @param string|array $data
  * @param mix $value
  *
  * @return void
  */
 public function assignHtml($data, $value = null)
 {
     if (is_array($data)) {
         $this->data = array_merge($this->data, $data);
     } else {
         $this->data[$data] = htmlChars($value);
     }
     return $this;
 }
                <img src="' . getThumbURLFromFileName($value['Thumbnail']['localName']) . '" alt="' . htmlChars($value['Title']) . '" alt="Highslide JS" title="Click to enlarge" />
                </a>';
            echo '<div class="highslide-heading">' . $value['Title'] . '</div>';
            echo '<div class="highslide-caption">
                                   <a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/b">View Full Record</a>
                                </div></div>';
            $galleryTotal = $galleryTotal + 1;
        }
        if (!empty($value['Image'])) {
            $thumbWidth = 100;
            $thumbHeight = 120;
            //echo '<a href="'.baseURL.pfolder.'object/'.$value['kid'].'/"><img class="essayImg" width="'.$thumbWidth.'" height="'.$thumbHeight.'" src="'.getThumbURLFromFileName($value['Image']['localName']).'" alt="'.htmlChars($value['Title']).'" /></a>';
            //echo "<br />";
            echo '<div class="highslide-gallery">';
            echo '<a id = ' . $value['kid'] . 'single href="' . getFullURLFromFileName($value['Image']['localName']) . '" class="highslide" onclick="return hs.expand(this,	{ slideshowGroup: ' . $galleryTotal . '} )">
                <img src="' . getThumbURLFromFileName($value['Image']['localName']) . '" alt="' . htmlChars($value['Title']) . '" alt="Highslide JS" title="Click to enlarge" />
                </a>';
            echo '<div class="highslide-heading">' . $value['Title'] . '</div>';
            echo '<div class="highslide-caption">
                                   <a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/b">View Full Record</a>
                                </div></div>';
            $galleryTotal = $galleryTotal + 1;
        }
        //echo "<br />";
        ?>
</div><?php 
        $i++;
        if (!empty($value['Object Associator'])) {
            //collect object associators
            $obj_assocs = $value['Object Associator'];
        }
    }
}
?>
">
	        <a class="button" href="#">Essays</a>
	        <?php 
$essay_fields = array('Section Order', 'Tagline (short title)');
$essay_order[] = array('field' => 'Section Order', 'direction' => SORT_ASC);
$essay_query = new KORA_Clause("KID", "!=", "");
$essay_obj = KORA_Search(token, $projID, $essayID, $essay_query, $essay_fields, $essay_order);
?>
<ul><?php 
//var_dump($essay_obj);
foreach ($essay_obj as $value) {
    // change "project" to specific project name
    echo '<li><a class="button" href="' . baseURL . pfolder . 'essays/' . $value['kid'] . '/">' . htmlChars($value['Tagline (short title)']) . '</a></li>';
}
?>
	    	</ul>
  		</div>
  	</li>
  	<li>
    	<div class="space2"></div>
  	</li>
  	<li>
	<!-- change "project" and "project name" to specific project name -->
    	<div class="secondary_link"><a href="<?php 
echo baseURL . pfolder;
?>
">Home</a></div>
 	</li>
     echo '<div class="modtitle"><h5><a href="' . $value['URL'] . '">' . $value['Title'] . '</a></h5></div>';
 }
 if (!empty($value['Thumbnail']['localName'])) {
     $thumbWidth = 120;
     $thumbHeight = 120;
     $localName = $value['Thumbnail']['localName'];
     $file = getFullURLFromFileName($localName);
     $image = getThumbURLFromFileName($localName);
     //getThumbnailKORA($value['Thumbnail']['localName'], $thumbWidth, $thumbHeight);
     // Get thumb from KORA
     echo '<a href="' . $value['URL'] . '"><img class="moduleImg" width="' . $thumbWidth . '" height="' . $thumbHeight . '"  src="' . $image . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
 } else {
     //Create thumb if needed
     if (!empty($hi_obj['Image']['localName'])) {
         createthumb(getFullPathFromFileName($value['Image']['localName']), 'thumbs/' . $value['Image']['localName'], 100, 100);
         echo '<a href="' . $value['URL'] . '"><img src="' . baseURL . 'thumbs/' . $value['Image']['localName'] . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
     }
 }
 if (!empty($value['Date'])) {
     foreach ($value['Date'] as $date) {
         if (!empty($date)) {
             if ($date == "CE") {
                 break;
             }
             echo $date . "<br/>";
         }
     }
 }
 if (!empty($value['Description'])) {
     echo fixTags($value['Description']) . "<br />";
 }
            echo "<h3>" . $currFilter . "</h3>";
            echo "<h4>" . $currFilterDesc . "</h4>";
        }
        ?>
<div class="browse_item" style = "height: 150px;"><?php 
        if (!empty($value['Thumbnail']['localName'])) {
            echo '<div class="thumb">';
        } else {
            echo '<div class="no_thumb">';
        }
        $m;
        if (!empty($value['Thumbnail']['localName'])) {
            $thumbWidth = 100;
            $thumbHeight = 120;
            // Get thumb from KORA
            echo '<a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/b"><img class="essayImg"  width="' . $thumbWidth . '" height="' . $thumbHeight . '" src="' . getThumbURLFromFileName($value['Thumbnail']['localName']) . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
        }
        //echo "<br />";
        echo "</div>";
        $i++;
        if (!empty($value['Object Associator'])) {
            //collect object associators
            $obj_assocs = $value['Object Associator'];
        }
        if (!empty($value['Title'])) {
            echo '<h4><a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/b/">' . $value['Title'] . '</a></h4>';
        }
        if (is_array($value['Date Original'])) {
            echo '<strong>Date: </strong>' . formatDate($value['Date Original']['month'], $value['Date Original']['day'], $value['Date Original']['year']) . '<br />';
        } else {
            if (is_array($value['Date Range'])) {
        ?>
secondary_link<?php 
    }
}
?>
">
	        <a class="button" href="#">Essays</a>
	        <?php 
$essay_fields = array('Section Order', 'Tagline (short title)');
$essay_order[] = array('field' => 'Section Order', 'direction' => SORT_ASC);
$essay_query = new KORA_Clause("KID", "!=", "");
$essay_obj = KORA_Search(token, $projID, $essayID, $essay_query, $essay_fields, $essay_order);
?>
<ul><?php 
foreach ($essay_obj as $value) {
    echo '<li><a class="button" href="' . baseURL . 'failedislamicstates/essays/' . $value['kid'] . '/">' . htmlChars($value['Tagline (short title)']) . '</a></li>';
}
?>
	    	</ul>
  		</div>
  	</li>
  	<li>
    	<div class="space2"></div>
  	</li>
  	<li>
    	<div class="secondary_link"><a href="<?php 
echo baseURL;
?>
failedislamicstates/">Failed Islamic States</a></div>
 	</li>
  </ul>
        } else {
            if (!empty($value['Thumbnail']['localName'])) {
                $thumbWidth = 100;
                $thumbHeight = 120;
                // Get thumb from KORA
                echo '<a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/b"><img   width="' . $thumbWidth . '" height="' . $thumbHeight . '" src="' . getThumbURLFromFileName($value['Thumbnail']['localName']) . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
            } else {
                if (!empty($value['Multi-Part Associator'])) {
                    $fields = array('Title', 'Image');
                    $query = new KORA_Clause("KID", "=", $value['Multi-Part Associator'][0]);
                    $sort = array('fields' => $fields, 'direction' => SORT_ASC, 'byProject' => false);
                    $m = KORA_Search(token, $projIDs, $multPartIDs, $query, $fields, $sort);
                    //var_dump($m);
                    $thumbWidth = 100;
                    $thumbHeight = 120;
                    echo '<a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/b"><img width="' . $thumbWidth . '" height="' . $thumbHeight . '" src="' . getThumbURLFromFileName($m[$value['Multi-Part Associator'][0]]['Image']['localName']) . '" alt="' . htmlChars($m[$value['Multi-Part Associator'][0]]['Title']) . '" /></a>';
                    echo "<br />";
                }
            }
        }
        echo "<br />";
        ?>
</div><?php 
        /*if($currType == "Document") {
              echo "</div>";
          }*/
        $i++;
        if (!empty($value['Object Associator'])) {
            //collect object associators
            $obj_assocs = $value['Object Associator'];
        }
                                //var_dump(baseURL);
                                $images[] = $thumbDiv . '<a href="' . baseURL . pfolder . 'object/' . $match['kid'] . '/e/' . $kid . '/">
								<img class="essayImg" src="' . getThumbURLFromFileName($match['Image']['localName'], $thumbWidth, $thumbHeight) . '" title="' . htmlescape(htmlChars($match['Title'])) . '" alt="' . htmlescape(htmlChars($match['Title'])) . '" />
				     			<div class="clearboth"><strong>' . $match['Title'] . '</strong><br />' . '
								</div></a></div>';
                            } else {
                                $fields = array('Title', 'Image');
                                $query = new KORA_Clause("KID", "!=", " ");
                                $multiObj = KORA_Search(token, $projID, $multPartID, $query, $fields);
                                $m[] = array();
                                foreach ($multiObj as $mpo) {
                                    $m[] = $mpo['kid'];
                                }
                                $assocObj = array_intersect($match['Multi-Part Associator'], $m);
                                $images[] = $thumbDiv . '<a href="' . baseURL . pfolder . 'object/' . $assocObj[0] . '/y/' . $kid . '/">
								<img class="essayImg" src="' . getThumbURLFromFileName($multiObj[$assocObj[0]]['Image']['localName'], $thumbWidth, $thumbHeight) . '" title="' . htmlescape(htmlChars($multiObj[$assocObj[0]]['Title'])) . '" alt="' . htmlescape(htmlChars($multiObj[$assocObj[0]]['Title'])) . '" />
				     			<div class="clearboth"><strong>' . $match['Title'] . '</strong><br />' . '
								</div></a></div>';
                            }
                            $i++;
                            $groupNo++;
                        }
                        echo "";
                    }
                }
                echo "<div>";
                echo str_replace($totalReplacements, $images, $value['Description']) . '<br />';
                echo "</div>";
            } else {
                echo "<div>";
                echo fixTags($value['Description']) . '<br />';
                                echo '<div id="object">';
                                echo '<a class="highslide" onclick="return hs.expand(this, { slideshowGroup: \'imgGroup-' . $imageGroupNo . '\' })" href="' . getThumbnailKORA($value['Image']['localName'], 1500, 1500) . '">
					<img src="' . getThumbnailKORA($value['Image']['localName'], $thumbWidth, $thumbHeight) . '" title="' . htmlescape(htmlChars($value['Title'])) . '" alt="' . htmlescape(htmlChars($value['Title'])) . '" />
					</a>
					<div class="highslide-heading">' . $value['Title'] . '</div>
					<div class="highslide-caption"><a href="' . baseURL . 'sidiyyababa/object/' . $value['kid'] . '/">View Full Record</a><br />
					</div>';
                                //echo '<div class="clearboth"></div>';
                                echo '</div>';
                                $imageGroupNo++;
                            }
                        }
                        if (!empty($value['Title'])) {
                            if (!empty($value['Image'])) {
                                echo '<a href="' . getThumbnailKORA($value['Image']['localName'], 1500, 1500) . '" onclick="return hs.expand(this, { slideshowGroup: \'imgGroup-' . $imageGroupNo . '\' })">' . $value['Title'] . '</a>
					<div class="highslide-heading">' . htmlChars($value['Title']) . '</div>
					<div class="highslide-caption"><a href="' . baseURL . 'sidiyyababa/object/' . $value['kid'] . '/">View Full Record</a><br />
					' . '</div>
					<br />';
                                $imageGroupNo++;
                            } else {
                                echo '<a href="' . baseURL . 'sidiyyababa/object/' . $value['kid'] . '/">' . $value['Title'] . '</a><br />';
                            }
                        }
                        if (!empty($value['Date Original'])) {
                            echo '<strong>Date: </strong>' . formatDate($value['Date Original']['month'], $value['Date Original']['day'], $value['Date Original']['year']) . '';
                        } else {
                            if (!empty($value['Date Range'])) {
                                echo '<strong>Date Range: </strong>' . $value['Date Range'][0];
                            }
                        }
                //OBJECT Assoc
                $obj_fields = array('Image', 'Title', 'Date Original', 'Description', 'Creditline');
                $obj_order[] = array('field' => 'kid', 'direction' => SORT_ASC);
                //sort in order associated
                $obj_query = new KORA_Clause("KID", "IN", $obj_assocs);
                $obj_obj = KORA_Search(token, $projID, $objID, $obj_query, $obj_fields, $obj_order);
                if (!empty($obj_obj)) {
                    echo "<strong>Related Objects</strong>";
                    echo "<br /><br />";
                }
                foreach ($obj_obj as $o) {
                    if (!empty($o['Image'])) {
                        $thumbWidth = 100;
                        $thumbHeight = 300;
                        echo '<a href="' . baseURL . pfolder . 'object/' . $o['kid'] . '/">
					      <img src="' . getThumbURLFromFileName($o['Image']['localName'], $thumbWidth, $thumbHeight) . '" title="' . htmlChars($o['Title']) . '" alt="' . htmlChars($o['Title']) . '" /></a>';
                        echo '<br />';
                    }
                    if (!empty($o['Title'])) {
                        if (!empty($o['Date Original'])) {
                            echo '<a href="' . baseURL . pfolder . 'object/' . $o['kid'] . '/">' . $o['Title'] . '</a> (' . formatDate($o['Date Original']['month'], $o['Date Original']['day'], $o['Date Original']['year']) . ')' . '<br />';
                        } else {
                            echo '<a href="' . baseURL . pfolder . 'object/' . $o['kid'] . '/">' . $o['Title'] . '</a><br />';
                        }
                    }
                    if (!empty($o['Creditline'])) {
                        echo '<div class="desc">' . $o['Creditline'] . "</div>";
                    }
                    echo "<br />";
                }
            }
    foreach ($obj as $value) {
        if (!empty($value['Thumbnail ']['localName'])) {
            //alternate thumb divs left and right
            if ($i % 2 == 0) {
                echo '<div class="thumb">';
            } else {
                echo '<div class="thumb">';
            }
        } else {
            echo '<div class="no_thumb">';
        }
        $i++;
        $thumbWidth = 120;
        $thumbHeight = 300;
        // Get thumb from KORA
        echo '<a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/"><img src="' . getThumbURLFromFileName($value['Image']['localName'], $thumbWidth, $thumbHeight) . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
        ?>
</div><?php 
        if ($j % 2 == 0) {
            echo '<div>';
        } else {
            echo '<div>';
        }
        $j++;
        if (!empty($value['Title'])) {
            //link to full record
            echo '<h4><a href="' . baseURL . pfolder . 'object/' . $value['kid'] . '/">' . $value['Title'] . '</a></h4>';
        }
        if (is_array($value['Date Original'])) {
            echo '<strong>Date:</strong> ' . formatDate($value['Date Original']['month'], $value['Date Original']['day'], $value['Date Original']['year']) . "<br />";
        } else {