window.onload = initLinks;

var myPix = new Array("images/F14.jpg","images/HR47.jpg","images/S110.jpg","images/GSPIRAL.jpg",
"images/B78.jpg","images/B107.jpg","images/F6.jpg","images/G79C.jpg",
"images/H327.jpg","images/K03B.jpg","images/K10.jpg","images/N86A.jpg",
"images/P30.jpg","images/P069.jpg","images/PG299.jpg");
var myTitle = new Array("Islamic - zellij","Islamic - pentagons and squares","Islamic - two stars","Spiral",
"Celtic design","Islamic - Bourgoin","Islamic - Type I","Victorian floor tiles",
"Islamic window","Chinese lattice design","Polyominoes in a rectangle","Roman pattern",
"Interlace count","Islamic pattern with photo","Islamic - simple");
var Location = new Array("data166/F14", "data164/HR47", "data168/S110", "data169/GSPIRAL",
"data1/B78", "data172/B107", "data169/F6", "data3/G79C",
"data9/H327", "data24/K03B", "data113/K10", "data7/N86A",
"data17/P30", "data11/P069", "data8/PG299");
var Paras = new Array(
// data166/F14
"This pattern is typical of Moroccan Zellij art, For further examples, see the publications of [castera] and [paccard].",
// data164/HR47
"This Islamic pattern is unusual in containing both a square and a regular pentagon.", 
// data168/S110
"An Islamic pattern with regular 8 and 12-pointed stars. However, the 5-pointed stars are not regular.",
// data169/GSPIRAL
"This is a modern mathematical pattern. It was not until 1936, that a spiral pattern was found. Further examples "+
"can be located by doing a text search for the word <em>spiral</em>.",
// data1/B78
"Celtic art has many interesting patterns. For futher examples, see the publications: [bain] and [backhouse].", 
// data172/B107
"The work of Bourgoin is one of the major works on Islamic art. The original publication has no colour, but has "+
"been added here. Other examples of his work can be found by searching for the publication [bourgoin].",
// data169/F6
"These are a type of Islamic pattern defined by Tony Lee in [lee]. Currently, there is no way to search for such patterns.",
// data3/G79C
"Victorian floor tile designs gain their elegance from the use of colour. Further examples can be found by using the "+
"comprehensive search looking for the work of [graftom].",
// data9/H327
"This is an example of an Islamic window decoration. Note that it is interlaced with two finite interlaces. By using the"+
" comprehensive search and requesting two colours only needed, one can locate other patterns with just 2 finite interlaces.",
// data24/K038
"Chinese lattice design are typically used as ornament of the side of houses. Further examples can be found by using"+
" the comprehensive search looking for the publication by [dye]. The colouring used is not based on the original.", 
// data113/K10
"This is an example of the tiling with polyominoes. All the larger example have been found by computer search algorithms."+
' A complete list of this type of pattern is to be found <a href ="special/special1.html">here</a>.', 
// data7/N86A
"This tiling is of Roman origin. Further examples can be found by using the comprehensive search requesting the publications [neal]"+
"and [field1]. Note that the interleaving squares are really only visible due to the colouring.", 
// data17/P30
"In this pattern, the lines surrounding the polygons cross over at junctions and so can be followed round."+
"There is one which has an octogonal shape round the 8-pointed star. Can you see the other one which is infinite?"+
"Patterns like this can always be coloured with just two colours. Using the comprehensive search you can find how many are like this.", 
// data11/P069
"This pattern has regular hexagons and a 12-pointed star. This pattern is drawn with interlacing, as in the second photo."+
"The first photo, the pattern is made from zellij - individual tiles of contrasting colours."+
"See if you can find other patterns with hexagons and 12-pointed stars.", 
// datat8/PG299
"This is one of the simplest Islamic pattern. It contains two regular polygons - a square and an 8-pointed star polygon."+
"One can find many Islamic patterns by using the comprehensive search and requesting 8-pointed stars.");
var thisPic = 0;

function initLinks() {
	document.getElementById("Myh1Title").innerHTML = myTitle[thisPic];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
	document.getElementById("detailsLink").onclick = processDetails;
	document.getElementById("explainLink").onclick = processExplain;
	thisPic = Math.floor((Math.random() * myPix.length));
	document.getElementById("myPicture").src = myPix[thisPic];
}

function processPrevious() {
	if (thisPic == 0) {
		thisPic = myPix.length;
	}
	thisPic--;
	document.getElementById("Myh1Title").innerHTML = myTitle[thisPic];
	document.getElementById("explainpara").innerHTML = "";
	document.getElementById("myPicture").src = myPix[thisPic];
	return false;
}

function processNext() {
	thisPic++;
	if (thisPic == myPix.length) {
		thisPic = 0;
	}
	document.getElementById("Myh1Title").innerHTML = myTitle[thisPic];
	document.getElementById("explainpara").innerHTML = "";
	document.getElementById("myPicture").src = myPix[thisPic];
	return false;
}

function processDetails() {
    window.location = "HTML/"+Location[thisPic]+".html"
	return false;
}

function processExplain() {
	document.getElementById("explainpara").innerHTML = Paras[thisPic];
	return false;
}
						