function swapImage(img) {
	
	var newid=arrayIDs[img];
	var newwidth=arrayWidths[img];
	var newheight=arrayHeights[img];
	var newsrc=arrayImages[img];
	var newlegend=arrayLegends[img];
	var newtitle=arrayTitles[img];
//	alert(newsrc);
	if ( document.getElementById ) {
//		document.getElementById('mainImg').setAttribute('src', newsrc);
		document.getElementById('legend').innerHTML=newlegend;
//alert('<a href="gallery/popups/'+newsrc+'" target="_blank" rel="lightbox"><img id="mainImg" src="gallery/images/'+newsrc+'" /></a>');
		document.getElementById('popuplink').innerHTML='<a href="javascript: popImg('+newid+','+newwidth+','+newheight+');" title=\"'+newtitle+'\" alt=\"'+newtitle+'\"><img id="mainImg" src="gallery/images/'+newsrc+'" /></a>';
	}
}

var myrules = {
	'.thumb' : function(el){
		el.onclick = function(){
			swapImage(this.getAttribute('id'));
		};
		el.onmouseover = function(){
			this.style.cursor='pointer';
		};
		el.onmouseout = function(){
			this.style.cursor='default';
		}
	}
	
};

Behaviour.register(myrules);