var g_changeBannerInSeconds = 3;
var g_changeBannerAfterShowingAllImagesTheSameInSeconds = 6;

var probabilityToChangeAllBannerImages = 10; //in percent
var b_previousViewSameImage = true;
var g_currentlySelectedCaption = -1;
var g_numImagesOnHeader=5;

var hashURLInBanner = {}; // create hashtable

// holder class for variables
function URL( imageurl, detailsurl, caption)
{
this.imageurl = imageurl;
this.detailsurl = detailsurl;
this.caption = caption;
}


var myURLs = new Array();
myURLs[0] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/3406541.png', '/pics-sylvia.html', 'From "Sylvia" - Tom and Greg both realize they have gone too far' );
myURLs[1] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/8372751.png', '/pics-sylvia.html', 'From "Sylvia" - Sylvia feeling like a million dollar baby!' );
myURLs[2] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/5690278.png', '/pics-sylvia.html', 'From "Sylvia" - In the croch, right in the croch!' );
myURLs[3] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/9675944.png', '/pics-sylvia.html', 'From "Sylvia" - Phyllis nosing the apartment and the dog' );
myURLs[4] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1256883.png', '/pics-sylvia.html', 'From "Sylvia" - Kate shocked what is really happening in the streets...' );
myURLs[5] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/4123833.png', '/pics-sylvia.html', 'From "Sylvia" - the Cast' );
myURLs[6] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/4622103.png', '/pics-sylvia.html', 'From "Sylvia" - Sylvia hurt from the vet and heart' );
myURLs[7] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/7229894.png', '/pics-sylvia.html', 'From "Sylvia" - Yes I did do that...but not to hurt you...' );
myURLs[8] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/2506056.png', '/pics-sylvia.html', 'From "Sylvia" - Love you Sylvia. Hold it What is that (pee)?' );
myURLs[9] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1821377.png', '/pics-sylvia.html', 'From "Sylvia" - Therapy by a quak!' );

myURLs[10] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/4470365.png', '/pics-woman.html', 'From "Woman"' );
myURLs[11] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/5695687_orig.png', '/pics-woman.html', 'From "Woman"' );
myURLs[12] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/20913.png', '/pics-woman.html', 'From "Woman"' );
myURLs[13] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/8613874.png', '/pics-woman.html', 'From "Woman"' );
myURLs[14] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/7508739.png', '/pics-woman.html', 'From "Woman"' );
myURLs[15] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1274173.png', '/pics-woman.html', 'From "Woman"' );
myURLs[16] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1317992.png', '/pics-woman.html', 'From "Woman"' );
myURLs[17] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/3685196.png', '/pics-woman.html', 'From "Woman"' );
myURLs[18] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/3550365.png', '/pics-woman.html', 'From "Woman"' );
myURLs[19] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1193526.png', '/pics-woman.html', 'From "Woman"' );
myURLs[20] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/591281.png', '/pics-woman.html', 'From "Woman"' );

myURLs[21] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/782271.jpg', '/pics-woman.html', 'From "Twelfth Night"');
myURLs[22] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/6969964.jpg', '/pics-woman.html', 'From "Twelfth Night"');
myURLs[23] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/5456642.jpg', '/pics-woman.html', 'From "Twelfth Night"');
myURLs[24] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/6115634.jpg', '/pics-woman.html', 'From "Twelfth Night"');
myURLs[25] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1515892.jpg', '/pics-woman.html', 'From "Twelfth Night"');


myURLs[26] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/67077.png', '/pics-sylvia.html', 'From "Sylvia" - the dog was there...' );
myURLs[27] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/271351.png', '/pics-sylvia.html', 'From "Sylvia" - I am home!' );
myURLs[28] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/5159803.png', '/pics-sylvia.html', 'From "Sylvia" - Do you really know what it means...' );
myURLs[29] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/8676748.png', '/pics-sylvia.html', 'From "Sylvia" - Look at the size of those balls...' );
myURLs[30] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/6604181.png', '/pics-sylvia.html', 'From "Sylvia" - Triumphant, let the dog stay...' );
myURLs[31] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/2506056.png', '/pics-sylvia.html', 'From "Sylvia" - Love you Sylvia. Hold it What is that (pee)?' );

