var Nono = null;
var PegaFlashNS;
function GetTotalFlash(Total,Menu){

	if(navigator.appName.indexOf("Microsoft") != -1){
		Movie=window.document.interna;
	}
	else{
		Movie=document.embeds[0];
	}
	

	if (Movie.PercentLoaded() == 100){


		
	if (Menu==1){
//		Movie.SetVariable("/:titulo","a_mundial");
		setTimeout('Movie.TGotoFrame("/titulos",2)',1000);
	}
	if (Menu==2){
//		Movie.SetVariable("/:titulo","responsabilidade_social");
		setTimeout('Movie.TGotoFrame("/titulos",6)',1000);
	}
	if (Menu==3){
//		Movie.SetVariable("/:titulo","relacao_com_investidores");
		setTimeout('Movie.TGotoFrame("/titulos",10)',1000);
	}
	if (Menu==4){
//		Movie.SetVariable("/:titulo","relacao_com_colaboradores");
		setTimeout('Movie.TGotoFrame("/titulos",14)',1000);
	}
	if (Menu==5){
//		Movie.SetVariable("/:titulo","oportunidades");
		setTimeout('Movie.TGotoFrame("/titulos",18)',1000);
	}
	if (Menu==6){
//		Movie.SetVariable("/:titulo","destaques_mundial");
		setTimeout('Movie.TGotoFrame("/titulos",22)',1000);
	}
	if (Menu==7){
//		Movie.SetVariable("/:titulo","downloads");
		setTimeout('Movie.TGotoFrame("/titulos",26)',1000);
	}
	if (Menu==8){
		setTimeout('Movie.TGotoFrame("/titulos",30)',1000);
//		Movie.SetVariable("/:titulo","sala_de_imprensa");
	}
	if (Menu==9){
		setTimeout('Movie.TGotoFrame("/titulos",34)',1000);
//		Movie.SetVariable("/:titulo","fale_conosco");
	}
	if (Menu==10){
		setTimeout('Movie.TGotoFrame("/titulos",38)',1000);
//		Movie.SetVariable("/:titulo","cadastrese");
	}

		clearInterval(Nono);
		
	}
}

function GetNSFlashPercent(Menu){
	if (document.embeds[0].PercentLoaded()==100){
		Nono = setInterval("GetTotalFlash(100,"+Menu+")",1000);
	}
}

function SetaTituloFlash(Menu)
{
		if(navigator.appName.indexOf("Microsoft") != -1){
			Movie=window.document.interna;
			Nono = setInterval("GetTotalFlash("+Movie.PercentLoaded()+","+Menu+")",1000);
		}
		else{
			Movie=document.embeds[0];
			var NSIntervalo = setInterval("GetNSFlashPercent("+Menu+")",1000)
		}
//		alert(Movie);
	

}

function MostraMenu(Menu,SubMenu){
//	alert("MostraMenu("+Menu+","+SubMenu+");");
//	alert(document.all.Menu1);
//	alert(document.getElementById('Menu1'));
//	alert(document.getElementById('Menu2'));
//	window.top.Menu=Menu;
//	window.top.SubMenu=SubMenu;
//	alert(document.getElementById('interna'));
//	window.top.Menu=Menu;
	try
	{
		if	(eval("document.getElementById('Sub"+Menu+"').style.display=='none'"))
			eval("document.getElementById('Sub"+Menu+"').style.display='block'");
		else
			eval("document.getElementById('Sub"+Menu+"').style.display='none'");
	
		if (SubMenu > "")
		{
		eval("document.getElementById('txtMenu"+SubMenu+"').className = 'ctTxtMenuLateralhover'");
		eval("document.getElementById('menu"+SubMenu+"').src = '../img/bulleto_menu_lateral.gif'");
		}
	}
	catch(e) {};
}

function EscondeLayerProcurarProduto(Status)
{
	var Layer =	document.getElementById('LayerProdutos');
	Layer.style.visibility = Status;
}

