var scroll_messages = new Array();
scroll_messages[0] = '<a href="../../html/news/highbridge.shtml"><br><b>Highbridge Opens New Facility in the Bronx</b><br>A new state-of-the-art center for health careers training and adult education programs</a>';
scroll_messages[1] = '<a href="../../html/news/tamara.shtml"><br><b>New York Times ESOL Teacher of the Year <br>Tamara Kirson</b><br>A world traveler helping her adult students rise to the challenge</a>';
scroll_messages[2] = '<a href="http://www.nycgovparks.org"><br><b>Civic Venture\'s Purpose Prize Winner <br>Mark Goldsmith</b><br>An extraordinary social innovator who is cutting recidivism rates of 18- to 24-year-olds on Rikers Island</a>';
scroll_messages[3] = '<a href="../../html/news/peter.shtml"><br><b>CUNY Peter Jennings Laurel Award Scholarships</b><br>Recognizing exemplary GED graduates overcoming hardships and advancing into CUNY colleges</a>';
scroll_messages[4] = '<a href="../../html/news/ibm.shtml"><br><b>IBM Reading Companion Program</b><br>Using innovative web-based speech-recognition technology to help adults improve their literacy skills</a>';
scroll_messages[5] = '<a href="../../html/news/laguardia.shtml"><br><b>LaGuardia GED Bridge Program Student Recognition Ceremony</b><br>Bridging the gap between the GED and successful careers in healthcare</a>';
scroll_messages[6] = '<a href="../../html/news/nyu.shtml"><br><b>NYU Gallatin School of Individualized Study Literacy Project</b><br>Increasing literacy skills, introducing new teaching methodologies, and celebrating newly published writers from the NYC adult learning community</a>';
scroll_messages[7] = '<a href="../../html/news/symphony.shtml"><br><b>Symphony Space, All Write! Program</b><br>Spellbinding short stories and poetry reflecting the cultural heritage and strong sense of family and community of adult learners from across the City</a>';

var scrollerdelay=4000; //delay between msg scrolls. 3000=3 seconds.
var scrollspeed=50;
var scrollerwidth='350px'
var scrollerheight='100px'

///////Do not edit pass this line///////////////////////
// some new variables
var scroll_running = 0;
var scroll_stopped = 0;
var scroll_stopCompleted = 0;
var scroll_scrollForward = 1;
var scroll_topLayer;
var scroll_bottomLayer;
var scroll_i=2;

function scroll_move1(whichdiv){
	scroll_tdiv=eval(whichdiv)
	if (parseInt(scroll_tdiv.style.top)>0&&parseInt(scroll_tdiv.style.top)<=5){
		scroll_tdiv.style.top=0+"px"
		if (scroll_stopped == 1) {scroll_switchButton(1); return;}
		setTimeout("scroll_move1(scroll_tdiv)",scrollerdelay)
		setTimeout("scroll_move2(scroll_second_obj)",scrollerdelay)
		return
	}
	if (parseInt(scroll_tdiv.style.top)>=scroll_tdiv.offsetHeight*-1){
		if (scroll_stopped == 1 && parseInt(scroll_tdiv.style.top) == 0) {scroll_switchButton(1); return;}
		if (scroll_stopped == 1 && parseInt(scroll_tdiv.style.top) == parseInt(scrollerheight)) {scroll_switchButton(1); return;}
		scroll_tdiv.style.top=parseInt(scroll_tdiv.style.top)-5+"px"
		setTimeout("scroll_move1(scroll_tdiv)",scrollspeed)
	}
	else{
		scroll_tdiv.style.top=parseInt(scrollerheight)
		scroll_tdiv.innerHTML=scroll_messages[scroll_i]
		scroll_itemStatus();
		if (scroll_i==scroll_messages.length-1)
			scroll_i=0
		else
			scroll_i++
	}
}

function scroll_move2(whichdiv){
	scroll_tdiv2=eval(whichdiv)
	if (parseInt(scroll_tdiv2.style.top)>0&&parseInt(scroll_tdiv2.style.top)<=5){
		scroll_tdiv2.style.top=0+"px"
		if (scroll_stopped == 1) {scroll_switchButton(1); return;}
		setTimeout("scroll_move2(scroll_tdiv2)",scrollerdelay)
		setTimeout("scroll_move1(scroll_first_obj)",scrollerdelay)
		return
	}
	if (parseInt(scroll_tdiv2.style.top)>=scroll_tdiv2.offsetHeight*-1){
		if (scroll_stopped == 1 && parseInt(scroll_tdiv2.style.top) == 0) {scroll_switchButton(1); return;}
		if (scroll_stopped == 1 && parseInt(scroll_tdiv2.style.top) == parseInt(scrollerheight)) {scroll_switchButton(1); return;}
		scroll_tdiv2.style.top=parseInt(scroll_tdiv2.style.top)-5+"px"
		setTimeout("scroll_move2(scroll_second_obj)",scrollspeed)
	}
	else{
		scroll_tdiv2.style.top=parseInt(scrollerheight)
		scroll_tdiv2.innerHTML=scroll_messages[scroll_i]
		scroll_itemStatus();
		if (scroll_i==scroll_messages.length-1)
			scroll_i=0
		else
			scroll_i++
	}
}

