// Lightbox with Multi Product Images tweaks V1.02
// V1.02 Added auxilliary button support
// V1.01 Initial Realease

function setimagepointer(anc){		// called if lightbox images tweak used - sets cursor on main image to pointer
	anc = 'im-' + anc;
	if ( document.getElementById(anc) ) 
		{
		document.getElementById(anc).style.cursor = 'pointer';
		document.getElementById(anc).onclick = function() { firelightbox(this,0) };
		}
}

function setlbimage(anc, seq, swap){	// called when icon clicked - swap main image and remember setting
	anc = 'im-' + anc;
	if ( document.getElementById(anc) ) 
		{
		document.getElementById(anc).src = swap;
		document.getElementById(anc).onclick = function() { firelightbox(this,seq) };
		}
}

function firelightbox(img, seq){	// called when main image clicked - fire off approriate lightbox anchor
	lboxanchorid  = 'lb_' + seq + '_' + img.id;
	if ( document.getElementById(lboxanchorid) )
		{
		document.getElementById(lboxanchorid).onclick();
		}
}

function auxbutton(anc){		// called from auxiliary expand button - fire off image onclick event
	anc = 'im-' + anc;
	if ( document.getElementById(anc) ) 
		{
		if ( document.getElementById(anc).onclick ) document.getElementById(anc).onclick();
		}
}