function VoltaMenuProdutosFlash()
{
	document.all.inicial.TGotoFrame("_level3/produtos_marcas/mc_linhas", 11);
	document.all.inicial.TPlay("_level3/produtos_marcas/mc_linhas");
}

function Trim(str)
{
	if ( str != "" && str != null )
	{
		while ( ( ( str.indexOf(" ") == 0 ) && ( str.indexOf(" ") != -1 )  ) || ( (str.lastIndexOf(" ") == str.length-1) && (str.lastIndexOf(" ") != -1)  ) )
		{
			str = str.replace(/^ /,"");
			str = str.replace(/ $/,"");
		}		
	}
	return(str);
}
	
function valida_email(strEmail) {

	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]?&'%~#´`"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	
	var matchArray=strEmail.match(emailPat)
	if (matchArray==null) {
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	
	if (user.match(userPat)==null) {
	    return false
	}
	
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
			return false
		    }
	    }
	    return true
	}
	
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
	    return false
	}
	
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
	    domArr[domArr.length-1].length>3) {
	   return false
	}
	
	if (len<2) {
	   return false
	}
	
	return true;
}

function fnc_KeyPressEnter1(tecla){
	if(tecla == 13){
		fnc_SendCadastroAssinante();
	}
}

function fnc_SendCadastroAssinante(){
	var strNome = document.all.fNome;
	var strEmail = document.all.fEmail;
	var strCodGrupo = document.all.fCodGrupo;
	var strPaginaDestino = document.location;

	if( Trim(strNome.value)=="" ){
		strNome.focus();
		alert("Por favor, digite seu nome.");
		return;
	}
	
	if( Trim(strEmail.value)=="" ){
		strEmail.focus();
		alert("Por favor, digite seu e-mail.");
		return;
	}
	
	if ( !(valida_email(Trim(strEmail.value))) ){
		strEmail.focus();
		alert("E-mail inválido.");
		return;
	}
	
	window.open("action_cadastrar_assinante.asp?fNome="+strNome.value+"&fEmail="+strEmail.value+"&fCodGrupo=<%=cst_CODGRUPO_PESSOA_IMPRENSA%>&fPaginaDestino="+strPaginaDestino,"_self");
}



function AbrePopup(){
	var largura_pos;
	var altura_pos;
	winWidth = 640;
    winHeight = 480;

	largura_pos = (screen.width / 2) - (640 / 2);
	altura_pos = (screen.height / 2) - (480 / 2);

	window.open('http://www.mundialbeautycare.com.br/hotsite/popup_kyos.html','','toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes,screenY=' + altura_pos + ',screenX=' + largura_pos + ',left=' + largura_pos + ',top=' + altura_pos + ',width='+winWidth+',height='+winHeight+'');
}

function AbrePopup_esp(){
	var largura_pos;
	var altura_pos;
	winWidth = 640;
    winHeight = 480;

	largura_pos = (screen.width / 2) - (640 / 2);
	altura_pos = (screen.height / 2) - (480 / 2);

	window.open('http://www.mundialbeautycare.com.br/hotsite/esp/popup_kyos.html','','toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes,screenY=' + altura_pos + ',screenX=' + largura_pos + ',left=' + largura_pos + ',top=' + altura_pos + ',width='+winWidth+',height='+winHeight+'');
}

function AbrePopup_eng(){
	var largura_pos;
	var altura_pos;
	winWidth = 640;
    winHeight = 480;

	largura_pos = (screen.width / 2) - (640 / 2);
	altura_pos = (screen.height / 2) - (480 / 2);

	window.open('http://www.mundialbeautycare.com.br/hotsite/eng/popup_kyos.html','','toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes,screenY=' + altura_pos + ',screenX=' + largura_pos + ',left=' + largura_pos + ',top=' + altura_pos + ',width='+winWidth+',height='+winHeight+'');
}