function goAnim(waitForAnimatedGif) {
	if (welcome) {
		welcome = false;
		if (waitForAnimatedGif) { 
			setTimeout("playRotate(1);",2400);									
		} else {
			playRotate(0);
		}
	}
}
function playRotate(animateMain) {
	var navContent = document.getElementById('navContent');
	navContent.style.visibility = 'visible';
	rotateImages();
	rotateHeadlines();
	rotateCaptions();
	setTimeout("goTicker();",  7500);
	if (animateMain) {
		setTimeout("makeVisible('atexttitle');",   500); // 1/2 sec delays
		setTimeout("makeVisible('atextauthor');", 1000);
		setTimeout("makeVisible('atext');",       1500);
		setTimeout("makeVisible('atextlinks');",  2000);
	} else {
		makeVisible('atexttitle');
		makeVisible('atextauthor');
		makeVisible('atext');
		makeVisible('atextlinks');
	}
}
function makeVisible(name) {
	document.getElementById(name).style.visibility = 'visible';
}
// assumes arrays have been built in random order
iImg = 1;
iHead = iCap = 0;
function rotateImages() {
	if (iImg >= dimages.length) iImg = 1;
	document.images["mainimg"].src = dimages[iImg];
	iImg++;
	// random 0-15secs + 30secs == random between 30-45 secs
	setTimeout("rotateImages();",  Math.floor(Math.random()*15000) +35000);   
}
function rotateHeadlines() {
	if (iHead >= dheadlines.length) iHead = 0;
	var setHeadline = document.getElementById("aheadline");
	setHeadline.innerHTML = dheadlines[iHead];
	iHead++;
	// random 0-10secs + 10secs == random between 20-30 secs
	setTimeout("rotateHeadlines();", Math.floor(Math.random()*15000) +40000);
}
function rotateCaptions() {
	if (iCap >= dcaptions.length) iCap = 0;
	var setCaption=document.getElementById("acaption");
	setCaption.innerHTML = dcaptions[iCap];
	iCap++;
	// random 0-15secs + 20secs == random between 20-35 secs
	setTimeout("rotateCaptions();",  Math.floor(Math.random()*15000) +40000);
}

// data and functions for ticker:
var colors = new Array();
colors[14] = "#282828";
colors[13] = "#383838";
colors[12] = "#484848";
colors[11] = "#585858";
colors[10] = "#686868";
colors[9] = "#787878";
colors[8] = "#888888";
colors[7] = "#989898";
colors[6] = "#959595";
colors[5] = "#AAAAAA";
colors[4] = "#BBBBBB";
colors[3] = "#CCCCCC";
colors[2] = "#e0e0e0";
colors[1] = "#EEEEEE";
var inum = 1;
var onum = 14;
var p = 0;
function goTicker() {
	 if (p >= dtickers.length) p = 0;
   document.getElementById('aticker').innerHTML = dtickers[p];
	 p++;
	 setTimeout("fadeIn();", 5000);
}
function fadeOut() {
   document.getElementById('aticker').style.color = colors[inum];
	 inum = inum + 1;
	 if (inum <= 14) {
	   setTimeout("fadeOut()", 60);
	 }
	 else {
	   inum = 1;
	   setTimeout("goTicker();", 1000);
	 }
}
function fadeIn() {
   document.getElementById('aticker').style.color = colors[onum];
	 onum = onum - 1;
	 if (onum >= 1) {
	   setTimeout("fadeIn()", 60);
	 }
	 else {
	   onum = 14;
	   setTimeout("fadeOut()", 12000);
	 }
}
// end ticker content
function openPage2(article_id, viewlength) {
	window.open("inc-page2/page2.php?article_id="+article_id+"&length="+viewlength, "Page2", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=280,height=600,screenX=1200,left=800");
}
function openMediaPlatform(i) {
	window.open("media-platform.php?mediatype="+i, "mediaplatform", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=250,height=400");
}
function openImagePlatform() {
	window.open("image-platform.php?group=dnc", "imageplatform", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=no,location=no,width=840,height=360");
}
function openPage2index() {
	window.open("inc-page2/page2index.php?view=dnc", "Page2index", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=270,height=540,screenX=1200,left=800");
}
function openCredits() {
	window.open("credits.php", "credits", "menubar=no,toolbar=no,resizable=no,status=no,scrollbars=yes,location=no,width=400,height=280");
}
function openMoment() {
	window.open("inc-moment/moment.html", "moment", "menubar=no,toolbar=no,resizable=no,status=no,scrollbars=yes,location=no,width=355,height=500");
}
function openContribute() {
	window.open("inc-contribute/contribute.php", "moment", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=770,height=500");
}
function open_news(str) {
	openWin = window.open(str, "openWin","menubar=yes,toolbar=yes,resizable=yes,status=yes,scrollbars=yes,resizable=yes,location=yes,width=800,height=600");
}
function openmedia(str,tpe,hgt) {
	media = window.open("media-platform-open.php?source="+str+"&type="+tpe, "media","menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,width=350,height="+hgt);
}
function openCloseCalls(str) {
	media = window.open(str, "closecalls","menubar=yes,toolbar=yes,resizable=yes,status=yes,scrollbars=yes,resizable=yes,location=yes,width=300,height=200");
}