function createArray()
{
	i = 0;

	if (coombes1_online)
	{
		coombes_pageArray[i] = 1;
		i++;
	}

	if (coombes2_online)
	{
		coombes_pageArray[i] = 2;
		i++;
	}

	if (coombes3_online)
	{
		coombes_pageArray[i] = 3;
		i++;
	}

	if (coombes4_online)
	{
		coombes_pageArray[i] = 4;
		i++;
	}

	if (coombes5_online)
	{
		coombes_pageArray[i] = 5;
		i++;
	}

	if (coombes6_online)
	{
		coombes_pageArray[i] = 6;
		i++;
	}
	
	if (coombes7_online)
	{
		coombes_pageArray[i] = 7;
		i++;
	}	
	
	if (coombes8_online)
	{
		coombes_pageArray[i] = 8;
		i++;
	}	
	
	if (coombes9_online)
	{
		coombes_pageArray[i] = 9;
		i++;
	}	
	
	if (coombes10_online)
	{
		coombes_pageArray[i] = 10;
		i++;
	}	
	
	if (coombes11_online)
	{
		coombes_pageArray[i] = 11;
		i++;
	}	
	
	if (coombes12_online)
	{
		coombes_pageArray[i] = 12;
		i++;
	}	
	
}

function getPageNumber()
{
	// get valid pages
	createArray();

	var searchString = document.location.search;

	if(searchString != "")
	{
		var values = searchString.split("=");
		pageNo = values[1];
		
		// not a valid page then set back to first page
		if (!validPage())
			pageNo = new Number(coombes_pageArray[0]);
	}
}

function validPage()
{
	valid = false;

	for (i=0; i<coombes_pageArray.length; i++)
		if (coombes_pageArray[i]==pageNo)
			valid=true;

	return valid;
}

function setPictures() 
{
	var lPic = "";
	var mPic = "";
	var mtPic = "";
	var mbPic = "";
	var rPic = "";
	
	switch (pageNo)
	{
		case "2":
		{
			lPic = "images/" + coombes2_left_pic;
			mtPic = "images/" + coombes2_middle_pic;
			rPic = "images/" + coombes2_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		} 

		case "3":
		{
			lPic = "images/" + coombes3_left_pic;
			mtPic = "images/" + coombes3_middle_pic;
			rPic = "images/" + coombes3_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}

		case "4":
		{
			lPic = "images/" + coombes4_left_pic;
			mtPic = "images/" + coombes4_middle_pic;
			rPic = "images/" + coombes4_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}

		case "5":
		{
			lPic = "images/" + coombes5_left_pic;
			mtPic = "images/" + coombes5_middle_pic;
			rPic = "images/" + coombes5_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}

		case "6":
		{
			lPic = "images/" + coombes6_left_pic;
			mtPic = "images/" + coombes6_middle_pic;
			rPic = "images/" + coombes6_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}
		
		case "7":
		{
			lPic = "images/" + coombes7_left_pic;
			mtPic = "images/" + coombes7_middle_pic;
			rPic = "images/" + coombes7_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}

		case "8":
		{
			lPic = "images/" + coombes8_left_pic;
			mtPic = "images/" + coombes8_middle_pic;
			rPic = "images/" + coombes8_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}
		
		case "9":
		{
			lPic = "images/" + coombes9_left_pic;
			mtPic = "images/" + coombes9_middle_pic;
			rPic = "images/" + coombes9_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}		
		
		case "10":
		{
			lPic = "images/" + coombes10_left_pic;
			mtPic = "images/" + coombes10_middle_pic;
			rPic = "images/" + coombes10_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}		
		
		
		case "11":
		{
			lPic = "images/" + coombes11_left_pic;
			mtPic = "images/" + coombes11_middle_pic;
			rPic = "images/" + coombes11_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}		
		
		case "12":
		{
			lPic = "images/" + coombes12_left_pic;
			mtPic = "images/" + coombes12_middle_pic;
			rPic = "images/" + coombes12_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			break;
		}		

		default:
		case "1":
		{
			lPic = "images/" + coombes1_left_pic;
			mtPic = "images/" + coombes1_middle_top_pic;
			mbPic = "images/" + coombes1_middle_bottom_pic;
			rPic = "images/" + coombes1_right_pic;
			document.getElementById("middleTopPic").src = mtPic;
			document.getElementById("middleBottomPic").src = mbPic;
			break;
		} 
	}

	document.getElementById("leftPic").src = lPic;	
	document.getElementById("rightPic").src = rPic;
}

