
//*
//* To add any ad, you must supply all three, featureImage, featureStory, and featureMore.
//*
var adMore  = new Array(	
// #1
"&nbsp;&nbsp;",
// #2
"&nbsp;&nbsp;",
// #3
"&nbsp;&nbsp;",
/// #4
"&nbsp;"
);

var adStory  = new Array(
// #1
"&nbsp;&nbsp;",
// #2
"&nbsp;&nbsp;",
// #3
"&nbsp;&nbsp;",
/// #4
"&nbsp;"
);
									
var adImage    = new Array(	
// #1
"<a href=http://www.law.unc.edu/><img src=/olc/images/UNOL/alumni1.jpg border=0></a><br>",
// #2
"<a href=http://www.law.unc.edu/ ><img src=/olc/images/UNOL/alumni2.jpg border=0></a><br>",
// #3
"<a href=http://www.law.unc.edu/><img src=/olc/images/UNOL/alumni3.jpg border=0></a><br>",
// #4
"<a href=http://www.law.unc.edu/><img src=/olc/images/UNOL/alumni4.jpg border=0></a><br>"
);
								

									
//---------------------- DO NOT MODIFY BELOW THIS LINE ---------------------------------------//
var gl_quote 	= '';
var gl_dash	 	= '';
var gl_newline = ''; 
var gl_empty 	= '&nbsp;';
var gl_max_tries = 5;
									
									
function writeAd()
{
	var tmpQuote;
	var tmpAuthor;
	var tmpSchool;
	var tmpBuff;
	var theDate;
	var seconds;
	var attempts = 0;
	var msgCount;
	
	msgCount = getArrayFillLength( adImage ); 

	if( msgCount == 0 )
	{
		document.write( gl_newline + gl_empty + gl_newline );
		return( false );
	}
	
	msgCount--; //modulus is zero based

	for( i=0; i < gl_max_tries; i++ )
	{
		theDate = new Date();
		index = theDate.getSeconds() % 5;
		
//		alert( "for i=" + i + "::Seconds=" + theDate.getSeconds()+ "::msgCount=" + msgCount +  "::index=" + index );
		
		if( index <= msgCount )
		{
			theDate = null;
			break;
		}
		theDate = null;
	}


	
	if( i == gl_max_tries )
	{
		index = 0;
	}
	tmpQuote	 = adImage[index];
	tmpAuthor = adStory[index];
	tmpSchool = adMore[index];

	if( tmpQuote == "" )
	{
		document.write( gl_newline + gl_empty + gl_newline );
		return false;
	}
	if( tmpAuthor == "" )
	{
		tmpAuthor = gl_empty;
	}
	if( tmpSchool == "" )
	{
		tmpSchool = gl_empty;
	}	
	tmpBuff = gl_quote + tmpQuote + gl_quote + 
	          gl_newline + gl_newline + gl_dash + 
				 tmpAuthor + gl_newline + tmpSchool +
				 gl_newline;
	document.write( tmpBuff );		
 	return true;
}

function getArrayFillLength( this_array )
{
	var count = 0;
	
	for( count=0;  count < this_array.length; count++ )
	{
		if( this_array[count] == "" )
		{
			break;
		}
	}
	return( count );	
}

