function initMagnify() {
		
	// check for dom support & id 'gallery'
	if (!$) return false;
	if (!$('gallery')) return false;
		
	// declare some variables
	var gallery = $('gallery');
	var imgContainer = $$('#gallery div');
	
	// loop through desired elements 
	for (var i=0; i < imgContainer.length; i++) {
		
		// check for class name 'magnifyThis'
		if (imgContainer[i].className == 'magnifyThis') {
			
			// declare variables that contain image path
			var thisImage = imgContainer[i].getElementsByTagName('img')[0];
			var imgSource = thisImage.getAttribute('src');
			var imgFileName = imgSource.split('.');
			var zoom = (imgFileName[0] + '_zoom' + '.' + imgFileName[1]);
			
			// create trigger
			var trigger = document.createElement('a');
			var triggerTxt = document.createTextNode('hover to magnify');
			trigger.appendChild(triggerTxt);
			trigger.className = 'magnify';
			
			trigger.inject(imgContainer[i], 'top');
			
			// extend trigger object
			trigger.thisImage = thisImage;
			trigger.imgSource = imgSource;
			trigger.zoom = zoom;
		
			// call magnify function on mouseover
			trigger.onmouseover = function() {
				this.thisImage.setAttribute('src' , this.zoom);
			} 

			// change image back on mouseout
			trigger.onmouseout = function() {
				this.thisImage.setAttribute('src' , this.imgSource);
			}
			
		}
	}
}