function setCaption(position)
{
	switch (pageNo)
	{
		case "2":
		{
			switch(position)
			{
				case "left":
					document.write(coombes2_left_caption);
					break;
				case "middle-top":
					document.write(coombes2_middle_caption);
					break;
				case "right":
					document.write(coombes2_right_caption);
					break;
			}
			break;
		}
		
		case "3":
		{
			switch(position)
			{
				case "left":
					document.write(coombes3_left_caption);
					break;
				case "middle-top":
					document.write(coombes3_middle_caption);
					break;
				case "right":
					document.write(coombes3_right_caption);
					break;
			}
			break;
		}
		
		case "4":
		{
			switch(position)
			{
				case "left":
					document.write(coombes4_left_caption);
					break;
				case "middle-top":
					document.write(coombes4_middle_caption);
					break;
				case "right":
					document.write(coombes4_right_caption);
					break;
			}
			break;
		}
		
		case "5":
		{
			switch(position)
			{
				case "left":
					document.write(coombes5_left_caption);
					break;
				case "middle-top":
					document.write(coombes5_middle_caption);
					break;
				case "right":
					document.write(coombes5_right_caption);
					break;
			}
			break;
		}
		
		case "6":
		{
			switch(position)
			{
				case "left":
					document.write(coombes6_left_caption);
					break;
				case "middle-top":
					document.write(coombes6_middle_caption);
					break;
				case "right":
					document.write(coombes6_right_caption);
					break;
			}
			break;
		}

		case "7":
		{
			switch(position)
			{
				case "left":
					document.write(coombes7_left_caption);
					break;
				case "middle-top":
					document.write(coombes7_middle_caption);
					break;
				case "right":
					document.write(coombes7_right_caption);
					break;
			}
			break;
		}
		
		case "8":
		{
			switch(position)
			{
				case "left":
					document.write(coombes8_left_caption);
					break;
				case "middle-top":
					document.write(coombes8_middle_caption);
					break;
				case "right":
					document.write(coombes8_right_caption);
					break;
			}
			break;
		}
		
		
		case "9":
		{
			switch(position)
			{
				case "left":
					document.write(coombes9_left_caption);
					break;
				case "middle-top":
					document.write(coombes9_middle_caption);
					break;
				case "right":
					document.write(coombes9_right_caption);
					break;
			}
			break;
		}
		
		case "10":
		{
			switch(position)
			{
				case "left":
					document.write(coombes10_left_caption);
					break;
				case "middle-top":
					document.write(coombes10_middle_caption);
					break;
				case "right":
					document.write(coombes10_right_caption);
					break;
			}
			break;
		}
		
		case "11":
		{
			switch(position)
			{
				case "left":
					document.write(coombes11_left_caption);
					break;
				case "middle-top":
					document.write(coombes11_middle_caption);
					break;
				case "right":
					document.write(coombes11_right_caption);
					break;
			}
			break;
		}
		
		
		case "12":
		{
			switch(position)
			{
				case "left":
					document.write(coombes12_left_caption);
					break;
				case "middle-top":
					document.write(coombes12_middle_caption);
					break;
				case "right":
					document.write(coombes12_right_caption);
					break;
			}
			break;
		}
		
	

		default:
		case "1":
		{
			switch(position)
			{
				case "left":
					document.write(coombes1_left_caption);
					break;
				case "middle-top":
					document.write(coombes1_middle_top_caption);
					break;
				case "middle-bottom":
					document.write(coombes1_middle_bottom_caption);
					break;
				case "right":
					document.write(coombes1_right_caption);
					break;
			}
			break;
		}
	} 
}

function pagePos()
{
	pos = 0;

	for (i=0; i<coombes_pageArray.length; i++)
		if (coombes_pageArray[i]==pageNo)
			pos = i;

	return pos;
}