function startscroll(){
	// make sure function doesn't fun twice
	if (scroll_running != 0)
		return

	scroll_running++
	scroll_first_obj=document.getElementById("scroll_first")
	scroll_second_obj=document.getElementById("scroll_second")
	scroll_move1(scroll_first_obj)
	scroll_second_obj.style.top=scrollerheight
	scroll_second_obj.style.visibility='visible'
	scroll_switchButton(0);
	document.getElementById("scroll_itemStatus").innerHTML = '1 of ' + scroll_messages.length;
}

function scroll_itemStatus() {
	document.getElementById("scroll_itemStatus").innerHTML = (scroll_i==0?scroll_messages.length:scroll_i) + ' of ' + scroll_messages.length ;
}

function stopScroll() {
	scroll_stopped = 1;
	scroll_switchButton(2);
}

function restartScroll() {
	if (scroll_stopped == 0 ) {return;}
	scroll_stopped = 0;
	if (scroll_scrollForward == 0) {
		if (scroll_i==scroll_messages.length-1) {
			scroll_i=1;
		} else if (i==scroll_messages.length-2) {
			scroll_i=0;
		} else {
			scroll_i=scroll_i+2
		}
	}
	
	setTimeout("scroll_move1(scroll_first_obj)",scrollerdelay);
	setTimeout("scroll_move2(scroll_second_obj)",scrollerdelay);
	
	scroll_switchButton(0);
	scroll_scrollForward = 1;
	scroll_stopCompleted = 0;
}

function scroll_switchButton(what) {
	if (what==0) {
		document.getElementById("scroll_startstop").innerHTML = '<a href="javascript:stopScroll();"><img src="../../includes/site_images/misc/nycrw_hold.gif" namd="nycrw_hold" border="0" align="middle" width="35" height="12" alt="Pause Scroll" onMouseOver="scrollIconSwap(\'nycrw_hold\',this,0);" onMouseOut="scrollIconSwap(\'nycrw_hold\',this,1);"></a>';
		document.getElementById("scroll_nextbutton").innerHTML = '<a href="javascript:nextScroll();"><img src="../../includes/site_images/misc/nycrw_forward.gif" name="nycrw_forward" border="0" align="absmiddle" width="16" height="12" alt="Next Item" onMouseOver="scrollIconSwap(\'nycrw_forward\',this,0);" onMouseOut="scrollIconSwap(\'nycrw_forward\',this,1);"></a>';
		document.getElementById("scroll_backbutton").innerHTML = '<a href="javascript:backScroll();"><img src="../../includes/site_images/misc/nycrw_back.gif" name="nycrw_back" border="0" align="absmiddle" width="16" height="12" alt="Previous Item" onMouseOver="scrollIconSwap(\'nycrw_back\',this,0);" onMouseOut="scrollIconSwap(\'nycrw_back\',this,1);"></a>';
	} else if (what==1) {
		first2_top=parseInt(document.getElementById("scroll_first").style.top)
		second2_top=parseInt(document.getElementById("scroll_second").style.top)
		if ((first2_top != 0 && first2_top != parseInt(scrollerheight)) || (second2_top != 0 && second2_top != parseInt(scrollerheight))) {
	
			setTimeout("scroll_switchButton(1)",50)
			return;
		}
		document.getElementById("scroll_startstop").innerHTML = '<a href="javascript:restartScroll();"><img src="../../includes/site_images/misc/nycrw_scroll.gif" name="nycrw_scroll" border="0" align="middle" width="35" height="12" alt="Resume Scroll" onMouseOver="scrollIconSwap(\'nycrw_scroll\',this,0);" onMouseOut="scrollIconSwap(\'nycrw_scroll\',this,1);"></a>';
		document.getElementById("scroll_nextbutton").innerHTML = '<a href="javascript:nextScroll();"><img src="../../includes/site_images/misc/nycrw_forward.gif" name="nycrw_forward" border="0" align="absmiddle" width="16" height="12" alt="Next Item" onMouseOver="scrollIconSwap(\'nycrw_forward\',this,0);" onMouseOut="scrollIconSwap(\'nycrw_forward\',this,1);"></a>';
		document.getElementById("scroll_backbutton").innerHTML = '<a href="javascript:backScroll();"><img src="../../includes/site_images/misc/nycrw_back.gif" name="nycrw_back" border="0" align="absmiddle" width="16" height="12" alt="Previous Item" onMouseOver="scrollIconSwap(\'nycrw_back\',this,0);" onMouseOut="scrollIconSwap(\'nycrw_back\',this,1);"></a>';
		scroll_stopCompleted = 1;
	} else if (what==2) {
		document.getElementById("scroll_startstop").innerHTML = '<img src="../../includes/site_images/misc/nycrw_wait.gif" border="0" align="middle" width="35" height="12" alt="Please Wait...">';
		document.getElementById("scroll_nextbutton").innerHTML = '<img src="../../includes/site_images/misc/nycrw_forward.gif" name="nycrw_forward" border="0" align="absmiddle" width="16" height="12" alt="Next Item">';
		document.getElementById("scroll_backbutton").innerHTML = '<img src="../../includes/site_images/misc/nycrw_back.gif" name="nycrw_back" border="0" align="absmiddle" width="16" height="12" alt="Previous Item">';
	}
}

