function goAnim(waitForAnimatedGif) {
	if (welcome) {
		welcome = false;
		if (waitForAnimatedGif) { 
			setTimeout("playRotate(1);",100);									
		} else {
			playRotate(0);
		}
	}
}
function playRotate(animateMain) {
  setTimeout("rotateHouston();", 2000);
	setTimeout("rotateImages();", 2000);
  setTimeout("goTicker();",  7500);
//	rotateHeadlines();
//	rotateCaptions();
}
function makeVisible(name) {
	document.getElementById(name).style.visibility = 'visible';
}
// assumes arrays have been built in random order
qImg = 0;
function rotateHouston() {
	if (qImg >= dhouston.length) qImg = 0;
	document.images["houstonImg"].src = dhouston[qImg];
	qImg++;
	// random 0-15secs + 30secs == random between 30-45 secs
	setTimeout("rotateHouston();",  Math.floor(Math.random()*15000) +30000);   
}
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] = "#03050F";
colors[13] = "#090D20";
colors[12] = "#131834";
colors[11] = "#20264B";
colors[10] = "#2F3760";
colors[9] = "#404773";
colors[8] = "#545C8A";
colors[7] = "#6A729E";
colors[6] = "#7E86AF";
colors[5] = "#999FC1";
colors[4] = "#B3B7D2";
colors[3] = "#C7CBDF";
colors[2] = "#E1E3EC";
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(elec) {
  if (!elec) {
	window.open("image-platform.php?group=elecall", "imageplatform", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=no,location=no,width=840,height=360");
  }
	else {
	window.open("image-platform.php?group=elec", "imageplatform", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=no,location=no,width=840,height=360");
  }

}
function openPage2index(all) {
  if (!all) {
	window.open("inc-page2/page2index.php", "Page2index", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=270,height=540,screenX=1200,left=800");
  }
	else {
	window.open("inc-page2/page2index.php?view="+all, "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=yes,status=no,scrollbars=yes,location=no,width=400,height=400");
}
function openContribute($post, $thread) {
  if (!$post) {
	window.open("inc-contribute/contribute.php", "contribute", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=780,height=550");
  }
	else {
	window.open("inc-contribute/contribute.php?postid="+$post+"&threadid="+$thread, "contribute", "menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=780,height=550");
  }
}
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");
}
function showLogin() {
   document.getElementById('login-a').style.visibility = "visible";
	 document.getElementById('login-b').style.visibility = "visible";
	 document.getElementById('leftBottom').style.visibility = "visible";
	 document.getElementById('showLogin').style.visibility = "hidden";
}