$(function(){
	if ($('.lightbox').html() != undefined){
		$('a.lightbox').lightBox();
	}
	
	var anterior = $('.jsLegenda').height()+20;
	var atual = 0;
	$('.jsLegenda').each(function(){
		atual = parseInt($(this).css('height'));
		anterior = anterior < atual ? atual : anterior;
	});
	$('.jsLegenda').height(anterior);
});

var _calc = 0;
var _heiFrame = 0;
$(function(){
	$('.jsLink').click(function(){
		var _link = $(this).attr('rel');
		switch (_link) {
			case '':
			case 0:
			case null:
			case undefined:
				$('#pageB').addClass('agrupaInt');
				break;
			default:
				var _html = '';

				_html = ('<iframe class="classFrame" border="0" src="' + _link + '"> </iframe>');

				$('#page').html(_html);
				$('#pageB').removeClass('agrupaInt');

				setTimeout("calcFrameHeight();", 250);
		}
		return false;
	});
});

function calcFrameHeight(){
	_calc++;
	if (_calc < 5){
		var _theFrame = $('.classFrame', parent.document.body);
		var _heiLocal = $(document.body).height() + 30;

		if (_heiLocal > _heiFrame){
			_heiFrame = _heiLocal;
			_theFrame.height(_heiFrame);
		}

		setTimeout("calcFrameHeight();", 500);
	}
}
