// JavaScript Document
var win = null;

function NovaJanela(pagina,nome,w,h,scroll)
{
	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='+scroll+',resizable'
	win = window.open(pagina,nome,settings);
}

function $(id) { return document.getElementById(id); }

function diminuiFonte() {
	var texto = $('internaTexto');
	var tamanho = texto.style.fontSize;
	
	tamanho = parseInt(tamanho.substring(0,tamanho.length-2));
	
	if (tamanho > 8) { tamanho--; }
	
	texto.style.fontSize = tamanho+"px";
}

function aumentaFonte() {
	var texto = $('internaTexto');
	var tamanho = texto.style.fontSize;
	
	tamanho = parseInt(tamanho.substring(0,tamanho.length-2));
	
	if (tamanho < 16) { tamanho++; }
	
	texto.style.fontSize = tamanho+"px";
}

function voltar() {
	window.history.go(-1);
}

function returnElementPosition(elem)
{
	var handler;
	var left = 0;
	var top = 0;
	
	handler = elem;
	while (handler)
	{
		left += handler.offsetLeft;
		handler = handler.offsetParent;
	}
	
	handler = elem;
	while (handler)
	{
		top += handler.offsetTop;
		handler = handler.offsetParent;
	}
	
	return Array(left,top)
}

function escreveFlash(file,w,h,vars)
{	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">\n');
	document.write('<param name="movie" value="'+file+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<param name="FlashVars" value="'+vars+'" />\n');
	document.write('<embed src="'+file+'" FlashVars="'+vars+'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'">\n');
	document.write('</embed></object>\n');
}