function scrollIconSwap(iconImg, what, which) {
	var imgPath = "../../includes/site_images/misc/";
	if (which == 0) {
		what.src = imgPath + iconImg + "_over.gif";
	} else {
		what.src = imgPath + iconImg + ".gif";
	}
}

function nextScroll() {
	if (scroll_stopped == 0) {	stopScroll(); }
	if (scroll_stopCompleted == 0) {
		setTimeout("nextScroll()",scrollspeed)
		return;
	}
	if (parseInt(document.getElementById("scroll_first").style.top)==0) {
		scroll_topLayer = document.getElementById("scroll_first");
		scroll_bottomLayer = document.getElementById("scroll_second");
	} else {
		scroll_bottomLayer = document.getElementById("scroll_first");
		scroll_topLayer = document.getElementById("scroll_second");
	}
	if (scroll_scrollForward == 0) {
		if (scroll_i==scroll_messages.length-1) {
			scroll_i=1;
		} else if (scroll_i==scroll_messages.length-2) {
			scroll_i=0;
		} else {
			scroll_i=scroll_i+2
		}
	}
	eval(scroll_topLayer).innerHTML = (scroll_i==0?scroll_messages[scroll_messages.length-1]:scroll_messages[scroll_i-1]);
	eval(scroll_bottomLayer).innerHTML = scroll_messages[scroll_i];
	scroll_itemStatus();
	scroll_scrollForward = 1;
	if (scroll_i==scroll_messages.length-1) {
		scroll_i=0;
	} else {
		scroll_i++;
	}
}

function backScroll() {
	if (scroll_stopped == 0) {	stopScroll(); }
	if (scroll_stopCompleted == 0) {
		setTimeout("backScroll()",scrollspeed)
		return;
	}
	if (parseInt(document.getElementById("scroll_first").style.top)==0) {
		scroll_topLayer = document.getElementById("scroll_first");
		scroll_bottomLayer = document.getElementById("scroll_second");
	} else {
		scroll_bottomLayer = document.getElementById("scroll_first");
		scroll_topLayer = document.getElementById("scroll_second");
	}
	if (scroll_scrollForward == 1) {
		if (scroll_i==0) {
			scroll_i=scroll_messages.length-2;
		} else if (scroll_i==1) {
			scroll_i=scroll_messages.length-1;
		} else {
			scroll_i=scroll_i-2
		}
	}
	eval(scroll_topLayer).innerHTML = (scroll_i==0?scroll_messages[scroll_messages.length-1]:scroll_messages[scroll_i-1]);
	eval(scroll_bottomLayer).innerHTML = scroll_messages[scroll_i];
	scroll_itemStatus();
	scroll_scrollForward = 0;
	if (scroll_i==0) {
		scroll_i=scroll_messages.length-1;
	} else {
		scroll_i--;
	}
}

document.writeln('<div id="main" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="scroll_first" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">')
document.write(scroll_messages[0])
document.writeln('</div>')
document.writeln('<div id="scroll_second" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">')
if(scroll_messages.length==1){
	document.write(scroll_messages[0])
}else{
	document.write(scroll_messages[1])
}
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')

function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		window.onload = func; 
	} else { 
		window.onload = function() { 
			if (oldonload) { 
				oldonload(); 
			} 
			func(); 
		} 
	} 
} 
addLoadEvent(startscroll);