// JavaScript for annawatson.com
// Copyright 2003-5 J.D. Watson

var picWindow, ncols, col=1, thumbWidth, thumbSpace, picBorder, t = new Array(), currpic = 100
var cats = new Array ("Biography|Biography.htm","Stock Locations|Stock Locations.htm","e: anna@annawatson.com|mailto:anna@annawatson.com","t: +44 (0)20 8981 9155", "m: +44 (0)7866 631705")
var gals = new Array ("Portraits","Travel","Real Italian Food","PR","Published Work")
var caps = new Array ("Portraits","Travel","Real Italian Food","PR","Published Work")
var headline

function header() {
	var width = 100/(gals.length+1)
	
	document.write('<body onUnload="Javascript:closeWin()"><div align=center><table border="0" cellpadding="0" cellspacing="0" width=100%><tr><td class="t1">anna&nbsp;watson<br><span class="t2">photographer</span></td><td width=100% valign=bottom><table border="0" cellpadding="2" cellspacing="3" width=100%><tr>')
	document.write ('<td class="mblink" width=' + width + '%><a class=A1 href="index.htm"><nobr>Home</nobr></a></td>')
	for (n = 0 ; n < gals.length ; n++) {
		title = gals[n]
		if (title=="Real Italian Food") { title = "<i>" + title + "</i>" }
		if (title.length < 4) { title = "&nbsp;&nbsp;&nbsp;&nbsp;" + title + "&nbsp;&nbsp;&nbsp;&nbsp;" }
		if (unescape(window.location.href).indexOf(gals[n]+".htm") > -1) {
			headline = gals[n]
			document.write ('<td class="l4this" width=' + width + '%><nobr>&nbsp;' + title + '&nbsp;</nobr></td>')
		} else {
			document.write ('<td class="l4link" width=' + width + '%><a class=A2 href="' + gals[n] + '.htm"><nobr>&nbsp;' + title + '&nbsp;</nobr></a></td>')
		}
	}
	document.write('</tr></table></td></tr></table>')
	document.write('<p class="head">' + headline + '</p>')
}

function showPic(num) {
	if ( num == currpic && picWindow && !picWindow.closed ) {
		closeWin()
	} else {
		currpic = num
		title = t[num]
		width = 680
		height = 710
		prev = ( num==0 ) ? t.length-1 : num-1
		nxt = (num+1) % t.length
		if (picWindow && !picWindow.closed) {
			picWindow.focus()
			picWindow.resizeTo(width+8,height+55)
		} else {
			picWindow = window.open('','picWin','resizable,left=10,top=10,width=' + width + ',height=' + height)
			picWindow.focus()
		}
	picWindow.document.write('<html><head><title>Anna Watson, ' + headline + ' - ' + title + '</title></head><body style="font-family: arial,helvetica,sans-serif; font-size: 4pt"><table width=100% height=100% border=0 cellpadding=0 cellspacing=0><tr height=100%><td colspan=3 align=center valign=middle><img src="' + headline + '/' + title + '.jpg" border=' + picBorder + '><br><br><font style="color: #cc0000; font-size: 12pt">' + (num+1) + ':&nbsp;' + title + '</td></tr><tr><td width=33% align=left><a style="font-size: 10pt; color: #0000ff; text-decoration: none" href="javascript:window.opener.showPic(' + prev + ')">&lt;&nbsp;previous</a></td><td width=33% align=center><a style="font-size: 10pt; color: #0000ff; text-decoration: none" href="javascript:self.close()">close</a></td><td width=33% align=right><a style="font-size: 10pt; color: #0000ff; text-decoration: none" href="javascript:window.opener.showPic(' + nxt + ')">next&nbsp;&gt;</a></td></tr></table></body></html>')
	picWindow.document.close()
	}
}

function closeWin() {
	if (picWindow && !picWindow.closed) {
		picWindow.close()
		currpic = 100
	}
}

function newWindow(URL) {
	newWindow = window.open(URL,'newWin')
}

function showThumbs() {
	col = 1
	document.write('<table border=0 cellspacing=0 cellpadding=' + thumbSpace/2 + '>')
	for (var n = 0 ; n < t.length ; n++) {
		if (col == 1) {
			document.write('<table border=0 cellspacing=0 cellpadding=' + thumbSpace/2 + '><tr>')
		}
		document.write('<td class=l3 width=' + thumbWidth + '><a href="#' + n + '" onclick="javascript:showPic(' + n + ')"><img class="thumb" src="' + headline + '/tn_' + t[n] + '.jpg" alt="' + t[n] + '"></a></td>')
		col = col+1
		if (col > ncols) {
			col = 1
			document.write('</tr>')
		}
	}
	if(col <= ncols) { document.write('</tr>') }
	document.write('</table>')
}

function footer() {
	var width = 100/cats.length
	var arCat
	document.write('<table border="0" cellpadding="2" cellspacing="3" width=100%><tr>')
	for (var n = 0 ; n < cats.length ; n++) {
		arCat = cats[n].split("|")
		if (arCat.length == 2) {
			if (unescape(window.location.href).indexOf(arCat[1]) > -1) {
				document.write ('<td class="mbthis" width=' + width + '%><nobr>' + arCat[0] + '</nobr></td>')
			} else {
				document.write ('<td class="mblink" width=' + width + '%><a class="A1" href="' + arCat[1] + '"><nobr>' + arCat[0] + '</nobr></a></td>')
			}
		} else {
			document.write ('<td class="mblink" width=' + width + '%><nobr>' + arCat[0] + '</nobr></td>')
		}
	}
	document.write('</table><span class="footnote">Copyright &copy; 2003-07 Anna Watson</span></div>')
}


