//
// File: olc_rotate.js
// Version 1.0
//

//---------------------- MODIFY BELOW THIS LINE ---------------------------------------//

//setInterval("run_it()", 10000);


var imageText2  = new Array(	
"",
"",
"",
"",
"",
"",
"",
"",
"",
"" );

var linkUrl  = new Array(	
"",
"",
"",
"",
"",
"",
"",
"",
"",
"" );

var linkText  = new Array(	
"",
"",
"",
"",
"",
"",
"",
"",
"",
"" );



var otherHtml = new  Array(
//0
'		<div id="featalumni" style="width: 160px; float: right; margin: 0 0 10px 20px; padding: 0px; background-color: #ccc;"><a href="/olc/pub/CPN/featured/featured_alumni28.html"><img src="/olc/images/CPN/featalumni_hd.gif" width="160px" height="20px" border="0" /></a>',
//1
'		<div id="featalumni" style="width: 160px; float: right; margin: 0 0 10px 20px; padding: 0px; background-color: #ccc;"><a href="/olc/pub/CPN/featured/featured_alumni28.html"><img src="/olc/images/CPN/featalumni_hd.gif" width="160px" height="20px" border="0" /></a>',
//2
'		<div id="featalumni" style="width: 160px; float: right; margin: 0 0 10px 20px; padding: 0px; background-color: #ccc;"><a href="/olc/pub/CPN/featured/featured_alumni28.html"><img src="/olc/images/CPN/featalumni_hd.gif" width="160px" height="20px" border="0" /></a>'
//0
		
);



var hackHtml = new  Array(
//0
'<a href="/olc/pub/CPN/featured/featured_alumni28.html" style="color: #777;"><img src="/olc/images/CPN/featured11/leodrew.jpg" width="160" height="207" alt="Leonardo Drew" border="0" style="border-top: 1px solid #fff; border-bottom: 1px solid #fff;" /></a><p style="font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 10px; font-weight: bold; margin: 6px 6px 8px 8px; padding: 0;"><a href="/olc/pub/CPN/featured/featured_alumni28.html" style="color: #777;"><br>President\'s Citation: Art<br>Leonardo Drew (A 85) </a></p>',
//1
'<a href="/olc/pub/CPN/featured/featured_alumni28.html" style="color: #777;"><img src="/olc/images/CPN/featured11/shigeruban.jpg" width="160" height="207" alt="Shigeru Ban" border="0" style="border-top: 1px solid #fff; border-bottom: 1px solid #fff;" /></a><p style="font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 10px; font-weight: bold; margin: 6px 6px 8px 8px; padding: 0;"><a href="/olc/pub/CPN/featured/featured_alumni28.html" style="color: #777;"><br>JPresident\'s Citation: Architecture<br>Shigeru Ban (AR 84) </a></p>',
//2
'<a href="/olc/pub/CPN/featured/featured_alumni28.html" style="color: #777;"><img src="/olc/images/CPN/featured11/rbrookmeyer.jpg" width="160" height="207" alt="Ronald Brookmeyer" border="0" style="border-top: 1px solid #fff; border-bottom: 1px solid #fff;" /></a><p style="font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 10px; font-weight: bold; margin: 6px 6px 8px 8px; padding: 0;"><a href="/olc/pub/CPN/featured/featured_alumni28.html" style="color: #777;">President\'s Citation: Engineering<br>Ronald Brookmeyer (E 75) </a></p>'

);



var cnf_filename_creation = 0;
//0 - dynamic based on cnf
//1 - static from array
var cnf_total_images	= 3;
var cnf_default_index 	= 0;
var cnf_start_index 	= 0;
var cnf_max_tries 		= 50;
var cnf_rotate_type		= 0;
//0 - random
//1 - sequencial
//2 - ordered
var cnf_code_type		= 0;
//0 - custom display
//1 - image display only
//2 - image display with link
var cnf_image_path   = '/olc/images/CPN/featured/';
var cnf_link_path   = '/olc/pub/CPN/featured/';
var cnf_filename_prefix = 'featured_alumni';

var rotate_count	= 0;
var html_image      =  '<img src=_%_ alt=_%_ style=border-top: 1px solid #fff; border-bottom: 1px solid #fff; >';
var html_link       =  '<a href=_%_ alt=_%_ style=color: #777;>';
var html_link_openw =  '<a href=# onClick=openWindow("_%_")>';
var html_delimeter  = '_%_'
var html_image_suffix= '.jpg';
var html_link_suffix = '.html';	
//---------------------- DO NOT MODIFY BELOW THIS LINE ---------------------------------------//

function run_it()
{
	alert( "hi" );

}


function getRandomNumber10()
{
	theDate = new Date();
	random_number = theDate.getSeconds() % 10;
	return random_number;
}


function createImageHtml( index )
{
	var tmp;
	var tmp_num = '0' + (index+1);
	
	parts = html_image.split( html_delimeter );	

	if( cnf_filename_creation == 0 )
	{
		tmp = parts[0] + cnf_image_path + cnf_filename_prefix + tmp_num + html_image_suffix;
		tmp += parts[1];
		tmp += imageText2[index + 1];
		tmp += parts[2];
	}	
	else
	{
		tmp = parts[0] + cnf_image_path + imageName[index];
		tmp += parts[1];
		tmp += imageText2[index + 1];
		tmp += parts[2];	
	}
	
	return tmp;
}


function createLinkHtml( index )
{
	var tmp;
	var tmp_num = '0' + (index+1);

	parts = html_link.split( html_delimeter );	
	
	if( cnf_filename_creation == 0 )
	{
		tmp = parts[0] + cnf_link_path + cnf_filename_prefix + tmp_num + html_link_suffix;
		tmp += parts[1];
		tmp += linkText[index + 1];
		tmp += parts[2];
	}
	else
	{
		tmp = parts[0] + cnf_link_url[index];
		tmp += parts[1];
		tmp += linkText[index + 1];
		tmp += parts[2];
	}
	
	return tmp;
}

function writeRotateHtml()
{
	var mine = 0;
	var my_index = 0;
	var html_image = '';
	var html_link = '';
	var who;
	
	for( i=0; i < cnf_max_tries; i++ )	
	{
		my_index = getRandomNumber10();
		if( my_index < cnf_total_images )
		{
			break;
		}
	}
	
	if( ( i >= cnf_max_tries ) && 
	    ( my_index >= cnf_total_images ) )
	{	
		my_index = cnf_default_index;
	}
	
	who = otherHtml[0] + html_link + html_image + '</a>' + 
	      html_link + otherHtml[1] + 
		  linkText[my_index+1] + '</a>' + 
		  otherHtml[2];
		  
	document.write( otherHtml[my_index] );		
	document.write( hackHtml[my_index] );
	document.write( '</div>' );	
	
	return true;
}



