/** Gallery Engine**/
isGallery = true;
var AuthorName = 'Ilya I. Gerasimenko';

Expo = function () { 
var gPage = document.getElementById('page');
if (gPage)	{ 
for ( var i = 0; i < PrName.length; i++ ) if (PrName[i])	{
/* Common strings to pass to CloseUp function: */
var PrFstr = PrFolder;
var PrGstr = PrGenre;
var		exhibit = document.createElement('div');
		exhibit.className = 'exhibit';
var		exheader = document.createElement('h2');
		exheader.appendChild(document.createTextNode(PrName[i]));
		exhibit.appendChild(exheader);
var		expreview = document.createElement('div');
			expreview.className = 'previewframe';
var		exthumb = document.createElement('img');
			exthumb.src = PrFile[i];
			exthumb.title = PrName[i];
			exthumb.alt = PrName[i];
			exthumb.style.height = '150px';
			exthumb.style.width = '150px';
			exthumb.style.cursor = 'pointer';
		/*[use custom attributes to carry image-specific gallery data to CloseUp function]*/
			exthumb.ANstr = AuthorName.replace(/\'/g,'`');
			exthumb.PFstr = PrFull[i];
			exthumb.PNstr = PrName[i].replace(/\'/g,'`');
			exthumb.PDstr = PrDesc[i].replace(/\'/g,'`');
			exthumb.PYstr = PrYear[i];
			exthumb.PLstr = PrLink[i];
			exthumb.onclick = function () { CloseUp(this.ANstr,PrFstr,PrGstr,this.PFstr,this.PNstr,this.PDstr,this.PYstr,this.PLstr); };
		expreview.appendChild(exthumb);
		exhibit.appendChild(expreview);
var		exmemo = document.createElement('p');
			exmemo.className = 'memo';
		exmemo.appendChild(document.createTextNode(PrMemo[i]));
		exhibit.appendChild(exmemo);
if (PrLink[i] != '')	{
					var	exXp = document.createElement('p');
					var	exXa = document.createElement('a');
								exXa.href = PrLink[i];
								exXa.target = '_blank';
					var	exXi = document.createElement('img');
								exXi.src = 'components/zoom.gif';
					exXa.appendChild(exXi);
					exXp.appendChild(exXa);
					exhibit.appendChild(exXp);
					}
var		exdate = document.createElement('p');
		exdate.className = 'year';
		exdate.appendChild(document.createTextNode(PrYear[i]));
		exhibit.appendChild(exdate);
		/*[display entry]*/
		gPage.appendChild(exhibit);
					}
var		gcopy = document.createElement('p');
		gcopy.className = 'clear copy';
		gcopy.appendChild(document.createTextNode('Copyright 2004-2009 ' + AuthorName));
		gPage.appendChild(gcopy);
		}
}

CloseUp = function (authorName,projFolder,projGenre,projFull,projName,projDesc,projYear,projLink) {
	var win = (!document.all ? window.open('', '', 'resizable=yes') : top), wtitle = authorName.replace(/`/g,'&#8217;') + ': ' + projName.replace(/`/g,'&#8217;');
	win.document.open('text/html'); //adding 'replace' argument puzzles IE7.
	win.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
	win.document.writeln('<html>');
	win.document.writeln('<head>');
	win.document.writeln('<META HTTP-EQUIV="imagetoolbar" CONTENT="no">');
	win.document.writeln('<title>PORTFOLiO: ' + wtitle + '</title>');
	win.document.writeln('<link href="components/global.css" rel="stylesheet" type="text/css">');
	win.document.writeln('<script type="text/javascript"> reSize = function () { mPic = document.getElementById("mPic"); mPX = mPic.width; mPY = mPic.height; window.resizeTo(mPX*1+250*1,mPY*1+115*1); }</script>');
	win.document.writeln('</head>');
	if (win != top)			{
		win.document.writeln('<body id="gallerypage" onload="reSize();">')
	} else {
		win.document.writeln('<body id="gallerypage">');
	}
	if (win == top) 		win.document.writeln('<img onclick="document.location.href=\'' + projFolder + '-' + projGenre + '.html\'" src="components/back.gif" title="(click to go back)" alt="(click to go back)" style="margin: 0 3px 0 0;cursor:pointer; float:left;">');
	if (projLink != '') 	win.document.writeln('<img id="mPic" onclick="document.location.href=\'' + projLink + '\'" src="' + projFull + '" style="float:left;margin: 0 20px 0 0;cursor:pointer;" >');
	else					win.document.writeln('<img id="mPic" src="' + projFull + '" style="float:left;margin: 0 20px 0 0;">');
		win.document.writeln('<h1>' + projName.replace(/`/g,'&#8217;') + '</h1>');
		win.document.writeln('<p class="desc">' + projDesc.replace(/`/g,'&#8217;') + '</p>');
	if (projLink != '') 	win.document.writeln('<p><a href="' + projLink + '" style="text-decoration:none;" target="_blank"><img src="components/zoom.gif" border="0"></a></p>');
		win.document.writeln('<p class="year">' + projYear + '</p>');
	win.document.writeln('</body>');
	win.document.writeln('</html>');
	win.document.close();
	win.focus();
}

