<?
if (! defined('IN_PHPFN'))
die('Illegal attempt to access script directly!');
// Handle twisties
if ($ShowTwistie == 1)
{
$Collapsed='4';
$Expanded='6';
}
if ($ShowTwistie == 2)
{
$Collapsed='+';
$Expanded='-';
}
if ($ShowTwistie == 3)
{
$Collapsed=$NewsDir . "/Images/Plus.gif";
$Expanded=$NewsDir . "/Images/Minus.gif";
}
// Include the script for the popup, if required
if ($FullNewsDisplayMode == 3)
{
?>
<script type="text/Javascript">
<!--
function ViewArticle(ArticleID)
{
window.open("<?= $NewsDir ?>/View.php?ArticleID=" + ArticleID, "NewsArticle", "width=<?=$PopupWidth ?>,height=<?=$PopupHeight ?>,resizable=yes,scrollbars=yes")
}
//-->
</script>
<?php
}
if ($InitiallyShowHeadlinesOnly == 1)
{
?>
<script type="text/Javascript">
<?php
if ($ShowTwistie == 3)
{
?>
function compareStrings(str1, str2)
{
var len1 = String(str1).length;
var len2 = String(str2).length;
if (len1 >= len2)
str1 = String(str1).substring(len1, len1 - len2);
else
str2 = String(str2).substring(len2, len2 - len1);
return (str1 == str2);
}
<?php
}
?>
function exp(evt, strTag, strID)
{
var elem = document.getElementsByTagName(strTag);
var e = (window.event) ? window.event : evt;
var strAttribute = 'ext' + strID;
var strImage = 'img' + strID;
var elem1;
if (e.srcElement)
elem1 = e.srcElement;
else if (e.target)
elem1 = e.target;
// Iterate through the nodes to toggle the twistie
for (var i=0;i<elem1.childNodes.length;i++)
{
<?php
if (($ShowTwistie == 1) || ($ShowTwistie == 2) )
{
?>
if ( (elem1.childNodes[i].innerText == "<?=$Collapsed?>") || (elem1.childNodes[i].innerText == "<?=$Expanded?>") )
elem1.childNodes[i].innerText == "<?=$Collapsed?>" ? elem1.childNodes[i].innerText= "<?=$Expanded?>" : elem1.childNodes[i].innerText = "<?=$Collapsed?>";
<?php
}
?>
}
<?php
// Need to toggle the plus and minus symbols
if ($ShowTwistie == 3)
{
?>
var elem2 = document.getElementById(strImage);
if (compareStrings(elem2.getAttribute("src"), "<?=$Collapsed?>"))
elem2.setAttribute("src", "<?=$Expanded?>");
else
elem2.setAttribute("src", "<?=$Collapsed?>");
<?php
}
?>
// Iterate through the nodes to toggle the visibility
for (var i =0;i<elem.length;i++)
if (elem[i].getAttribute(strAttribute)=="yes")
elem[i].style.display=='none'? elem[i].style.display='block':elem[i].style.display='none';
}
</script>
<?php
}
?>