function init(picid) {
	//thumbs
	var tHTML = '';
	tHTML += '<p>';
	for (i=0;i<p.length;i++) {
		display = p[i];
		tHTML += '<a onfocus="blur();" href="javascript:chgCol(\'t'+i+'\',\''+display.thumb3+'\',\''+display.image+'\',\''+display.title+'\',\''+display.desc+'\',\''+display.ppath+'\',\''+display.pno+'\',\''+display.enl+'\');"><img id="t'+display.num+'" src="'+display.thumb2+'" onmouseover="swapCol(\'t'+display.num+'\',\''+display.thumb3+'\')"  onmouseout="swapCol(\'t'+display.num+'\',\''+display.thumb2+'\')" /></a>';
	}
	tHTML += '</p>';
	document.getElementById('thumbs').innerHTML = tHTML;
//	display = p[0];
//	chgCol('t0',display.thumb3,display.image,display.title,display.desc);
//	chgCol('t0',display.thumb3,display.image,display.title,display.desc,display.ppath,display.pno);
	if(picid) { display = p[picid]; eval("chgCol('t"+picid+"',display.thumb3,display.image,display.title,display.desc,display.ppath,display.pno,display.enl)"); } // adds capability to show any image instead of just the first
	else { display = p[0]; chgCol('t0',display.thumb3,display.image,display.title,display.desc,display.ppath,display.pno,display.enl); } // defaults to show the first pic
	preload();
}
function swapCol(n,img) { 
	if (document.getElementById) { 
		var cur = eval('document.getElementById("'+n+'").src');
//		if(cur.indexOf("sel") == -1) { eval('document.getElementById("'+n+'").src = "'+img+'"'); }
//		eval('document.getElementById("'+n+'").src = "'+img+'"');
		if(n != selected) { eval('document.getElementById("'+n+'").src = "'+img+'"'); }
	}
}
var selected = 0;
var pnototal = 0;
function chgCol(id,img,lge,tit,des,ppath,pno,enl) {
	if(!enl) { var enl=0; }
	pnototal = pno;
	if (document.getElementById) { 
		for(i=0;i<=(p.length-1);i++) {
			display = p[i];
			var cur = eval('document.getElementById("t'+i+'").src');
			eval('document.getElementById("t'+i+'").src = "'+display.thumb2+'"');
		}
		var more = '';
		if((pno>0) && (pno)) {
			more += '<p class="morephotos">Click to view more:&nbsp;&nbsp;';
			for(j=0;j<pno;j++) {
				more += '<a href="javascript:morePhotos(\''+ppath+'\','+(j+1)+','+enl+');"><img id="pageno'+(j+1)+'" src="assets/images/p'+(j+1)+'_0.gif" alt="'+(j+1)+'" /></a>';
			}
			more += '</p>';
		}
		eval('document.getElementById("'+id+'").src = "'+img+'"');
		if((enl>0) && (enl)) {
			document.getElementById("rhs1").innerHTML = '<img src=\"'+lge+'\" /><p class="enlarge"><img src="assets/images/enlarge.gif" alt="" /> <a href="javascript:showEnlarged(\''+ppath+'1_e.jpg\');">ENLARGE</a></p>';
		} else {
			document.getElementById("rhs1").innerHTML = '<img src=\"'+lge+'\" />';
		}
		document.getElementById("title").innerHTML = tit;
		document.getElementById("desc").innerHTML = '<p>'+des+'</p>'+more;
		if ((pno>0) && (pno)) { document.getElementById("pageno1").src = "assets/images/p1_1.gif"; }
	}
	selected = id;
}

function showEnlarged(enl) {
	document.getElementById("enlargement").innerHTML = '<img src=\"'+enl+'\" /><br /><p class="enlarge"><img src="assets/images/close.gif" alt="" /> <a href="javascript:hideEnlarged();">CLOSE</a></p>';
	document.getElementById("enlarged").style.display = "block";
}
function hideEnlarged() {
	document.getElementById("enlarged").style.display = "none";
}


function morePhotos(ppath,mP2,enl) {
	for(s=1;s<=pnototal;s++) {
		eval('document.getElementById("pageno'+s+'").src = "assets/images/p'+s+'_0.gif"');		
	}
	if((enl==mP2) && (enl)) {
		document.getElementById("rhs1").innerHTML = '<img src=\"'+ppath+mP2+'.jpg\" /><p class="enlarge"><img src="assets/images/enlarge.gif" alt="" /> <a href="javascript:showEnlarged(\''+ppath+mP2+'_e.jpg\');">ENLARGE</a></p>';
	} else {
		document.getElementById("rhs1").innerHTML = '<img src=\"'+ppath+mP2+'.jpg\" />';
	}
//	document.getElementById("rhs1").innerHTML = '<img src=\"'+ppath+mP2+'.jpg\" />';
	eval('document.getElementById("pageno'+mP2+'").src = "assets/images/p'+mP2+'_1.gif"');
}