// Highslide / Lightbox with Multi Product Images tweaks V3.06

function setlbimage(anc, seq, swap){	// called when icon clicked or mouseovered - swap main image and remember setting
	var lbid = 'lbid_' + anc + '_' + seq;
	anc = 'im-' + anc;
	if ( document.getElementById(anc) ) 
		{
		document.getElementById(anc).src = swap;
		document.getElementById(anc).onclick = function() { document.getElementById(lbid).onclick(); };
		}
}

function gb_setimage(img, anc){			// called when product image mouseovered - set style and onclick
	img.style.cursor = 'pointer';
	if( ! img.onclick )			// if image set defined and first mouseover
		{
		var lbid = 'lbid_' + anc + '_0';
		img.onclick = function() { if ( document.getElementById(lbid) ) document.getElementById(lbid).onclick(); }
		}
}

function auxbutton(anc){		// called from auxiliary expand button - fire off image onclick event
	imgid = 'im-' + anc;
	if ( document.getElementById(imgid) ) 	
		{
		var mainimg = document.getElementById(imgid);
		gb_setimage(mainimg, anc);	// in case this is first call - setup main image onclick
		if ( mainimg.onclick ) mainimg.onclick();
		}
}
