var openDiv = null;
var last = '';
var win = null;

function showDiv(object, width, height) {
	scroll(0, 0);
	//centrar o popup na horizontal
	if(window.innerWidth) {
		document.getElementById(object).style.left = ((window.innerWidth / 2) - (width / 2)) + 'px';
	} else {
		document.getElementById(object).style.left = ((document.body.offsetWidth / 2) - (width / 2)) + 'px';
	}
	
	//centrar o popup na vertical
	if(window.innerHeight) {
		document.getElementById(object).style.top = ((window.innerHeight / 2) - (height / 2)) + 'px';
	} else {
		document.getElementById(object).style.top = ((document.body.offsetHeight / 2) - (height / 2)) + 'px';
	}
	
	document.getElementById('overlay_alert').style.display = 'block';
	document.getElementById(object).style.display = 'block';
	
	openDiv = object;
}

function hideDiv(object) {
	document.getElementById(object).style.display = 'none';
	document.getElementById('overlay_alert').style.display = 'none';
	openDiv = null;
}

function Centrar(pagina,titulo,w,h,scrollu,resize){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollu+',resizable='+resize+'';
	win = window.open(pagina,titulo,settings)
}