	// variables for board over lightbox
	var mEvent;
	var imgs = new Array();
	var showTimeout;
	var hideTimeout;
	var overviewHoverClassName = 'overviewHover';
	var nextImage;
	function getRealPos(ele,dir){
		var pos;
		(dir=='x')?pos=ele.offsetLeft:pos=ele.offsetTop;
		tempEle=ele.offsetParent;
		while(tempEle!=null)
		{
			pos+=(dir=='x')?tempEle.offsetLeft:tempEle.offsetTop;
			tempEle=tempEle.offsetParent;
		}
		return pos;
}
	lightboxInit = function() {
		lightBoxDiv = $('imageUp');
		lightBoxImage = $('imageUpImage');
		Element.hide(lightBoxDiv);
		imgs = document.getElementsByClassName(overviewHoverClassName);
		for(i=0; i < imgs.length; i++) {
			imgs[i].onmouseover = function() {
				spectrumOver(this);
			}
			imgs[i].onmouseout = function() {
				spectrumOut(this);
			}
		}		
		mEvent = Event.observe(document, 'mousemove', function(event){
			xMouse = Event.pointerX(event);
			yMouse = Event.pointerY(event);
			moveBig(xMouse,yMouse);
		});
	}
	
	
	moveBig = function(xMouse,yMouse) {
		lightBoxDiv = $('imageUp');
		bodycontainer = $('body_container');
		lightBoxDimensions = Element.getDimensions('imageUp');
		bodys = document.getElementsByTagName('body');
		bodyDimensions = Element.getDimensions(bodys[0]);
		lightBoxWidth = lightBoxDimensions['width'];
		bx = getRealPos(bodycontainer, 'x');
		by = getRealPos(bodycontainer);
		boxDimensions = Element.getDimensions(bodycontainer);
		centerX = boxDimensions['width']/2+bx;		
		if(xMouse <= centerX) {
			// it's on the left side...
			tLeft = Number(xMouse)+50;
			} else {
			// its' ont he right side 
			tLeft = Number(xMouse)-50-lightBoxWidth;
			}
		tTop = Number(yMouse)-(lightBoxDimensions['height']/2);
		if(tTop < window.pageYOffset) tTop = window.pageYOffset+5;
		if(tTop+lightBoxDimensions['height'] >= window.pageYOffset+window.innerHeight) {
			 tTop = (window.pageYOffset+window.innerHeight-10)-lightBoxDimensions['height'];
		}
		Element.setStyle('imageUp',{ top: tTop+'px' });
		Element.setStyle('imageUp',{ left: tLeft+'px' });
	}
	
	showBig = function(imgElement) {
		lightBoxDiv = $('imageUp');
		//op = Element.getStyle(lightBoxDiv,'opacity');
		//if(op <= 0.5 || op == 1 || op == 0) { 
		//	showEffect = new Effect.Appear(lightBoxDiv, { duration: 0.3, from: 0.0, to: 1.0 });
		//}
		
		Element.show(lightBoxDiv);
		
		var relAttribute = String(imgElement.getAttribute('rel'));
		//alert(relAttribute);
		var bigImageUrl = overviewImageDir+relAttribute+'.jpg';
		changeLightboxImage(bigImageUrl,'imageUp');
	}
	hideBig = function(tt) {
		lightBoxDiv = $('imageUp');
		//new Effect.Appear(lightBoxDiv, { duration: 0.3, from: 1.0, to: 0.0 });
		Element.hide(lightBoxDiv);
	}
	
	function spectrumOver(imgElement) {
		if(hideTimeout != undefined) { clearTimeout(hideTimeout); }
		showTimeout = window.setTimeout(function() {
			showBig(imgElement);
		}, 100);	
		return false;
	}
	function spectrumOut(imgElement) {
		if(showTimeout != undefined) { clearTimeout(showTimeout); }
		hideTimeout = window.setTimeout(function() {
			hideBig(imgElement);
		}, 100);
		return false;
	}
	getWidth = function(element) {
	   	element = $(element);
	   	return element.offsetWidth; 
	}
	resizeImageContainer = function(imgWidth,imgHeight) {
		var borderSize = 0; 
			
			//imageUpImage = $('imageUpImage');
			imt = Element.getStyle('imageUpImage','margin-top');
			imt = imt.substr(0,2);
			if(imt > 0) {
				borderSize = imt;				
			}
		Element.setStyle('imageUp',{height: (imgHeight + (borderSize*2)) + 'px'});
		Element.setStyle('imageUp',{width: (imgWidth + (borderSize*2)) + 'px'});
		return true;		
	}
	
	resizeImageContainerOld = function(imgWidth,imgHeight) {
			var resizeSpeed = 10;	// controls the speed of the image resizing (1=slowest and 10=fastest)
			
			var borderSize = 0; 
			
			//imageUpImage = $('imageUpImage');
			imt = Element.getStyle('imageUpImage','margin-top');
			imt = imt.substr(0,2);
			if(imt > 0) {
				borderSize = imt;				
			}
			
			
			var imageArray = new Array;
			var activeImage;
			
			if(resizeSpeed > 10){ resizeSpeed = 8;}
			if(resizeSpeed < 1){ resizeSpeed = 1;}
			resizeDuration = (11 - resizeSpeed) * 0.15;
			
		// get current height and width
		wCur = getWidth('imageUp');
		hCur = Element.getHeight('imageUp');
		
		
		// scalars based on change from old to new
		xScale = ((imgWidth  + (borderSize * 2)) / wCur) * 100;
		yScale = ((imgHeight  + (borderSize * 2)) / hCur) * 100;
		
		// calculate size difference between new and old image, and resize if necessary
		wDiff = (wCur - borderSize * 2) - imgWidth;
		hDiff = (hCur - borderSize * 2) - imgHeight;
		resizeDuration = .1;
		imageUp = $('imageUp');
		if(!( hDiff == 0 || Math.abs(hDiff) == 10))
		{
			//new Effect.Scale('imageUp', yScale, {scaleX: false, duration: resizeDuration, queue: 'front'});
			hstring = "height: "+imgHeight+";";
			Element.setStyle('imageUp',{height:imgHeight});
		}
		if(!( wDiff == 0 || Math.abs(wDiff) == 10))
		{
			//new Effect.Scale('imageUp', xScale, {scaleY: false, delay: resizeDuration, duration: resizeDuration});
			wstring = "weight: "+imgWidth+";";
			Element.setStyle('imageUp',{width:imgWidth});
		}
	}
	
	changeLightboxImage = function(newSRC) {
		nextImage = newSRC;
		lightBoxDiv = $(lightBoxDiv);
		targetImage = $('imageUpImage');
		Element.hide(targetImage);
		
		imgPreloader = new Image();
		// once image is preloaded, resize image container
		imgPreloader.onload=function(){
			targetImage = $('imageUpImage');
			targetImage.src = nextImage;
			resizeImageContainer(imgPreloader.width, imgPreloader.height);
			Element.show(targetImage);
		}
		imgPreloader.src = nextImage;
	}
	
	lightboxImage = function() {
		
	}
	