if (!($.browser.msie && ($.browser.version) < 8)) {
	$('.proj-menu a').click(function(){
		switchMenus($(this).closest('.menu-item'),$(this).closest('span')[0]);
		});
	$('.next a').click(function(){
		next('#'+$(this).closest('.menu-item')[0].id);
		});
	$('.galleryclicky').click(function(){
		next('#'+$(this).closest('.menu-item')[0].id);
		});
	$('.prev a').click(function(){
		prev('#'+$(this).closest('.menu-item')[0].id);
		});

	function switchMenus(section, ancestor) {
		var galleryHTML="";
		for ( i=1 ; i<=galleryData[section[0].id][ancestor.id][0] ; i++ ) {
			if (i<10) {i="0"+i};
			galleryHTML=galleryHTML+'<img src="/img/projects/'+studiosOrAlaska+'/'+section[0].id+'/'+ancestor.id+'-'+i+'.jpg"'
			if (i==01) {galleryHTML=galleryHTML+' class="active"'}
			galleryHTML=galleryHTML+' alt="">'
			}
		section.find('.image-gallery').html(galleryHTML);
		section.find('.current-image-no').attr('src','/img/image-counter/1.gif');
		section.find('.max-image-no').attr('src','/img/image-counter/'+galleryData[section[0].id][ancestor.id][0]+'.gif');
		if (sIFR.isActive) {
			section.find('.proj-menu object').each(function(i){
				sIFR.getReplacementByFlashElement($(this)[0]).changeCSS(
					'a:hover {color: black; text-decoration: underline;} a {color: black; text-decoration: none; text-align:center;}'
					);
				});
			sIFR.getReplacementByFlashElement($("#"+ancestor.id+" object")[0]).changeCSS(
					'a:hover {color: black; text-decoration: underline;} a {color: black; text-decoration: underline; text-align:center;}'
				);
			sIFR.getReplacementByFlashElement(section.find('.proj-text object')[0]).replaceText(galleryData[section[0].id][ancestor.id][1]);
			} else {
			section.find('.proj-text').html(galleryData[section[0].id][ancestor.id][1]);
			}
		};

	function next(sectionID) {
		var $active = $(sectionID+' .image-gallery img.active');
		if ( $active.length == 0 ) $active = $(sectionID+' .image-gallery IMG:last');
		var $next =  $active.next().length ? $active.next() : $(sectionID+' .image-gallery IMG:first');
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 200, function() {
				$active.removeClass('active last-active');
				});
		$(sectionID+' .current-image-no')[0].src="/img/image-counter/"+(jQuery.inArray($next[0],$(sectionID+' .image-gallery img'))+1)+".gif";
		};

	function prev(sectionID) {
		var $active = $(sectionID+' .image-gallery img.active');
		if ( $active.length == 0 ) $active = $(sectionID+' .image-gallery IMG:last');
		var $prev =  $active.prev().length ? $active.prev() : $(sectionID+' .image-gallery IMG:last');
		$active.addClass('last-active');
		$prev.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 200, function() {
				$active.removeClass('active last-active');
				});
		$(sectionID+' .current-image-no')[0].src="/img/image-counter/"+(jQuery.inArray($prev[0],$(sectionID+' .image-gallery img'))+1)+".gif";
		};
	}