Event.observe(window, 'load', function() {
	var h2 = document.getElementsByTagName("h2");
	
	Flash.write(
		h2[0], 
		[
			'width', '350',
			'height', '26',
			'src', '/web/swf/prj_name',
			'id', 'PrjTitle',
			'name', 'PrjTitle',
			'movie', '/web/swf/prj_name',
			'wmode', 'transparent',
			'align', 'left',
			'FlashVars', "id=PrjTitle&texto=" + URLEncode(h2[0].innerHTML.tagsToLower().replaceAll("\t", "")) 
		] 
	);
	h2[0].className = h2[0].className.replaceAll("Invisible", "");
	
	resizeImagesBox($Class("images", "image"));
	$("images").className = $("images").className.replaceAll("Invisible", ""); 
});

function resizeImagesBox(cImg) {
	var isIE6 = navigator.appVersion.indexOf("MSIE 6.0") > -1;
	var imagesHeightPadding = parseInt(Element.getStyle($("images"), "padding-bottom")) + parseInt(Element.getStyle($("images"), "padding-top"));
	
	var imgsHeightPadding = parseInt(Element.getStyle($("imgs"), "padding-bottom")) + parseInt(Element.getStyle($("imgs"), "padding-top"));
	var imgsWidthPadding = parseInt(Element.getStyle($("imgs"), "padding-right")) + parseInt(Element.getStyle($("imgs"), "padding-left"));
	
	var toHImages = ($(cImg).offsetHeight + (isIE6 ? imagesHeightPadding : 0)) * 100 / $("images").offsetHeight;
	var toWImgs = ($(cImg).offsetWidth + (isIE6 ? imgsWidthPadding : 0)) * 100 / $("imgs").offsetWidth;
	var toHImgs = ($(cImg).offsetHeight + (isIE6 ? imgsHeightPadding : 0)) * 100 / $("imgs").offsetHeight;
	
	if ($("imgs").offsetWidth > imgsWidthPadding && Imgs && Imgs.currentPage > 0) {
		new Effect.Parallel([
			new Effect.Scale($("images"), 100.0, {
				sync: true,
				scaleX: false,
				scaleContent: false,
				scaleFrom: 100 * parseInt(Element.getStyle($("images"), "height")) / $("images").offsetHeight,
				scaleTo: toHImages
			}),
			
			new Effect.Scale($("imgs"), 100.0, {
				sync: true,
				scaleY: false,
				scaleContent: false,
				scaleFrom: 100 * parseInt(Element.getStyle($("imgs"), "width")) / $("imgs").offsetWidth,
				scaleTo: toWImgs
			}),
			
			new Effect.Scale($("imgs"), 100.0, {
				sync: true,
				scaleX: false,
				scaleContent: false,
				scaleFrom: 100 * parseInt(Element.getStyle($("imgs"), "height")) / $("imgs").offsetHeight,
				scaleTo: toHImgs
			})
		], {
			duration: 1
		});
	} else { 
		Element.setStyle(
			"images", 
			{ 
				height: ($(cImg).offsetHeight + (isIE6 ? imagesHeightPadding : 0)) + "px"
			}
		);
		
		Element.setStyle(
			"imgs", 
			{ 
				height: ($(cImg).offsetHeight + (isIE6 ? imgsHeightPadding : 0)) + "px",
				width: ($(cImg).offsetWidth + (isIE6 ? imgsWidthPadding : 0)) + "px"
			}
		);
		
		if (isIE6) {
			Element.setStyle(
				$Class("images", "left"), 
				{ 
					height: ($(cImg).offsetHeight + (isIE6 ? imgsHeightPadding : 0)) + "px"
				}
			);
			
			Element.setStyle(
				$Class("images", "right"), 
				{ 
					height: ($(cImg).offsetHeight + (isIE6 ? imgsHeightPadding : 0)) + "px"
				}
			);
		}
	}
}
