/* changes cover art on Montecito Magazine home page */

/* randomizer for initial image
var ds = new Date();
var s = ds.getSeconds();
var x = 6; // 1. the number of images
var y = (Math.round(300/x))/10;
var i = Math.round(s/y); // 2. a different integer about every 4 to 5 seconds
var n = (i %x);

delete ds;
delete s;
delete x;
delete y;
delete i; */


/* if the first image is not to be selected at random, set n to 0 */

var n = 0;

var array1 = ['cf0','cf1','cf2','cf3','cf4','cf5','cf0','cf1','cf2','cf3','cf4','cf5']; // 3. div id array with repeat //,'cf6','cf6'
var array2 = [array1[n],array1[n+1],array1[n+2],array1[n+3],array1[n+4],array1[n+5]]; // 4. length = number of images //,array1[n+6]



/* insert images and captions here */

var wh = ' WIDTH="369" HEIGHT="525"';
var image = [
'"covers\/S10-Cover.jpg"' + wh,
'"covers\/F09-Cover.jpg"' + wh,
'"covers\/S09-Cover.jpg"' + wh,
'"covers\/F08-Cover.jpg"' + wh,
'"covers\/S08-Cover.jpg"' + wh,
'"covers\/F07-Cover.jpg"' + wh];

// image[5] = '"covers\/S07-Cover.jpg" WIDTH="369" HEIGHT="525"';
// image[6] = '"covers\/S06-Cover.jpg" WIDTH="369" HEIGHT="525"';
// image[7] = '"covers\/F05-Cover.jpg" WIDTH="342" HEIGHT="525"';
// image[8] = '"covers\/S04-Cover.jpg" WIDTH="333" HEIGHT="525"';

var caption = [
'<B>Spring ~ Summer 2010<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Jeremy Harper<\/SPAN>',
'<B>Fall ~ Winter 2009<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Cathy Quiel<\/SPAN>',
'<B>Spring ~ Summer 2009<\/B><BR><SPAN CLASS="captionR2">Cover Artist: John Iwerks<\/SPAN>',
'<B>Fall ~ Winter 2008<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Chris Chapman<\/SPAN>',
'<B>Spring ~ Summer 2008<\/B><BR><SPAN CLASS="captionR2">Cover Artist: James Dow<\/SPAN>',
'<B>Fall ~ Winter 2007<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Priscilla Fossek<\/SPAN>'];

// caption[5] = '<B>Spring ~ Summer 2007<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Whitney Brooks Hansen<\/SPAN>';
// caption[6] = '<B>Spring ~ Summer 2006<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Ray Hunter<\/SPAN>';
// caption[7] = '<B>Fall ~ Winter 2005<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Ann Sanders<\/SPAN>';
// caption[8] = '<B>Spring ~ Summer 2004<\/B><BR><SPAN CLASS="captionR2">Cover Artist: Whitney Brooks Abbott<\/SPAN>';


var html0 = '<div class="cf_element" id="'; // + cf0 +

var html1 = '"><div class="content">';

var html2 = '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="4" WIDTH="868"><TR><TD ROWSPAN="2" WIDTH="245"><IMG SRC="spacer.gif" WIDTH="237" HEIGHT="1"><\/TD>' +
	'<TD ROWSPAN="2" WIDTH="377" ALIGN="center" VALIGN="top">' +
	'<H1><IMG ALT="Montecito Magazine" SRC='; // + image[0] + 

var html3 = '><\/H1><\/TD>' +
	'<TD WIDTH="246" ALIGN="left" VALIGN="top" STYLE="padding-right:0px; "><P CLASS="captionR" STYLE="margin-top:20px; ">' +
	'<IMG SRC="images\/arrow-left.gif" BORDER="0" WIDTH="15" HEIGHT="15">'; // + caption[0] + 

var html4 = '<\/P>' +
    '<BR><IMG SRC="spacer.gif" WIDTH="238" HEIGHT="1">' +
  '<\/TR><TR><!-- row 2 -->' +
    '<TD VALIGN="bottom">' +
      '&nbsp;<\/TD><\/TR><\/TABLE>';

var html5 = '<\/div><\/div>';



if (cf_okay) { // crossfade slide show

	document.writeln('<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="868" STYLE="padding-bottom:56px; "><TR><TD COLSPAN="2" VALIGN="top" HEIGHT="533">');
	
	document.writeln(html0 + 'cf0' + html1 + html2 + image[0] + html3 + caption[0] + html4 + html5);
	document.writeln(html0 + 'cf1' + html1 + html2 + image[1] + html3 + caption[1] + html4 + html5);
	document.writeln(html0 + 'cf2' + html1 + html2 + image[2] + html3 + caption[2] + html4 + html5);
	document.writeln(html0 + 'cf3' + html1 + html2 + image[3] + html3 + caption[3] + html4 + html5);
	document.writeln(html0 + 'cf4' + html1 + html2 + image[4] + html3 + caption[4] + html4 + html5);
	document.writeln(html0 + 'cf5' + html1 + html2 + image[5] + html3 + caption[5] + html4 + html5);
//	document.writeln(html0 + 'cf6' + html1 + html2 + image[6] + html3 + caption[6] + html4 + html5);
	
	document.writeln('<\/TD><\/TR><\/TABLE>');
	
	var cf = new Crossfader( array2, 800, 5000 ); // (array, cross-fade time, wait time)

} else { // static images

	document.writeln('<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="4" WIDTH="868" STYLE="padding-bottom:56px; "><TR><TD ROWSPAN="2" WIDTH="245"><IMG SRC="spacer.gif" WIDTH="237" HEIGHT="1"><\/TD>' +
	'<TD ROWSPAN="2" WIDTH="377" ALIGN="center" VALIGN="top">' +
	'<H1><IMG ALT="Montecito Magazine" SRC=' + image[0] + html3 + caption[0] + html4);
}