function setLinks() 
{
	var nextString = "";
	var prevString = "";
	var newPage = 0;

	if(pagePos() > 0)
	{
		nextString += " <a class=\"design\" href=\"coombes.shtml?pageNo=";
		newPage = new Number(coombes_pageArray[pagePos()-1]);
		nextString += newPage;
		nextString += "\"><<< Previous</a>";
		document.write(nextString);
	}

	if(pagePos() < coombes_pageArray.length-1)
	{
		prevString = "&nbsp;&nbsp;&nbsp;&nbsp;<a class=\"design\" href=\"coombes.shtml?pageNo=";
		newPage = new Number(coombes_pageArray[pagePos()+1]);
		prevString += newPage;
		prevString += "\">More >>></a>";
		document.write(prevString);
	}
}

function setRow(position) 
{
	var rows = 1;

	if(pageNo == 1) {
		rows = 3;
	} 
	
	switch(position) {
		case "left":
			document.getElementById("leftRow").rowSpan = rows;
			break;
		case "right":
			document.getElementById("rightRow").rowSpan = rows;
			break;
	}
}

function setExtraElements()
{
	if(pageNo == 1) 
	{
		// write in the sheila coombes logo
		document.write("<tr><td><img src=\"./images/SheilaCoombesLogo-long.gif\"></td></tr>");
	
		// write in the bottom image
		document.write("<tr><td>");
		document.write("<table class=\"designBorder\" id=\"middleBottomBorder\" border=0 cellspacing=0 cellpadding=0 width=\"256\">");
		document.write("<tr><td class=\"imgCell\" id=\"middleBottomCell\"><img id=\"middleBottomPic\" src=\"./images/blank.gif\" width=\"256\"></td></tr>");
		document.write("<tr><td class=\"imgCaption\" id=\"middleBottomCaption\">");
		setCaption("middle-bottom");
		document.write("</td></tr></table></td></tr>");
	}
}

