/*
 *  ElenaPhoto.com
 *  Javascript functions for web design.
 *  (c) 2008 Elena Elisseeva
 *  requires associated wise.css stylesheet
 */
var byClick = true;

function showGalleryBar(page) {
	document.write("<table width=670 align=center cellspacing=0 summary=\"galleries\" style=\"padding-bottom:10;\">");
	document.write("<tr align=center>");
		galBarEntry(page, 100, "People", "people.html");
		galBarEntry(page, 101, "Food", "food.html");
		galBarEntry(page, 102, "Nature", "nature.html");
		galBarEntry(page, 103, "Architecture", "arch.html");
		galBarEntry(page, 104, "Objects", "objects.html");
	document.write("</tr>");
	document.write("</table>");
}

function showGalleryImages() {

	var images = new Array("people", "food", "nature", "arch", "objects");
	document.write("<table width=670 border=0 align=center cellspacing=0 summary='galleries'>");
	document.write("<tr align=center>");
	for (i=0; i<images.length; ++i) {
		document.write("<td><a href='"+images[i]+".html'><img class=gallery height=200 src='home/"+images[i]+".jpg' alt='"+images[i]+"'></a></td>");
	}
	document.write("</tr>");
	document.write("</table>");
}

function galBarEntry(pagenow, page, text, url) {
	if (page == pagenow) {
		document.write("<td width=134 style='color:white'>");
	}
	else {
		document.write("<td width=134 style='color:gray'><a class=nav href=\""+url+"\">");
	}
	document.write(text);
	if (page != pagenow) {
		document.write("</a>");
	}
	document.write("</td>");
}

function showGallery(images_ls, images_pt, def) {
	showGalleryMax(images_ls, images_pt, def, 12, 18);
}

function showGalleryMax(images_ls, images_pt, def, maxperrowLS, maxperrowPT) {
	document.write("<table align=center cellpadding=0 cellspacing=0><tr><td>");
	showImageViewer(def);
	document.write("</td></tr><tr><td valign=top>");
	showThumbs(images_ls, images_pt, maxperrowLS, maxperrowPT);
	document.write("</td></tr></table>");
}

function showImageViewer(def) {
	document.write("<table style='padding-bottom:0' align=center width=510 height=500><tr><td align=center valign=center><img name='mainviewer' id='mainviewer' src='"+def+".jpg'></td></tr></table>");
}

function showThumbs(images_ls, images_pt, maxperrowLS, maxperrowPT) {
	document.write("<center><font size=-3><a id='onclicktext' onClick='switchClick();'>"+getClickText()+"</a></font></center>");
	document.write("<table style='padding-top:0;' align=center cellspacing=0 summary='galleries' >");
	document.write("<tr>");
	showThumbRow(images_ls, maxperrowLS);
	document.write("</tr>");
	document.write("</table>");
	document.write("<table align=center cellspacing=0 summary='galleries' >");
	document.write("<tr>");
	showThumbRow(images_pt,maxperrowPT);
	document.write("</tr>");
	document.write("</table>");
}

function switchClick() {
	byClick = !byClick;
	document.getElementById('onclicktext').innerHTML= getClickText();
}

function getClickText() {
	return byClick ? "Click thumbnails to see images (click here to change to hover mode)" : "Hover over thumbnails to see images (click here to change to click mode)";
}

function showThumbRow(images, maxperrow) {
	for (i=0; i<images.length; ++i) {
		if (i%maxperrow == 0 && i > 0) document.write("</tr><tr>");
		document.write("<td><a onClick='showImageClick(\""+images[i]+".jpg\");'><img src='"+imageLoc+images[i]+"_th.jpg' onMouseOver='showImage(\""+images[i]+".jpg\");'></a></td>");
	}
}

function showImage(image) {
	// showimage2(imageLoc+image);
	if (!byClick) document.images['mainviewer'].src=imageLoc+image;
	// document.images['mainviewer'].height=332;
}

function showImageClick(image) {
	// showimage2(imageLoc+image);
	if (byClick) document.images['mainviewer'].src=imageLoc+image;
	// document.images['mainviewer'].height=332;
}