function showhide(itemMenu) {
	if (document.getElementById(itemMenu).style.display == "block") {
		hide(itemMenu);
	} else {
		show(itemMenu);
	}
}

function show(itemMenu){
	document.getElementById(itemMenu).style.display = "block";
}

function hide(itemMenu){
	document.getElementById(itemMenu).style.display = "none";
}

//-------------------- SIMULADOR --------------------
var iFirstChoice;
var iSecondChoice;
var iThirtyChoice;

function step1(iChoice)
{
	resetForm(1);
	
	iFirstChoice = iChoice;
	iSecondChoice = null;
	iThirtyChoice = null;
	
	if (iChoice==1)
	{
		showQuestion(2);
		hideQuestion(3);
		hideQuestion(4);
	}
	else 
	{
		hideQuestion(2);
		hideQuestion(3);	
		showQuestion(4);
	}
	hide("portaFlash");
}

function step2(iChoice)
{
	resetForm(2);
	
	iSecondChoice = iChoice;

	showQuestion(3);
	hideQuestion(4);
	
	hide("portaFlash");
}
function step3(iChoice)
{
	iThirtyChoice = iChoice;
	writeFlash();
}

function showQuestion(iQuestion)
{
	show("pergunta" + iQuestion);
}
function hideQuestion(iQuestion)
{
	hide("pergunta" + iQuestion);
}

function resetForm(iLevel)
{
	if (iLevel < 1)
	{
		document.forms[0].radio1[0].checked=false;
		document.forms[0].radio1[1].checked=false;			
	}
	if (iLevel < 2)
	{
		document.forms[0].radio2[0].checked=false;
		document.forms[0].radio2[1].checked=false;			
	}
	if (iLevel < 3)
	{
		document.forms[0].radio3[0].checked=false;
		document.forms[0].radio3[1].checked=false;	
		document.forms[0].radio3[2].checked=false;
		document.forms[0].radio3[3].checked=false;	
		document.forms[0].radio3[4].checked=false;
		document.forms[0].radio3[5].checked=false;		
		
		document.forms[0].radio4[0].checked=false;
		document.forms[0].radio4[1].checked=false;	
		document.forms[0].radio4[2].checked=false;
		document.forms[0].radio4[3].checked=false;	
	}
}

function writeFlash()
{
	var so = new SWFObject("swf/box2.swf", "pacoteIndicado", "920", "370", "9", "#ffffff");
	
	so.useExpressInstall('swf/expressinstall.swf');
	so.addParam("quality", "high");
	so.addParam("menu", false);
	so.addParam("scale","noscale");
	so.addParam("wmode","transparent");
	
	_iFirstChoice 	= (iFirstChoice  == null) ? "" : iFirstChoice;
	_iSecondChoice 	= (iSecondChoice == null) ? "" : iSecondChoice;
	_iThirtyChoice	= (iThirtyChoice == null) ? "" : iThirtyChoice;
	
	so.addVariable("q1", _iFirstChoice);
	so.addVariable("q2", _iSecondChoice);
	so.addVariable("q3", _iThirtyChoice);
	
	show("portaFlash");	
	so.write("portaFlash");	
	
	location.href = "#resultado";
}

function delicious()
{
	window.open('http://delicious.com/save?jump=close&v=4&noui&jump=close&url=http://www.powergvt.com.br/&title=Power GVT. Desafio das velocidades.');
}
function twitter()
{
	window.open('http://twitter.com/home?status=Desafie sua Internet. Serah que ela aguenta o tranco? Descubra em http://www.powergvt.com.br/');
}
function facebook()
{	
	window.open('http://www.facebook.com/sharer.php?u=' + location.href + '&t=' + document.title);
}
function favoritos()
{
	window.external.AddFavorite(location.href, document.title);
}