function pop_pic (year, name, number, firstpic, lastpic) {
var win = window.open("", "pic_win", "width=1200,height=800,scrollbars=yes"); // a window object
var a="000" + number;
var quote='"';
win.focus();
win.document.open("text/html", "replace");
win.document.write("<html><head><title>" + name + "</title>\r");
win.document.write('<link rel="stylesheet" type="text/css" href="/css/styles.css">');
win.document.write("<script language="+quote+"javascript1.5"+quote+" type="+quote+"text/javascript"+quote+">\r");
win.document.write("function to_pic(nmbr) {\r");
win.document.write("	var a='000' + nmbr;\r");
win.document.write("	document.getElementById('pic').src='/gallery/' + year + '/' + name + '/fullpics/' + name + '_' + a.substr(a.length-3,3) +'.jpg';\r");
win.document.write("	document.getElementById('picnumber').innerHTML=nmbr;\r");
win.document.write("}\r\r");

win.document.write("function to_first(){\r");
win.document.write("	number=firstpic;\r");
win.document.write("	to_pic(number);\r");
win.document.write("}\r\r");

win.document.write("function to_last(){\r");
win.document.write("	number=lastpic;\r");
win.document.write("	to_pic(number);\r");
win.document.write("}\r\r");

win.document.write("function to_next(){\r");
win.document.write("	number++;\r");
win.document.write("	if (number > lastpic)\r");
win.document.write("		number=firstpic;\r");
win.document.write("	to_pic(number);\r");
win.document.write("}\r\r");

win.document.write("function to_previous(){\r");
win.document.write("	number--;\r");
win.document.write("	if (number < firstpic)\r");
win.document.write("		number=lastpic;\r");
win.document.write("	to_pic(number);\r");
win.document.write("}\r\r");

win.document.write("</script>\r");
win.document.write("</head><body>\r");
win.document.write('<div id="wrapper"><div id="main_container" style="margin-top:130px;">\r');
win.document.write("<center>\r");
win.document.write("Picture #<span id="+quote+"picnumber"+quote+">1</span> of "+lastpic+"<br />")
win.document.write("<a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_first();"+quote+">First</a> | <a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_previous();"+quote+">Previous</a> | <a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_next();"+quote+">Next</a> | <a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_last();"+quote+">Last</a><br />\r");
win.document.write("<img id="+quote+"pic"+quote+" name="+quote+"pic"+quote+" src="+quote+"/gallery/gallery_placeholder.gif"+quote+" height="+quote+"600"+quote+" border="+quote+"0"+quote+" /><br />\r");
win.document.write("<a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_first();"+quote+">First</a> | <a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_previous();"+quote+">Previous</a> | <a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_next();"+quote+">Next</a> | <a href="+quote+"javascript:;"+quote+" target="+quote+"_self"+quote+" onclick="+quote+"to_last();"+quote+">Last</a><br />\r");
win.document.write("</center>\r");
win.document.write("<script language="+quote+"javascript1.5"+quote+" type="+quote+"text/javascript"+quote+">\r");
win.document.write("{\r");
win.document.write("var year="+year+";\r");
win.document.write("var name='"+name+"';\r");
win.document.write("var number="+number+";\r");
win.document.write("var firstpic="+firstpic+";\r");
win.document.write("var lastpic="+lastpic+";\r");
win.document.write("to_pic(number);\r");
win.document.write("}\r");
win.document.write("</script>\r");
win.document.write("<br /><br />&copy; 2008 Parties on Point<br />\r");
win.document.write("</center>\r");
win.document.write("</div></div>\r");
win.document.write("</body></html>\r");
win.document.close();
return false;
}