// used by the page for updating values
function setValues()
{
	// the number of pages radio button
	// document.getElementById(coombes_totalPages).checked = true;

	// the online information
	document.getElementById("1_Online").checked = coombes1_online;
	document.getElementById("2_Online").checked = coombes2_online;
	document.getElementById("3_Online").checked = coombes3_online;
	document.getElementById("4_Online").checked = coombes4_online;
	document.getElementById("5_Online").checked = coombes5_online;
	document.getElementById("6_Online").checked = coombes6_online;
	document.getElementById("7_Online").checked = coombes7_online;
	document.getElementById("8_Online").checked = coombes8_online;
	document.getElementById("9_Online").checked = coombes9_online;
	document.getElementById("10_Online").checked = coombes10_online;
	document.getElementById("11_Online").checked = coombes11_online;
	document.getElementById("12_Online").checked = coombes12_online;


	
	// the first page information
	document.getElementById("1L_Pic").value = coombes1_left_pic;
	document.getElementById("1L_Cap").value = coombes1_left_caption;
	document.getElementById("1MT_Pic").value = coombes1_middle_top_pic;
	document.getElementById("1MT_Cap").value = coombes1_middle_top_caption;
	document.getElementById("1MB_Pic").value = coombes1_middle_bottom_pic;
	document.getElementById("1MB_Cap").value = coombes1_middle_bottom_caption;
	document.getElementById("1R_Pic").value = coombes1_right_pic;
	document.getElementById("1R_Cap").value = coombes1_right_caption;
	
	// the second page information
	document.getElementById("2L_Pic").value = coombes2_left_pic;
	document.getElementById("2L_Cap").value = coombes2_left_caption;
	document.getElementById("2M_Pic").value = coombes2_middle_pic;
	document.getElementById("2M_Cap").value = coombes2_middle_caption;
	document.getElementById("2R_Pic").value = coombes2_right_pic;
	document.getElementById("2R_Cap").value = coombes2_right_caption;
	
	// the third page information
	document.getElementById("3L_Pic").value = coombes3_left_pic;
	document.getElementById("3L_Cap").value = coombes3_left_caption;
	document.getElementById("3M_Pic").value = coombes3_middle_pic;
	document.getElementById("3M_Cap").value = coombes3_middle_caption;
	document.getElementById("3R_Pic").value = coombes3_right_pic;
	document.getElementById("3R_Cap").value = coombes3_right_caption;
	
	// the fourth page information
	document.getElementById("4L_Pic").value = coombes4_left_pic;
	document.getElementById("4L_Cap").value = coombes4_left_caption;
	document.getElementById("4M_Pic").value = coombes4_middle_pic;
	document.getElementById("4M_Cap").value = coombes4_middle_caption;
	document.getElementById("4R_Pic").value = coombes4_right_pic;
	document.getElementById("4R_Cap").value = coombes4_right_caption;
	
	// the sixth page information
	document.getElementById("5L_Pic").value = coombes5_left_pic;
	document.getElementById("5L_Cap").value = coombes5_left_caption;
	document.getElementById("5M_Pic").value = coombes5_middle_pic;
	document.getElementById("5M_Cap").value = coombes5_middle_caption;
	document.getElementById("5R_Pic").value = coombes5_right_pic;
	document.getElementById("5R_Cap").value = coombes5_right_caption;
	
	// the sixth page information
	document.getElementById("6L_Pic").value = coombes6_left_pic;
	document.getElementById("6L_Cap").value = coombes6_left_caption;
	document.getElementById("6M_Pic").value = coombes6_middle_pic;
	document.getElementById("6M_Cap").value = coombes6_middle_caption;
	document.getElementById("6R_Pic").value = coombes6_right_pic;
	document.getElementById("6R_Cap").value = coombes6_right_caption;
	
	// the 7 page information
	document.getElementById("7L_Pic").value = coombes7_left_pic;
	document.getElementById("7L_Cap").value = coombes7_left_caption;
	document.getElementById("7M_Pic").value = coombes7_middle_pic;
	document.getElementById("7M_Cap").value = coombes7_middle_caption;
	document.getElementById("7R_Pic").value = coombes7_right_pic;
	document.getElementById("7R_Cap").value = coombes7_right_caption;

	// the 8 page information
	document.getElementById("8L_Pic").value = coombes8_left_pic;
	document.getElementById("8L_Cap").value = coombes8_left_caption;
	document.getElementById("8M_Pic").value = coombes8_middle_pic;
	document.getElementById("8M_Cap").value = coombes8_middle_caption;
	document.getElementById("8R_Pic").value = coombes8_right_pic;
	document.getElementById("8R_Cap").value = coombes8_right_caption;

	// the 9 page information
	document.getElementById("9L_Pic").value = coombes9_left_pic;
	document.getElementById("9L_Cap").value = coombes9_left_caption;
	document.getElementById("9M_Pic").value = coombes9_middle_pic;
	document.getElementById("9M_Cap").value = coombes9_middle_caption;
	document.getElementById("9R_Pic").value = coombes9_right_pic;
	document.getElementById("9R_Cap").value = coombes9_right_caption;
	
	// the 10 page information
	document.getElementById("10L_Pic").value = coombes10_left_pic;
	document.getElementById("10L_Cap").value = coombes10_left_caption;
	document.getElementById("10M_Pic").value = coombes10_middle_pic;
	document.getElementById("10M_Cap").value = coombes10_middle_caption;
	document.getElementById("10R_Pic").value = coombes10_right_pic;
	document.getElementById("10R_Cap").value = coombes10_right_caption;
	
	// the 11 page information
	document.getElementById("11L_Pic").value = coombes11_left_pic;
	document.getElementById("11L_Cap").value = coombes11_left_caption;
	document.getElementById("11M_Pic").value = coombes11_middle_pic;
	document.getElementById("11M_Cap").value = coombes11_middle_caption;
	document.getElementById("11R_Pic").value = coombes11_right_pic;
	document.getElementById("11R_Cap").value = coombes11_right_caption;
	
	// the 12 page information
	document.getElementById("12L_Pic").value = coombes12_left_pic;
	document.getElementById("12L_Cap").value = coombes12_left_caption;
	document.getElementById("12M_Pic").value = coombes12_middle_pic;
	document.getElementById("12M_Cap").value = coombes12_middle_caption;
	document.getElementById("12R_Pic").value = coombes12_right_pic;
	document.getElementById("12R_Cap").value = coombes12_right_caption;	

}

