var active = false;
var flash_version = true;
var so = null;
var winW = 0;
var winH = 0;

function changeLang( lang )
{
	if (lang!="pt")
		document.getElementById('rights').innerHTML = "All rights reserved.";
	return true;
}

function setNavActive()
{
	active = true;
	
	// Show buttons
	document.getElementById('buttons').style.display = "block";
	return true;
}

function init()
{
	so = new SWFObject(
	      'aya.swf',
	      'flash',
	      '780',
	      '460',
	      '7',
	      '#CCCCCC');
	so.addParam('quality','high');
	so.addParam('wmode','transparent');
	so.addParam('ontop','false');
	so.addParam('menu','false');
	so.write('flashcontent');
	
	document.getElementById('flashcontent').style.display = "block";
	
	if (!so) 
	{
		document.getElementById('flashcontent').style.display = "block";
		document.getElementById('buttons').style.display = "block";
		flash_version = false;
	}
	
	// Center page
	if (parseInt(navigator.appVersion)>3)
	{
		if (navigator.appName=="Netscape")
		{
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1)
		{
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	
	var obj = document.getElementById('site');
	contentHeight = (obj.clientHeight)? obj.clientHeight : obj.offsetHeight;
	
	if (contentHeight>=winH) obj.style.marginTop = "10px";
	else
		obj.style.marginTop = Math.round((winH-contentHeight)/2)+"px";
}

function thisMovie(movieName)
{
	// IE and Netscape refer to the movie object differently.
	// This function returns the appropriate syntax depending on the browser.
	if (navigator.appName.indexOf ("Microsoft") !=-1) 
		return window[movieName];
	else
		return document[movieName];
}

function openPage( code )
{
	if (thisMovie('flash')!=undefined && thisMovie('flash')!=null)
	{
		if (active) thisMovie('flash').getPage( code );
		else 
		{
			if (flash) alert('Wait a moment while the site starts');
			return;
		}
	}
}