window.addEvent('domready',function() {
	if($('pearBrowser')) new PearBrowser($('pearBrowser'),$('pearSlider'),{});
	if($$('.pearHighLightIn')) {
		$$('.pearHighLightIn').each(function(e) {
			e.addEvent('click',function() {
				$$('.pearHighLightAc').each(function(element) {
					element.className = "pearHighLightIn";
				})
				e.className = "pearHighLightAc";
			});
		});
	}
});

function showImage(number, element,id) {

	var images = $$(".fullImage");
	
	images.each(function(e, i){
		e.fx = new Fx.Style(e,"opacity").set(1);
		e.style.borderLeft = "3px solid #7fa1b6";
		e.style.borderRight = "3px solid #7fa1b6";
	});
		
	var background = $("simpleslide");
	
	var image = images[number];
	var imagePosition = image.getCoordinates();
	var windowWidth = window.getWidth();
	var windowHeight = window.getHeight();
	
	var leftPosition = imagePosition.left-((windowWidth-874)/2);
	var topPosition = imagePosition.top-(12);
	
	if(imagePosition.width != 594) {
		var extraSpace = (594-imagePosition.width)/2;
		leftPosition -= extraSpace-2;
		//image.style.borderLeft = "2px solid #000000";
		//image.style.borderRight = "2px solid #000000";
	}
	
	new Fx.Scroll(background, {transition: Fx.Transitions.Quad.easeOut, onComplete: function() {
		$$(".fullImage").each(function(e, i){
			if(e != image) {
				e.fx = new Fx.Style(e,"opacity").set(0.3);
			}
		});
		new Ajax("getGalleryInfo.php",{method: "post",data: "id="+id,update: $('itemInfo')}).request();
	}}).scrollTo(leftPosition, topPosition);
}

