larguraMaxima = 800;
larguraMinima = 300;

larguraOriginal = 0;
alturaOriginal = 0;

function exibeJogos(enderecoJogo, altura, largura) {
	enderecoJogo = "/" + enderecoJogo;
	document.write('<embed id="jogoPapa" align="center" width="' + largura + '" height="' + altura + '" src="' + enderecoJogo + '" type="application/x-shockwave-flash" />');
	
	larguraOriginal = largura;
	alturaOriginal = altura;
}

function exibeJogosShockwave(enderecoJogo, altura, largura) {
	enderecoJogo = "/" + enderecoJogo;
	document.write('<embed id="jogoPapa" width="' + largura + '" height="' + altura + '" src="' + enderecoJogo + '" type="application/x-director" />');
}

function mudarTamanhoJogo(objeto, largura, altura) {
	objeto.setAttribute("width", largura);
	objeto.setAttribute("height", altura);
}

function aumentarJogo() {	
	var flash = document.getElementById("jogoPapa");	

	largura = Number(flash.width);	
	larguraProxima = Number(flash.width) + 30;	
	altura = Number(flash.height);
	
	if(larguraOriginal == larguraProxima) {
		document.getElementById("liRestaurar").style.display = 'none';
	} else {
		if(larguraOriginal != larguraMaxima) {
			document.getElementById("liRestaurar").style.display = 'inline';
		}
	}
	
	if(larguraProxima <= larguraMaxima) {			
		altura = Math.ceil((altura * ((larguraProxima * 100) / largura)) / 100);
		
		mudarTamanhoJogo(flash, larguraProxima, altura);	
	} else {
		if(largura != larguraMaxima) {
			altura = Math.ceil((altura * ((larguraMaxima * 100) / largura)) / 100);
			
			mudarTamanhoJogo(flash, larguraMaxima, altura);	
		}
	}
}

function diminuirJogo() {
	var flash = document.getElementById("jogoPapa");	

	largura = Number(flash.width);
	larguraProxima = Number(flash.width) - 30;
	altura = Number(flash.height);
	
	if(larguraOriginal == larguraProxima) {
		document.getElementById("liRestaurar").style.display = 'none';
	} else {
		document.getElementById("liRestaurar").style.display = 'inline';
	}
	
	
	if(larguraMinima <= larguraProxima) {			
		altura = Math.ceil((altura * ((larguraProxima * 100) / largura)) / 100);
		
		mudarTamanhoJogo(flash, larguraProxima, altura);	
	}
}

function restaurarJogo() {
	var flash = document.getElementById("jogoPapa");	
	
	document.getElementById("liRestaurar").style.display = 'none';
	
	mudarTamanhoJogo(flash, larguraOriginal, alturaOriginal);	
}

function maximizarJogo(url, jogoID) {
	var action = '/jogos_relacionados.php?id=' + jogoID;
	divAjax('divJogoJogo', action);
	
	document.getElementById("ulOpcao2").style.display = 'none';
	
	window.open(url, "", "type=fullWindow,fullscreen,resizable");
}

function setarTamanhoJogo(largura, altura) {
	larguraOriginal = largura;
	alturaOriginal = altura;
}

function popUp(popupURL){ 
width = 975; 
height = 630; 
leftPosition = (screen.width) ? (screen.width-width)/2 : 0; 
 
if (screen.height && (screen.height <= 600)) { 
	topPosition = 0; 
} else { 
	topPosition = (screen.height) ? (screen.height-height)/2 : 0; 
}      
	var settings='width='+width+',height='+height+',left='+leftPosition+',top='+topPosition+'toolbar=0,location=0,directories=0,menubar=0,scrollbar=0,resizable=0,status=0';      
	var popup=window.open(popupURL, 'gamepopup', settings); popup.focus();     
}    
	