jQuery.noConflict(); //for using prototype

jQuery(document).ready(function(){
	jQuery('.widgetmenu a').click(function () {
		jQuery(this).blur();
		// first and last images
		jQuery(this).siblings().filter(':first').addClass('hide');
		jQuery(this).siblings().filter(':last').addClass('hide');
		
		// click on first
		if(jQuery(this).hasClass('first')){
			jQuery(this).prev().removeClass('hide');
		};
		// click on last
		if(jQuery(this).hasClass('last')){
			jQuery(this).next().removeClass('hide');
		};
		
		jQuery(this).siblings('a').removeClass('active');
		jQuery(this).addClass('active');
		
	});
	
	
	//var pic = jQuery('#gallery img:last');
	//alert( pic.height()+' '+pic.width() );
	
	var maxheight = 100;
	jQuery('#gallery img').each(function() {
		var tempheight = jQuery(this).height();
		//alert(tempheight);

		if(maxheight < tempheight){
			maxheight = tempheight;
		}
	});
	
	//alert(maxheight);
	
	if(maxheight > 100){
		maxheight = maxheight + 20;
		jQuery('#gallery').height(maxheight);
	}
	
	
	//jQuery('#gallery').css('height' : '100px');
	
	

	
	//jQuery('#gallery').hide();
	
	//$('#gallery').height(maxheight);


	/*jQuery('#gallery img').click(function () {
		var imageHeight = $(this).height();
		alert(imageHeight);
	});*/
	
	
	jQuery('a.fancybox').fancybox({'overlayShow': true, 'zoomOpacity': true });
	
});


