//RCS $RCSfile: webring1.js,v $ $Revision: 1.54 $ $Date: 2010/07/24 13:32:59 $

// Constructor for a site object in the ring.
function site(entryPage, scriptPage, bgColor, menuColor, titleColor, flag) {
  this.entryPage = entryPage;
  this.scriptPage = scriptPage ? scriptPage : entryPage;
  this.bgColor = bgColor;
  this.menuColor = menuColor;
  this.titleColor = titleColor;
  this.flag = flag;
}

// Potential background colors to cycle through.
background = new Array(
	'silver',  //silver
	'#FFD700', //Gold
	'yellow',  //yellow
	'#FFFFF0', //Ivory
	'#00CED1', //Dark Turqoise
	'#00FA9A', //MedSpringGreen 
	'#F5DEB3', //Wheat
	'#FFDAB9', //PeachPuff1
	'#87CEFF', //SkyBlue1
	'#FFFACD', //LemonChiffon1
	'#CAE1FF', //LightSteelBlue1
	'#7FFFD4', //Aquamarine1
	'#C1FFC1', //DarkSeaGreen1
	'#EEC591'  //Burlywood2
	);

// Sites in the ring.
ring = new Array(
	new site("http://www.bylo.org", null, null, null, null, "ca.gif"),
	new site("http://www.shakesprimer.com/", "http://www.telusplanet.net/public/kbetty/", null, null, null, "ca.gif"),
	new site("http://www.financialwebring.org/gummystuff/index.html", null, null, null, null, "ca.gif"),
	new site("http://www.libra-investments.com/os01.htm", "http://libra-investments.com/os01.htm", null, null, null, "ca.gif"),
	new site("http://www.efficientmarket.ca/", null, "#000080", "white", "white", "ca.gif"),
//	new site("http://www.ndir.com/", null, "#C1FFC1", "#000066", "#000066"),
	new site("http://www.stockchase.com/", null, null, null, null, "ca.gif"),
	new site("http://dripinvesting.org/Research/Research.htm", "http://dripinvesting.org/Research/", null, null, null, "us.gif"),
	new site("http://www.thedividendguyblog.com/", null, null, null, null, "ca.gif"),
	new site("http://www.prefblog.com", null, null, null, null, "ca.gif"),
	new site("http://stripbonds.info", null, null, null, null, "ca.gif"),
	new site("http://www.ellenroseman.com", null, "white", "#CCCC00", "#99CCCC", "ca.gif"),
	new site("http://www.canadianmoneysaver.ca/rc_sites_rrsp.aspx", null, null, null, null, "ca.gif"),
	new site("http://www.travismorien.com/", null, null, null, null, "au.gif"),
	new site("http://themoneygardener.com", null, null, null, null, "ca.gif"),
	new site("http://www.nurseb911.com/", null, null, null, null, "ca.gif"),
	new site("http://canadianfinancialdiy.blogspot.com", null, null, null, null, "ca.gif")
	);

// Find where we are now and set up links forward and back.
for (here = 0; here < ring.length; ++here) {
  if (location.href.indexOf(ring[here].entryPage) >= 0 ||
      location.href.indexOf(ring[here].scriptPage) >= 0)
    break;
}
if (here < ring.length) { // A site not in the ring -> no output

prev = (here == 0) ? ring.length - 1 : here - 1;
next = (here + 1) % ring.length;

// Set colors for menu bar.
bgColor = background[Math.floor(Math.random() * background.length)]; // Random background color
titleColor='red'; //color of Do-It-Yourself title
menuColor='blue'; //color of bottom menu

// Some sites want to force certain colors rather than taking the defaults.
if (ring[here].bgColor) bgColor = ring[here].bgColor;
if (ring[here].menuColor) menuColor = ring[here].menuColor;
if (ring[here].titleColor) titleColor = ring[here].titleColor;

// Default flag is Canadian. Foreign sites use alternate flags.
flag = ring[here].flag;

// Build menu bar in html finally.
output = '';

output += '<table border="2" cellpadding="2" cellspacing="2" bgcolor="white" align="center"><tr><td>';

output += '<table border="0" cellpadding="4" cellspacing="4" width="100%" bgcolor="';

output += bgColor + '" align="center">';

output += '<tr><td nowrap align="center"><font face="Trebuchet MS, Arial" color="';

output += titleColor + '" size="4"><b>&nbsp;&nbsp;&nbsp;Do-It-Yourself Financial Webring';

output += '&nbsp;<img src="http://www.financialwebring.org/gallery/flags/';
output += flag;
output += '">&nbsp;&nbsp;&nbsp;</b></font>';
//width="21" height="10"

output += '</td></tr><tr><td align="center">';

output += '<font face="TimesNewRoman" size="3" color="'+ menuColor + '">&nbsp;&nbsp;&nbsp;[ ';

output += '<a href="' + ring[prev].entryPage + '" TARGET="_top" title="Previous Ring Member"><font size="3" color="'+ menuColor +'">Back</font></A>';

output += ' | ' + '<a href="http://www.financialwebring.org/webmasterFAQ.html" target="_top" title="Apply to join this Webring."><font size="3" color="' + menuColor + '">Join</font></a>';

output += ' | ' + '<a href="http://www.financialwebring.org/forum" target="_top" title="Post your questions or share your thoughts with other Do-It-Yourself Investors."><font size="3" color="' + menuColor + '">Forum</font></a>';

output += ' | ' + '<a href="http://www.financialwebring.org/" target="_top" title="A complete list of all the sites in Do-It-Yourself Investing."><font size="3" color="' + menuColor + '">Featured Sites</font></a>';

output += ' | ' + '<a href="' + ring[next].entryPage + '" target="_top" title="Next Ring Member"><font size="3" color="' + menuColor + '">Forward</font></A>';

output += ' ]&nbsp;&nbsp;&nbsp;</font></td></tr></table>';

output += '</td></tr></table>';

document.write(output);

}