myURLs[32] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/6369815.png', '/pics-jacques-brel.html', 'From "Jacques Brel" ' );
myURLs[33] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/9328730.png', '/pics-jacques-brel.html', 'From "Jacques Brel" ' );
myURLs[34] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/4106925.png', '/pics-jacques-brel.html', 'From "Jacques Brel" ' );
myURLs[35] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1728104.png', '/pics-jacques-brel.html', 'From "Jacques Brel" ' );
myURLs[36] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/5596156.png', '/pics-jacques-brel.html', 'From "Jacques Brel" ' );
myURLs[37] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/1325594.png', '/pics-jacques-brel.html', 'From "Jacques Brel" ' );

myURLs[38] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/3440619.png', '/pics-a-tuna-christmas.html', 'From "Tuna Christmas"' );
myURLs[39] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/8469707.png', '/pics-a-tuna-christmas.html', 'From "Tuna Christmas"' );
myURLs[40] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/4865531.png', '/pics-a-tuna-christmas.html', 'From "Tuna Christmas"' );
myURLs[41] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/8337923.png', '/pics-a-tuna-christmas.html', 'From "Tuna Christmas"' );
myURLs[42] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/6969134.jpg', '/pics-a-tuna-christmas.html', 'From "Tuna Christmas"' );
myURLs[43] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/9601.jpg', '/pics-a-tuna-christmas.html', 'From "Tuna Christmas"' );


myURLs[44] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/2802571.png', '/pics-fuddy-meers.html', 'From "Fuddy Meers" ' );
myURLs[45] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/7847571.png', '/pics-fuddy-meers.html', 'From "Fuddy Meers" ' );
myURLs[46] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/4112201.png', '/pics-fuddy-meers.html', 'From "Fuddy Meers" ' );
myURLs[47] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/7940286.png', '/pics-fuddy-meers.html', 'From "Fuddy Meers" ' );
myURLs[48] = new URL ( 'http://pointlomaactors.weebly.com/uploads/4/7/6/7/4767427/2176793.png', '/pics-fuddy-meers.html', 'From "Fuddy Meers" ' );


myURLs[49] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/1672392.png', '/pics-steel-magnolias.html', 'From "Steeling Magnolias" ' );
myURLs[50] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/4633435.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[51] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8117350.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[52] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/9584767.jpg', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[53] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/5678684.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[54] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8219273.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[55] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/6449803.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[56] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8403681.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );
myURLs[57] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/3581797.png', '/pics-steel-magnolias.html', 'From "Steel Magnolias" ' );

myURLs[58] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/3759170.jpg', '/pics-the-glass-menagerie.html.html', 'From "Steel Magnolias" ' );
myURLs[59] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8083645.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[60] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/9995336.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[61] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/2630045.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[62] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8044041.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[63] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/1881054.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[64] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8403937.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[65] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/5233488.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );
myURLs[66] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/967043.jpg', '/pics-the-glass-menagerie.html', 'From "Glass Menagerie" ' );


myURLs[67] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/4874391.png', '/pics-driving-miss-daisy.html', 'From "Driving Miss Daisy" ' );
myURLs[68] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/9528907.png', '/pics-driving-miss-daisy.html', 'From "Driving Miss Daisy" ' );
myURLs[69] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/300443.png', '/pics-driving-miss-daisy.html', 'From "Driving Miss Daisy" ' );
myURLs[70] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/2160126.png', '/pics-driving-miss-daisy.html', 'From "Driving Miss Daisy" ' );
myURLs[71] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/4474957.png', '/pics-driving-miss-daisy.html', 'From "Driving Miss Daisy" ' );


