
$(window).load(resizeLI);

function resizeLI(){
	$("div.imageDiv ul").each(function(){
		var maxHeight = 0;
		var imageLis = $(this).find('li');
		imageLis.each(function(){
			//alert(this.offsetHeight + ' > ' + maxHeight);
			if(this.offsetHeight > maxHeight){
				maxHeight = this.offsetHeight;
			}
		});
		imageLis.each(function(){
			var h5 = $(this).find('h5');
			//alert(maxHeight + '-' + this.offsetHeight);
			h5.css('marginBottom', (maxHeight - this.offsetHeight) + 'px');
			var width = parseInt($(this).find('a img').width()) + 10 + 'px';
			var a = $(this).find('a').css('width', width);
		});
	});
}
$(function(){

	var currentDone = false;
	var menuLinks = $('#mainMenu li a').each(function(i){
		if(i>0){
			if(window.location.href.indexOf(this.href) >= 0){
				$(this).parent().addClass('current');
				currentDone = true;
				return false;
			}
		}
	});
	if(!currentDone){
		menuLinks.eq(0).parent().addClass('current');
	}

	var imageLis = $("div.imageDiv ul li");
	imageLis.filter(':odd').addClass('alt');
/*
	
	if($.browser.msie){
		imageLis.css('cursor', 'hand');	
	}else {
		imageLis.css('cursor', 'pointer');
	}
//	imageLis.mouseover(function(){$(this).css({backgroundColor: '#FBF5EA', border: 'solid 2px #BA3A3A'});});
//	imageLis.mouseout(function(){ $(this).css({backgroundColor: '', border: 'solid 2px #fff'}); });
//	imageLis.mouseover(function(){ $(this).addClass('mo');});
//	imageLis.mouseout(function(){ $(this).removeClass('mo');});

	imageLis.click(function(){
		var anchor = $(this).find('a.thickbox');
		var t = anchor.attr('title') || anchor.attr('name') || null;
		var a = anchor.attr('href') || anchor.attr('alt');
		var g = anchor.attr('rel') || false;
		tb_show(t,a,g);
		this.blur();
		return false;
	});
*/
	imageLis.find('h5').find('a').click(function(){ 
		window.location.href = this.href;
		return false;
	});

	var bubbles = $('.bubble');
	bubbles.each(function(){
		var bubble = $(this);
		bubble.removeClass('bubble');
		bubble.wrap('<div class="bubbled' + (bubble.attr('className') ? ' ' + bubble.attr('className') : '') + '"><div class="inner1"><div class="inner2"></div></div></div>');
		bubble.parent().parent().before('<div class="bubbleTop"><div></div></div>');
		bubble.parent().parent().after('<div class="bubbleBottom"><div></div></div>');
		bubble.removeClass();
		bubble.addClass('inner3');
	});

	var buttons = $('.L00-button').each(function(){
		var button = $(this);
		button.mousedown(function(){
			$(this).addClass('L00-clicked');
		});
		button.mouseup(function(){
			$(this).removeClass('L00-clicked');
		});
		button.mouseout(function(){
			$(this).removeClass('L00-clicked');
		});
	});
	
});