function getTamanhoJanela() {
	var dimensions = {width: 0, height: 0};
	if (document.documentElement) {
		dimensions.width = document.documentElement.offsetWidth;
		dimensions.height = document.documentElement.offsetHeight;
	} else if (window.innerWidth && window.innerHeight) {
		dimensions.width = window.innerWidth;
		dimensions.height = window.innerHeight;
	}
	return dimensions;
}

function getPageSizeWithScroll()
{
	if ( window.innerHeight && window.scrollMaxY )	{
// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY ;
		xWithScroll = window.innerWidth + window.scrollMaxX ;
	} else if ( document.body.scrollHeight > document.body.offsetHeight ) { 
// all but Explorer Mac
		yWithScroll = document.body.scrollHeight ;
		xWithScroll = document.body.scrollWidth ;
	} else { 
// works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight ;
		xWithScroll = document.body.offsetWidth ;
	}
	
	arrayPageSizeWithScroll = {
		width: xWithScroll,
		height: yWithScroll
	};

	return arrayPageSizeWithScroll;
}


function ajustarFX() {
	var view = getPageSizeWithScroll();
	jQuery('#overlay_fx').get(0).style.width = view.width+'px';
	jQuery('#overlay_fx').get(0).style.height = view.height+'px';
}

function ativarFrame(src,w,h) {
	ajustarFX();
	
	var janela = getTamanhoJanela();
	jQuery('#div_fx').get(0).style.width = w+'px';
	jQuery('#div_fx').get(0).style.height = (h)+'px';
	
	var topo = parseInt((janela.height/2)-((h)/2));
	if (topo<=0) topo = 5;
	
	jQuery('#div_fx').get(0).style.top = topo+'px';
	jQuery('#div_fx').get(0).style.left = parseInt((janela.width/2)-(w/2))+'px';
	
	
	jQuery('#frame_fx').get(0).style.width = w+'px';
	jQuery('#frame_fx').get(0).style.height = h+'px';
	
	var frame = window.open(src,'frame_fx');
	frame.opener = self;
	
	jQuery('#overlay_fx').show();
	jQuery('#div_fx').show();

}
	
