var newsArray = new Array();
var commentArray = new Array();
var commentCount = new Array();
var tmout;
var neCount = 0;
var maxCount = 0;
var commentCode = "";

function news() {
        itemsString="";
        for (i=0;i<10;i++) {
            j = neCount + i;
            commentCode = "";
            elem_news_rec_id = newsArray[j][3];
            if (elem_news_rec_id in commentArray) { commentCode = commentArray[elem_news_rec_id]; commentNum = commentCount[elem_news_rec_id]; }
            else { commentNum = 0; }
            if (newsArray[j][2] != "") { commentNum++; }
            itemsString += "<div class='mytext'><a style='color: rgb(85, 68, 51);' href='" + newsArray[j][1] + "'>" + newsArray[j][0] + "</a></div>";
            //if (newsArray[j][2] != "" || elem_news_rec_id in commentArray) {
            itemsString += "<div class='toggle_control'><nobr><a href='http://www.aseriesofmoments.com/#'>(" + commentNum + ")<img style='border-style: none' class='descImg' src='./images/plus.JPG' height=16 width=16></a></nobr></div>";
            //}
            //else { itemsString += "<div class='toggle_control'>&nbsp;</div>"; }
            itemsString += "<div class='mydesc'><P>" + newsArray[j][2] + "</P>" + commentCode +"<p style='width: 100%; text-align: right;'><a style='color: rgb(85, 68, 51); font-family: arial; font-size: 8pt;' href='http://www.aseriesofmoments.com/news_item.php?news_rec_id=" + elem_news_rec_id + "' alt='Read comments...and write your own!'><img style='border-style: none' src='./images/comment.GIF' height=15 width=15>&nbsp;Add your own comment...</a></p></div>";
            itemsString += "<div style='width: 100%; height: 2px;'>&nbsp;</div>";
        }
        document.getElementById("mytext2").innerHTML=itemsString;
}

function dec(){
        neCount--;
        if (neCount < 0){ neCount++; }
        news();
        $(".mydesc").hide();
        $(".toggle_control").toggle(function() {
	        $(this).find(".descImg").attr("src", "./images/minus.JPG");
		    }, function () {
		    $(this).find(".descImg").attr("src", "./images/plus.JPG");
	});
	$(".toggle_control").click(function (event) {
	    event.preventDefault();
	    $(this).next(".mydesc").slideToggle("slow");
	});
}

function inc(){
        neCount++;
        if (neCount > maxCount - 9) { neCount--; }
        news();
        $(".mydesc").hide();
        $(".toggle_control").toggle(function() {
	    $(this).find(".descImg").attr("src", "./images/minus.JPG");
		    }, function () {
		    $(this).find(".descImg").attr("src", "./images/plus.JPG");
	});
	$(".toggle_control").click(function (event) {
	    event.preventDefault();
	    $(this).next(".mydesc").slideToggle("slow");
	});
}
$(document).ready(function() {
                news();
		$(".mydesc").hide();
		$(".toggle_control").toggle(function() {
			    $(this).find(".descImg").attr("src", "./images/minus.JPG");
			    }, function () {
			    $(this).find(".descImg").attr("src", "./images/plus.JPG");
		});
		$(".toggle_control").click(function (event) {
		    event.preventDefault();
		    $(this).next(".mydesc").slideToggle("slow");
		});
	    });