myURLs[72] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/517681.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[73] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/3248824.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[74] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/9951586.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[75] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/2868974.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[76] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/2527987.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[77] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/8244154.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[78] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/1875803.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[79] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/6170010.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );
myURLs[80] = new URL ( 'http://www.pointlomaactors.com/uploads/4/7/6/7/4767427/4117090.png', '/pics-only-in-new-york.html', 'From "Only In New York" ' );




function modifyBanner()
{
	var tmpThumbIndex, indexArray;
	
	var bChangedAllBanners = false;
	
	if (b_previousViewSameImage == true) // reset all images
	{
		bChangedAllBanners = false;
		b_previousViewSameImage = false;
		
		for (var ii=2;ii<g_numImagesOnHeader+2;ii++)
		{
			 tmpThumbIndex = document.getElementById('thumb' + parseInt(ii+1));
			 indexArray = Math.floor(Math.random()*myURLs.length);
			 hashURLInBanner[ii] = indexArray;
			 tmpThumbIndex.innerHTML = "<img src='" + myURLs[indexArray].imageurl + "'  class='thumbnailgr'>"; 
		}
	}
	else if (Math.random()*100 <= probabilityToChangeAllBannerImages && b_previousViewSameImage != true) // change all images on banner to the same one!!
	{
		//alert("case2");
		//document.getElementById('captiongr').innerHTML = "case2";
		bChangedAllBanners = true;
		indexArray = Math.floor(Math.random()*myURLs.length);
		b_previousViewSameImage = true;
		
		for (var ii=2;ii<g_numImagesOnHeader+2;ii++)
		{
			 tmpThumbIndex = document.getElementById('thumb' + parseInt(ii+1));
			 hashURLInBanner[ii] = indexArray;
			 tmpThumbIndex.innerHTML = "<img src='" + myURLs[indexArray].imageurl + "'  class='thumbnailgr'>"; 
		}
		
	}
	else // case to make 1 new image
	{
		//alert("case3");
		//document.getElementById('captiongr').innerHTML = "case3";
		bChangedAllBanners = false;
		b_previousViewSameImage = false;
		var tmpNum =  2+Math.floor(Math.random()*g_numImagesOnHeader)+1;
		var tmpThumbIndex = document.getElementById('thumb' + tmpNum); // g_numImagesOnHeader images across
		
		indexArray = Math.floor(Math.random()*myURLs.length);
		hashURLInBanner[tmpNum-1] = indexArray;
		tmpThumbIndex.innerHTML = "<img src='" + myURLs[indexArray].imageurl + "'  class='thumbnailgr'>"; 
	}
	
	if (g_currentlySelectedCaption != -1)
	{
		highlightgr(g_currentlySelectedCaption);
	}
	
	if (bChangedAllBanners == false)
		var tmpTimer = setTimeout("modifyBanner()",g_changeBannerInSeconds*1000);
	else
		var tmpTimer = setTimeout("modifyBanner()",g_changeBannerAfterShowingAllImagesTheSameInSeconds*1000);
	
	
}

function openThumb(thumbIndex)
{
	window.location.href = myURLs[hashURLInBanner[thumbIndex-1]].detailsurl; // Caution - Read on before using this.
}

function highlightgr(thumbIndex)
{
	g_currentlySelectedCaption = thumbIndex;
	var tmpCaptionDiv = document.getElementById('captiongr');
	tmpCaptionDiv.innerHTML = myURLs[hashURLInBanner[thumbIndex-1]].caption;
	var tmpUnderline = document.getElementById('underline'+thumbIndex);
	tmpUnderline.className = "underlinegr";
}

function unhighlightgr(thumbIndex)
{
	g_currentlySelectedCaption = -1;
	var tmpCaptionDiv = document.getElementById('captiongr');
	tmpCaptionDiv.innerHTML = "&nbsp;";
	var tmpUnderline = document.getElementById('underline'+thumbIndex);
	tmpUnderline.className = "nounderlinegr";
}
