// PRELOAD DO MENU INTERNO
if( document.images ){
	img01 = new Image();
	img01.src = "../img/header_menu_01_on.gif";
	img02 = new Image();
	img02.src = "../img/header_menu_02_on.gif";
	img03 = new Image();
	img03.src = "../img/header_menu_03_on.gif";
	img04 = new Image();
	img04.src = "../img/header_menu_04_on.gif";
}

//VERIFICA FORMULARIO
function checa(){
	if(document.forms['formMissing'].name.value == ""){
		alert('Favor preencher o campo Name');
		document.forms['formMissing'].name.focus();
	}
	else if(document.forms['formMissing'].email.value == ""){
		alert('Favor preencher o campo E-mail');
		document.forms['formMissing'].email.focus();
	}
	else if (document.forms['formMissing'].email.value.indexOf('@', 0) == -1){
		alert('Favor preencher o campo com um E-mail válido');
		document.forms['formMissing'].email.focus();
	}
	else if(document.forms['formMissing'].message.value == ""){
		alert('Favor preencher o campo Message');
		document.forms['formMissing'].message.focus();
	}
	else{
		document.forms['formMissing'].submit();
	}
}

// FUNCAO PARA O MENU
function swapMenu( whatMenu ){
	if( document.images ){
		if( whatMenu != 0 ){
			eval( 'document.hMenu'+ whatMenu +'.src = "img/header_menu_0' + whatMenu + '_on.gif"' );
		}
		else{
			for( var i=1; i<=4; i++ ){
				eval( 'document.hMenu'+ i +'.src = "img/header_menu_0'+ i +'.gif"' );
			}
		}
	}
}

// FUNCAO PARA ABRIR POPUP CENTRALIZADO
function openPopup( sFile, sWindowName, iWidth, iHeight, bStatus, bScrollbars ){
	iLeft = ( screen.width - iWidth ) / 2;
	iTop = ( screen.height - iHeight ) / 2;

	sFeatures  = 'width=' + iWidth;
	sFeatures += ',height=' + iHeight;
	sFeatures += ',top=' + iTop;
	sFeatures += ',left=' + iLeft;
	sFeatures += ',status=' + bStatus;
	sFeatures += ',scrollbars=' + bScrollbars;

	open( sFile, sWindowName, sFeatures );
}

// FUNCAO PARA ENTRAR NO SITE
function openSite(){
	// vars flashPlugin e flashActivex vem de fora
	if ( flashPlugin || flashActivex ){
		openPopup( 'home.htm', 'SENTIMENTAL', 760, 420, 0, 0 );
	}
}

// FUNCAO PARA ABRIR POPUP DO VIDEO
function openVideo( whatVideo ){
	if( whatVideo != '' ){
		var strPopup = 'emotion_popup_'+ whatVideo +'.htm';
		openPopup( strPopup, 'SENTIMENTAL_VIDEOS', 310, 285, 0, 0 );
	}
}

// FUNCAO CHAMADA PELO FLASH PARA MUDAR DE PAGINA
function gotoPage( whatPage ){
	var sURL = '';
	if( whatPage == 'sentimentals' ){
		sURL = 'sentimentals_pedro.htm';
		//openPopup( 'sentimentals_diretores.htm', 'SENTIMENTALS_DIRETORES', 400, 262, 0, 0 );
	}
	else if( whatPage == 'mother' ){
		sURL = 'mother.htm';
	}
	else if( whatPage == 'emotion' ){
		sURL = 'emotion.htm';
	}
	else if( whatPage == 'missing' ){
		sURL = 'missing.htm';
	}
	else{
		return;
	}
	top.location.href = sURL;
}
