data = /^(0?[1-9]|[12]\d|3[01])\/(0?[1-9]|1[0-2])\/(19|20)?\d{2}$/;


tms=new Array()

//Mostra o submenu no mouseover
function over(n){
	if(typeof(tms[n])!="undefined")clearTimeout(tms[n])
	document.getElementById("s"+n).style.visibility="visible"
}
//Esconde o submenu no mouseout
function out(n){
	tms[n]=setTimeout('document.getElementById("s'+n+'").style.visibility="hidden"',100)
}
function MostraEsclarecimento(){
	var div = document.getElementById('home_esclarecimento');
	div.style.display = 'block';
}
function OcultaEsclarecimento(){
	var div = document.getElementById('home_esclarecimento');
	div.style.display = 'none';
}

function PassoaPasso(){
	w = 450;
	h = 380;
	largura = screen.width;
	altura = screen.height;
	XX =(largura-w)/2;
	YY = (altura-h)/2;
	janela = window.open('passoapasso.php','PASSOS','width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars=no, status=no, resizable=no, toolbar=no,directories=no,menubar=no');
	janela.focus();
}

function Chegar(){
	w = 779;
	h = 550;
	largura = screen.width;
	altura = screen.height;
	XX =(largura-w)/2;
	YY = (altura-h)/2;
	janela = window.open('../palestras/chegar.php','chegar','width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars=no, status=no, resizable=no, toolbar=no,directories=no,menubar=no');
	janela.focus();
}

// FUNÇÃO FLASH
function addSWF (URL, WIDTH, HEIGHT, TRANSPARENT){
	document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
	document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
	document.write (' <param name="movie" value="'+ URL +'" />');
	document.write (' <param name="quality" value="high" />');
		
	if ( TRANSPARENT ) {
		document.write (' <param name="Wmode" value="Transparent" />'); 
	}

	document.write (' <embed base="../swf/" src="'+ URL +'" quality="high" ');

	if ( TRANSPARENT ) {
		document.write (' Wmode = "transparent" ');
	}

	document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
	document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
	document.write (' </object>');
}

function sedex(){
	w = 400;
	h = 200;
	largura = screen.width;
	altura = screen.height;
	XX =(largura-w)/2;
	YY = (altura-h)/2;
	janela = window.open('http://www.cambio.com.br/luizvicentini/pop_sedex.php','SEDEX','width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars=no,status=no,resizable=no, toolbar=no,directories=no,menubar=no');
	janela.focus();
}



function numeros(e) {
	//tecla = event.keyCode;
	if (window.event)
		tecla = window.event.keyCode;
	else if (e)
		tecla = e.which;
	else
		return true;
	
	// Se for número (48 a 57), ou tecla de controle
	if ((tecla >= 48 && tecla <= 57) || (tecla == 0) || (tecla == 8) || (tecla == 9) || (tecla == 13) || (tecla == 27)) {
		return true;
	}
	else {
		return false;
	}
}

function abre_exame(cod){
	w = 620;
	h = 400;
	largura = screen.width;
	altura = screen.height;
	XX =(largura-w)/2;
	YY = (altura-h)/2;
	janela = window.open('exames.php?c='+cod,'POP_'+cod,'width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars=yes,status=no,resizable=no, toolbar=no,directories=no,menubar=no');
	janela.focus();
}

function valida_agendamento(frm){
	if (frm.cli_nome.value.length < 1){
		alert("Preencha o campo 'Nome'.");
		frm.cli_nome.focus();
		return (false);
	}
	if (frm.cli_ddd_telefone.value.length < 2){
		alert("Preencha o campo 'DDD'.");
		frm.cli_ddd_telefone.focus();
		return (false);
	}
	if (frm.cli_telefone.value.length < 1){
		alert("Preencha o campo 'Telefone'.");
		frm.cli_telefone.focus();
		return (false);
	}
	if (frm.cli_cpf.value.length < 11){
		alert("Preencha o campo 'CPF'.");
		frm.cli_cpf.focus();
		return (false);
	}
	if (frm.cli_email.value.length < 1){
		alert("Preencha o campo 'E-mail'.");
		frm.cli_email.focus();
		return (false);
	}
	if (!data.test(frm.age_data.value)){
		alert("Data Incorreta.");
		frm.age_data.focus();
		return (false);
	}
	return (true);
}

function valida_medico(frm){
	if (frm.med_nome.value.length < 1){
		alert("Preencha o campo 'Nome'.");
		frm.med_nome.focus();
		return (false);
	}
	if (frm.med_email.value.length < 1){
		alert("Preencha o campo 'E-mail'.");
		frm.med_email.focus();
		return (false);
	}
	if (frm.med_crm.value.length < 1){
		alert("Preencha o campo 'CRM'.");
		frm.med_crm.focus();
		return (false);
	}
	if (frm.med_senha.value.length < 6){
		alert("A senha deve possuir no mínimo 6 digitos.");
		frm.med_senha.focus();
		return (false);
	}
	return (true);
}