function show(obj1Id,objId){
	obj = document.getElementById(objId);
	if(obj && isShow == 0){
		isShow = 1;
		obj.style.display = "block";
		return;	
	}
	else if(isShow == 1){
		hide();
		return;
	}
	
}

function hide(){
	for(i = 0; i<count;i++){
		var a = "ul"+i;
		var obj = document.getElementById(a);
		if(obj){
		isShow = 0;
		obj.style.display = "none";
		}
	}
}

function prettySize(_img,obj,sub){
	
	var imageWidth = $(_img).get(0).width;
    var imageHeight = $(_img).get(0).height;
	
	if(imageWidth > $(obj).width()){
	var x = $(obj).get(0).offsetWidth - sub;
	var y = $(obj).get(0).offsetWidth - sub;

	
	
	alert(imageWidth);
	
	if (imageWidth > x) {
		imageHeight = imageHeight * (x / imageWidth); 
		imageWidth = x; 
		if (imageHeight > y) { 
			imageWidth = imageWidth * (y / imageHeight); 
			imageHeight = y; 
		}
	} else if (imageHeight > y) { 
		imageWidth = imageWidth * (y / imageHeight); 
		imageHeight = y; 
		if (imageWidth > x) { 
			imageHeight = imageHeight * (x / imageWidth); 
			imageWidth = x;
		}
	}
	 $(_img).attr("width",imageWidth);
	 $(_img).attr("height",imageHeight);
	}

	return _img;
}

$(document).ready(function(){
	$(".summer, .winter").click(function(){
		if($(this).attr("class") == 'summer'){
			$(".winter").removeClass("active");
			$(".summer").addClass("active");
			$("#winter").hide();
			$("#summer").show();
		}
		else{
			$(".summer").removeClass("active");
			$(".winter").addClass("active");
			$("#summer").hide();
			$("#winter").show();	
		}	
	});
	
		$('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability
		
		$('ul.gallery_demo').galleria({
			history   : true, // activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#main_image', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				image.css('display','none').fadeIn(1000);
				caption.css('display','none').fadeIn(1000);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				image.attr('title','Bild weiter >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
				)
			}
		});

	
});