/*
'****************************************************************************************
'**  Copyright Notice
'**  http://www.sagecomputerservices.com
'**
'**  Copyright 2007-2008 Sage Computer Services. All Rights Reserved.
'**
'**  This program is commercial proprietary software and may not be modified or distributed 
'**  either privately or commercially except under the terms of the License that accompanies 
'**  this software.
'**
'**  All copyright notices must remain intact in all scripts.
'**
'**  You may not redistribute, repackage, or sell the whole or any part of this program even
'**  if it is modified or reverse engineered in whole or in part without express
'**  permission from the author.
'**
'**  This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
'**  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED.
'**
'**  Sage Computer Services
'**  http://www.sagecomputerservices.com
'**  sage@sagecomputerservices.com
'**
'****************************************************************************************     
*/      

// (C) 2002 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header.
// ==============================
// Set the following variables...
// ==============================
var g_nHomepageImageRotateEverySeconds = 15;
// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 1;

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = (g_nHomepageImageRotateEverySeconds * 1000);


var Picture = new Array(); // don't change this
var Quote = new Array(); // don't change this
var QuoteAttribute = new Array(); // don't change this
var LeadIn = new Array(); // don't change this
var LinkText = new Array(); // don't change this
var LinkAddress = new Array(); // don't change this

/*for (var picIndex=1; picIndex < (g_nHomepageRotationItems+1); picIndex++)
{
	Picture[picIndex]  = sBaseSite + 'images/home/rotate/es/home_' + picIndex.toString() + '.jpg';
	Caption[picIndex]  = '';
}*/
var g_nHomepageRotationItems = 3;

Picture[1]  = '/graphics/home/rotation/ferley.jpg';
Quote[1]  = "We know how to address this, and it is within our reach. And we can truly be the cause of change and be the first generation in human history to bring education to all children everywhere so no child is left behind.";
QuoteAttribute[1]  = "Shakira";
LeadIn[1]  = "Ferley didn't think he'd ever get to go to school. His thin frame is shrunken by congenital rickets, making him look closer to six than to his eleven years...";
LinkText[1]  = "Read Ferley's entire story >";
LinkAddress[1]  = "pages/whatwedo/whatwedo_success_stories_en.php#ferley";

Picture[2]  = '/graphics/home/rotation/jhonathan.jpg';
Quote[2]  = "It is so important because it addresses about every aspect of development...Education can really save lives. Education is the key.";
QuoteAttribute[2]  = "Shakira";
LeadIn[2]  = "Jhonathan wants to clean up Altos de Cazucá. The 17 year old environmental biology major at Jorge Tadeo Lozano University knows only too well the pollution that plagues this poor area south of Bogotá. With the Foundation's support, Jhonathan scored among the highest students in the country on the high school exit exams.";
LinkText[2]  = "Read Jhonathan's entire story >";
LinkAddress[2]  = "pages/whatwedo/whatwedo_success_stories_en.php#jhonathan";

//Picture[3]  = '/graphics/home/rotation/wilson.jpg';
//Quote[3]  = "Investing in children is investing in our future and investing in a safer world for all of us.";
//QuoteAttribute[3]  = "Shakira";
//LeadIn[3]  = "Wilson is a smiling, rambunctious nine year-old from Altos de Cazucá, Colombia. He is a fourth grader at a Pies Descalzos Foundation school. \"I love to go to school because I like to learn and because the teachers know me and care about me!\"";
//LinkText[3]  = "Read Wilson's entire story >";
//LinkAddress[3]  = "pages/whatwedo/whatwedo_success_stories_en.php#wilson";

// =====================================
// Do not edit anything below this line!
// =====================================

var tss;
var iss;
var jss = 1;  // satrting image number
var pss = Picture.length-1;
var preLoad=null;

// Were there any pictures?
if (pss >= 0)
{
	preLoad = new Array();
	for (iss = 1; iss < pss+1; iss++)
	{
		preLoad[iss] = new Image();
		preLoad[iss].src = Picture[iss];
	}
}
// =====================================
// RotateItems
// =====================================
function RotateItems()
{
	/*
	if (g_bFirst)
	{
		g_bFirst=false;
		setTimeout('RotateItems()', SlideShowSpeed);
		return;
	}
	*/
	
	// no pictures defined in the database
	if (preLoad==null) 
	{
		return;
	}
	
	//************ Rotate the Main Image ******************
	if ((document.all) && (!IsOpera()))
	{
		document.images.PictureBox.style.filter="blendTrans(duration=" + CrossFadeDuration.toString() + ")";
		document.images.PictureBox.filters.blendTrans.Apply();
	}
	document.images.PictureBox.src = preLoad[jss].src;
	if ((document.all) && (!IsOpera())) document.images.PictureBox.filters.blendTrans.Play();
	
	//************ Rotate the Quote and Attribute
	var objFact = MM_findObj("homeimagequote");
	if (objFact != null)
	{
		if ((document.all) && (!IsOpera()))
		{
			//objFact.style.filter="blendTrans(duration=" + CrossFadeDuration.toString() + ")";
			//objFact.filters.blendTrans.Apply()
		}
		
		// set up the attributed name. the dash character is the &#8211;
		var sAttributed = QuoteAttribute[jss];
		var sQuote = Quote[jss];
		
		// if a quote attribute was given, wrap it in our display class
		if (sAttributed.length > 0) 
		{
			sAttributed = "<div class='homeimageattr'> &#8211; " + sAttributed + "</div>";
			sQuote += sAttributed;
		}
		
		objFact.innerHTML = sQuote;
		//if ((document.all) && (!IsOpera())) objFact.filters.blendTrans.Play();
		objfact=null;
	}
	
	//*********** Rotate the leadin and the link to the full story
	// <div class="homeimagestorylink"><span class="readmore"><a  href="pages/whatwedo/whatwedo_success_stories_en.php#ferley">Read Wilson's entire story &gt;</a></span></div>
	var objLeadIn = MM_findObj("homeimagestorynew");
	if (objLeadIn != null)
	{
		if ((document.all) && (!IsOpera()))
		{
			//objLeadIn.style.filter="blendTrans(duration=" + CrossFadeDuration.toString() + ")";
			//objLeadIn.filters.blendTrans.Apply()
		}
		
		// set up the Leadin, link text and link address
		var sLeadIn = LeadIn[jss];
		var sLinkText = LinkText[jss];
		var sLinkAddress = LinkAddress[jss];
		var sLink = "";
		
		// if a sLinkText and sLinkAddress attributes were given, wrap them in our display class
		if ((sLinkText.length > 0) && (sLinkAddress.length > 0))
		{
			sLink = "<div class='homeimagestorylink'><span class='readmore'><a href='" + sLinkAddress + "'>" + sLinkText + "</a></span></div>";
			sLeadIn += sLink;
		}
		
		objLeadIn.innerHTML = sLeadIn;
		//if ((document.all) && (!IsOpera())) objLeadIn.filters.blendTrans.Play();
		objLeadIn=null;
	}


	//*******************************
	// Set up for next display
	jss = jss + 1;
	if (jss > (pss)) jss=1;
	tss = setTimeout('RotateItems()', SlideShowSpeed);
}

//****************************************************************************************************
// run the slideshow
	RotateItems();

