workspath = "works/"

sortByDate = 0;

function gup(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "handmedowns";
  else
    return results[1];
}


function framer() 
	{
	top.frames['illuview'].location.href ='illu-pages/'+gup('view')+'.html';	
	}



document.thumbOn = new Image();
document.thumbOn.src = "images/thumb_on.gif";
document.thumbOff = new Image();
document.thumbOff.src = "images/thumb_off.gif";


listIllo = new Array();
listIllo[0] = "illo"
listIllo[1] = new Array();
listIllo[2] = "illustration";

listIllo2 = new Array();
listIllo2[0] = "illo2"
listIllo2[1] = new Array();
listIllo2[2] = "illustration 2"

addWork(listIllo, "library", "Unemployed bankers", 2009);
addWork(listIllo, "billgates", "Bill Gates",2009);
addWork(listIllo, "chucknorris", "Chuck Norris",2009);
addWork(listIllo, "handmedowns", "HM the Queen",2008);
addWork(listIllo, "iceland", "Bjšrk",2009);
addWork(listIllo, "itv", "Ant & Dec",2008);
addWork(listIllo, "moonwalker", "Michael Jackson",2008);
addWork(listIllo, "snakecharmer", "Snake Charmer", 2010);
addWork(listIllo, "science", "Dr Ben Goldacre",2008);
addWork(listIllo, "shrooms", "David Bowie",2008);
addWork(listIllo, "zardoz", "Sean Connery",2009);
addWork(listIllo, "subterranean", "Subterranean", 2010);
addWork(listIllo, "matrix", "Neo", 2009);
addWork(listIllo, "phantommenace", "The Phantom Menace", 2008);
addWork(listIllo, "banks", "We own the banks", 2009);
addWork(listIllo, "brum", "Come to Birmingham", 2009);
addWork(listIllo, "buytolet", "Buy to lets collapsing", 2009);
addWork(listIllo, "conspiracy", "Conspiracy theory", 2009);
addWork(listIllo, "hampsterdance", "Hampster Dance");
addWork(listIllo, "freecycle", "Free mayo", 2009);
addWork(listIllo, "perspective", "Perspective", 2010);


addWork(listIllo2, "indianajones", "Indiana Jones & Crystal Skull",2008);
addWork(listIllo2, "greggs", "Greggs", 2009);
addWork(listIllo2, "meanness", "St Scrooge", 2009);
addWork(listIllo2, "piggy", "Smashed piggy bank", 2009);
addWork(listIllo2, "linux", "Linux", 2009);
addWork(listIllo2, "nerds", "Wargames", 2009);
addWork(listIllo2, "pratchett", "Terry Pratchett", 2009);
addWork(listIllo2, "scifi", "sci-fi", 2009);
addWork(listIllo2, "weed", "Weed", 2009);
addWork(listIllo2, "littlesister", "Little Sister", 2008);
addWork(listIllo2, "dinners", "School dinners", 2009);
addWork(listIllo2, "poison", "Poison", 2008);
addWork(listIllo2, "retro", "Retro-gaming", 2008);
addWork(listIllo2, "witch", "The Witch", 2008);
addWork(listIllo2, "numanuma", "Numa Numa", 2008);
addWork(listIllo2, "spongmonkey", "Spongmonkeys", 2008);
addWork(listIllo2, "tronguy", "Tron Guy", 2008);
addWork(listIllo2, "wherethehellismatt", "Where the Hell is Matt?", 2008);
addWork(listIllo2, "catwoman", "Cat Woman", 2009);
addWork(listIllo2, "lawnmowerman", "Lawnmower Man", 2008);
addWork(listIllo2, "estate", "Estate agents crash & burn", 2009);


function addWork(whichList, file, name, year)
	{
	whichList[1][whichList[1].length] = new Array();
	whichList[1][whichList[1].length-1][0] = file;
	whichList[1][whichList[1].length-1][1] = name;
	whichList[1][whichList[1].length-1][2] = year;
	}


function writeBarPage(whichList)
	{
	document.write('<TABLE cellspacing=3 cellpadding=0 border=0 align=center><TR>');
	writeThumbs(whichList,3,"illuview");
	document.write('</TR></TABLE></A>');
	}



function writeThumbs(whichList, columns, target)
	{
	listName = whichList[0];
	if(whichList[1].length==0)
		{
		document.write('<TD><IMG src="images/thumb_soon.gif"></TD>');
		document.write('<TD><IMG src="images/thumb_soon.gif"></TD>');
		document.write('<TD><IMG src="images/thumb_soon.gif"></TD>');
		}
	else
		{
		counter=0;
		for(i=0;i<whichList[1].length;i++)
			{
			if(counter%columns==0)
				{
				document.write('</TR><TR>');
				}
			itemFile = whichList[1][i][0];
			itemName = whichList[1][i][1];
			document.write('<TD background="'+workspath+itemFile+'_thumb.jpg"><A target='+target+' href="illu-pages/'+itemFile+'.html" ');
			document.write('onmouseover="imageswitch(\''+itemFile+'\',\'images/thumb_on.gif\')" onmouseout="imageswitch(\''+itemFile+'\',\'images/thumb_off.gif\')">');
			document.write('<IMG src="images/thumb_off.gif" width="70" height="70" border="0" name="'+itemFile+'" alt="'+itemName+'"></A></TD>');
			counter++;
			}
		}
	}



function findNext(whichList,current)
	{
	next = current;
	for(i=0;i<whichList[1].length;i++)
		{
		if(whichList[1][i][0]==current)
			{
			if(i==whichList[1].length-1)
				next = whichList[1][0][0];
			else
				next = whichList[1][i+1][0];
			break;
			}
		}
	return next;
	}



function findPrev(whichList,current)
	{
	prev = current;
	for(i=0;i<whichList[1].length;i++)
		{
		if(whichList[1][i][0]==current)
			{
			if(i==0)
				prev = whichList[1][whichList[1].length-1][0];
			else
				prev = whichList[1][i-1][0];
			break;
			}
		}
	return prev;
	}



function writeEndLinks(whichList,current)
	{
	document.write('<P align=center><A href='+findNext(whichList,current)+'.htm><B>Next</B> '+whichList[2]+'</A> | ');
	document.write('<A href=index.htm><B>Back</B> to portfolio</A> | ');
	document.write('<B>Previous</B> '+whichList[2]+'</A></P>');
	}



function writePrev(whichList,current)
	{
	document.write('<A href='+findPrev(whichList,current)+'.htm onmouseover="javascript:document.prev.src=document.prevOn.src;"');
	document.write('onmouseout="javascript:document.prev.src=document.prevOff.src;"><IMG src="images/prev.gif" border="0" name="prev" alt="Next"></A>');
	}


function writeNext(whichList,current)
	{
	document.write('<A href='+findNext(whichList,current)+'.htm onmouseover="javascript:document.next.src=document.nextOn.src;"');
	document.write('onmouseout="javascript:document.next.src=document.nextOff.src;"><IMG src="images/next.gif" border="0" name="next" alt="Next"></A>');
	}



function imageswitch(image1, image2src)
	{
	document[image1].src = image2src;
	return true;
	}


