// preload images, as it helps speed things up. The order of loading doesn't matter much, as they all load pretty much right away
image1 = new Image(405,217); image1.src = "http://www.nativelandz.net/images/slides/native_intro.jpg";
image2 = new Image(405,217); image2.src = "http://www.nativelandz.net/images/slides/native_rwg.jpg";
image3 = new Image(405,217); image3.src = "http://www.nativelandz.net/images/slides/native_eats.jpg";
image4 = new Image(405,217); image4.src = "http://www.nativelandz.net/images/slides/native_library.jpg";
image5 = new Image(405,217); image5.src = "http://www.nativelandz.net/images/slides/native_toolbar.jpg";
image6 = new Image(405,217); image6.src = "http://www.nativelandz.net/images/slides/native_nfn.jpg";
image7 = new Image(405,217); image7.src = "http://www.nativelandz.net/images/slides/native_npu.jpg";
image8 = new Image(405,217); image8.src = "http://www.nativelandz.net/images/slides/native_sis.jpg";
image9 = new Image(405,217); image9.src = "http://www.nativelandz.net/images/slides/native_bro.jpg";
image10 = new Image(405,217); image10.src = "http://www.nativelandz.net/images/slides/native_jobs.jpg";
image11 = new Image(405,217); image11.src = "http://www.nativelandz.net/images/slides/native_nfn2.jpg";
image12 = new Image(405,217); image12.src = "http://www.nativelandz.net/images/slides/native_nfn3.jpg";
image14 = new Image(405,217); image14.src = "http://www.nativelandz.net/images/slides/native_npu2.jpg";
image15 = new Image(405,217); image14.src = "http://www.nativelandz.net/images/slides/native_solu.jpg";



// we can pass in flags on page load to determine how the panels load and behave. this is useful for testing purposes
var qs = new Querystring();
var testingMode = qs.get("testingMode");
//alert('testingMode: '+testingMode);

var panel = new Array();
var panelRepeat = new Array();
var panelTime = new Array();
var panelWeight = new Array(); // not used at present
var idx = -1;  // immediately increments to 0, our first panel ID

/* HOW THIS IS DONE:
	1) The outer DIV sets the location of the background image for the panel, and also the color of unlinked text.
	2) The inner DIV contains, bounds & positions the text and links. Use TOP to push the block down on the panel, and LEFT
		to position from the side. WIDTH defines where lines wrap.
	3) <A> tags (links) contain an attribute to turn off underline and set the color. The color should be the same as
		that provided in the first DIV (for unlinked text)
*/

var intro1 = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_intro.jpg);'>&nbsp;</div>";

var intro2 = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_rwg.jpg);'>\n<div style='width: 142px; position: relative; top: 55px; left: 242px;' align='center'>Riding with Ghosts is a story of struggle and strength, pain and healing. This is a story of the Lakota Nation; straight from the voices of the people on the streets and reservations across South Dakota.\n<a href='http://www.ridingwithghosts.com/' target='_blank'>learn more by visiting the site&nbsp;&raquo;</a></div>";

idx++; // next panel ID
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_eats.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong><a href='http://www.nativelandz.net/mag/' onMouseover='overPanelLink();'>Learn some Real Native Cooking with Nativelandz Resident Fry bread expert Irene. &nbsp;&raquo;</a>\n<br><br><a href='http://www.culturalhoops.com/mag/art_crafts_the_kitchen/' onMouseover='overPanelLink();'>Read Irene's In the Hoop Columns&nbsp;&raquo;</a><br><br><a href='http://www.nativelandz.net/library/native-eats/' onMouseover='overPanelLink();'>Visit Native Eats Library Archives&nbsp;&raquo;</a></strong></div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_library.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong><a href='http://www.nativelandz.net/library/' onMouseover='overPanelLink();'>Visit the Nativelandz Library&nbsp;&raquo;</a>\n<br><br><a href='http://www.nativelandz.net/library/' onMouseover='overPanelLink();'>Read hundreds of Articles from stories, legends to biographies and interesting articles regarding indigenous lifestyles.&nbsp;&raquo;</a><br><br><a href='http://www.nativelandz.net/library/' onMouseover='overPanelLink();'>Visit the Library&nbsp;&raquo;</a></strong></div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_toolbar.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong><a href='http://www.nativelandz.net/toolbar/'>Support Nativelandz Free Tool bar&nbsp;&raquo;</a>\n<br><br><a><a href='http://www.nativelandz.net/toolbar/'> Get the Nativelandz Tool bar and access Nativelandz features quickly & easily!&nbsp;&raquo;</a></strong>\n</div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_nfn.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong><a href='http://www.nativelandz.net/community/'>Native Friends Community&nbsp;&raquo;</a>\n<br><br><a><a href='http://www.nativelandz.net/community/'>Create your own free Friends Network profile, create blogs, your own groups and forums and more. &nbsp;&raquo;</a></strong>\n</div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_rwg.jpg);'>\n<div style='width: 142px; position: relative; top: 55px; left: 242px;' align='center'>Riding with Ghosts is a story of struggle and strength, pain and healing. This is a story of the Lakota Nation; straight from the voices of the people.<br>\n<a href='http://www.ridingwithghosts.com/' target='_blank'>learn more by visiting the site&nbsp;&raquo;</a>\n</div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_npu.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong>Native Parents Uniting</strong>\n<br><br><a href='http://www.nativelandz.net/npu/'>Ask Native Parents for advice!&nbsp;&raquo;</a>\n</div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_sis.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong>The Sisterhood Group!</strong><br> A Group for women of all ages to get together and share experiences.\n<br><br><a href='http://www.nativelandz.net/n_sis' target='_blank'>Click here to Join&nbsp;&raquo;</a>\n</div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_bro.jpg);'>\n<div style='width: 142px; position: relative; top: 30px; left: 230px;'>\n<strong>The Brotherhood Group</strong>\n<br>A group for Men of all ages & Nations to get together and share experiences and Laughs..\n<br><br><a href='http://www.nativelandz.net/n_bro' target='_blank'>Click here to visit group&nbsp;&raquo;</a>\n</div>\n</div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_jobs.jpg);'><div style='width: 142px; position: relative; top: 30px; left: 230px;' align='left'><strong>Looking for work? &nbsp; Need to Employ new people??</strong><br><br><a href='http://www.nativelandz.net/community/'>Post your Employment positions at the Native Friends Network Classifieds for free.&nbsp;&raquo;</a> <br> All Employment ads will be posted throughout Nativelandz and our newsletters for mass views.&nbsp; </div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_nfn2.jpg);'><div style='width: 142px; position: relative; top: 30px; left: 250px;' align='left'><strong> Looking for new Friends??</strong><br><br><a href='http://www.nativelandz.net/community/'>Try the <br>Native Friends Network&nbsp;&raquo;</a></div>";

idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_nfn3.jpg);'><div style='width: 167px; position: relative; top: 30px; left: 237px;' align='left'><strong>Native Friends Network</strong><br><br>Where Natives come Together. <br><br><a href='http://www.nativelandz.net/community/'>Search  NFN Members&nbsp;&raquo;</a></div>";


idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_npu2.jpg);'><div style='width: 167px; position: relative; top: 30px; left: 237px;' align='left'><strong>Want to meet other Native Parents?</strong><br><br>Share your knowledge on parenting with other indigenous parents, or learn different methods and ideas from other parents.<br><br><a href='http://www.nativelandz.net/npu/'>Click here to go to the Native Parents United Network&nbsp;&raquo;</a></div>";


idx++;
panelRepeat[idx] = 'ok-repeat';
panelTime[idx] = 6;
panelWeight[idx] = 1;
panel[idx] = "<div class='panelCarrier' style='background-image: url(http://www.nativelandz.net/images/slides/native_solu.jpg);'><div style='width: 167px; position: relative; top: 10px; left: 225px;' align='left'><strong><a href='http://www.nativelandz.net/webrez/solutions/'>Need Content or Web Applications for your site?</a></strong><br><br>Choose from free and Premium solutions. <br> Get Unique content on your website daily or Advertise on our feeds that are displayed on hundreds of Native website online.<br><br><a href='http://www.nativelandz.net/webrez/solutions/'>To find out how Native Web Solutions can help you click here&nbsp;&raquo;</a></div>";



/******************************************************************************************************
*** DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING. YOU MIGHT BREAK THINGS ***
******************************************************************************************************/

var spotlight = new PanelObj('className:spotlight;panelName:spotlight;panelX:405;panelY:217;transMethod:x-fade;steppingMethod:increment');

// USAGE: arrayKey, time-to-display in seconds, and repeatability
spotlight.addDisplayBlock(intro1,5,'no-repeat');
spotlight.addDisplayBlock(intro2,5,'no-repeat');

spotlight.testingMode = testingMode;

var beenUsed = new Array();
var count = panel.length-1;
var forceAssignmentMethod = 'none'; // sequential or none

if (testingMode || forceAssignmentMethod=='sequential') {
	// always set to sequential for testing
	assignmentMethod = 'sequential';
	idx = 0;
} else {
	// if NOT testing, choose from options: random, sequential
	assignmentMethod = 'random';
}

for (var i=0; i<=count; i++) {
	var stillLooking = true;
	var panelNum;
	while (stillLooking) {
		if (assignmentMethod=='random') { panelNum = Math.floor(Math.random() * (count+1)); }
		if (assignmentMethod=='sequential') { panelNum = idx; idx++; }
		if (panelNum<=count && !beenUsed[panelNum]) {
			stillLooking = false;
			beenUsed[panelNum] = true;
			spotlight.addDisplayBlock(panel[panelNum],panelTime[panelNum],panelRepeat[panelNum]); // 6 sec is normal
		}
	}
}

spotlight.run(6); // first panel time

function nextPanel() { spotlight.nextPanel(); }
function prevPanel() { spotlight.prevPanel(); }
function pausePanel() { spotlight.pausePanel(); }
function resumePanel() { spotlight.resumePanel(); }
function overPanelLink() { spotlight.pausePanel(); }