
function criticar () {

    nome= document.form1
    email = document.form1
   

    if (nome.ds_nome.value=="") {
    alert("campo Nome está em branco") 
    nome.ds_nome.focus()
    return false;}

    if (email.ds_email.value.indexOf ('@',0) == -1 || email.ds_email.value.indexOf ('.',0) == -1){
    alert("E-mail invalido")
    email.ds_email.select()
    return false;}

  
}

function valida() {

    email_home = document.form1

    if (email_home.ds_email.value.indexOf ('@',0) == -1 || email_home.ds_email.value.indexOf ('.',0) == -1){
    alert("E-mail invalido")
    email_home.ds_email.select()
    return false;}


}


function valida_inscricao() {

   	nome = document.form1
        email = document.form1
	tel = document.form1
	rz = document.form1
	end = document.form1
	cidade = document.form1
	estado = document.form1
	cep = document.form1
	cnpj = document.form1
	ie = document.form1
        part1 = document.form1
        email_part1 = document.form1
        tel_part1 = document.form1
        escolhe = document.counter
	

       if (nome.ds_nome.value=="") {
       alert("campo Nome está em branco") 
       nome.ds_nome.focus()
       return false;}

       if (email.ds_email.value.indexOf ('@',0) == -1 || email.ds_email.value.indexOf ('.',0) == -1){
       alert("E-mail invalido")
       email.ds_email.select()
       return false;}

       if (tel.ds_tel.value=="") {
       alert("campo Telefone está em branco") 
       tel.ds_tel.focus()
       return false;}


       if (rz.ds_rz_soc.value=="") {
       alert("campo Razão Social está em branco") 
       rz.ds_rz_soc.focus()
       return false;}


       if (end.ds_end.value=="") {
       alert("campo Endereço está em branco") 
       end.ds_end.focus()
       return false;}


       if (cidade.ds_cidade.value=="") {
       alert("campo Cidade está em branco") 
       cidade.ds_cidade.focus()
       return false;}


       if (estado.ds_estado.value=="") {
       alert("campo Estado está em branco") 
       estado.ds_estado.focus()
       return false;}

       if (cep.ds_cep.value=="") {
       alert("campo Cep está em branco") 
       cep.ds_cep.focus()
       return false;}


       if (cnpj.ds_cnpj.value=="") {
       alert("campo CNPJ está em branco") 
       cnpj.ds_cnpj.focus()
       return false;}
   
       if (ie.ds_ie.value=="") {
       alert("campo IE está em branco") 
       ie.ds_ie.focus()
       return false;}

      if (escolhe.number.selectedIndex==0) {
      alert("Por favor selecione pelo menos um Participante") 
      escolhe.number.focus()
      return false;}


       if (part1.participante1.value=="") {
       alert("Campo Nome do Partipante está em branco") 
       part1.participante1.focus()
       return false;}

       if (email_part1.email_participante1.value=="") {
       alert("Campo E-mail do Partipante está em branco") 
       email_part1.email_participante1.focus()
       return false;}


       if (tel_part1.tel_participante1.value=="") {
       alert("Campo Telefone do Partipante está em branco") 
       tel_part1.tel_participante1.focus()
       return false;}



}


function valida_inconpany() {

   	nome = document.form1
        email = document.form1
	tel = document.form1
	depto = document.form1
        cargo = document.form1
	razao = document.form1
	end = document.form1
	cidade = document.form1
	estado = document.form1
	cep = document.form1
	cnpj = document.form1
	ie = document.form1
        curso = document.form1
	

       if (nome.ds_nome.value=="") {
       alert("campo Nome está em branco") 
       nome.ds_nome.focus()
       return false;}

       if (email.ds_email.value=="") {
       alert("campo E-mail está em branco") 
       email.ds_email.focus()
       return false;}

       if (email.ds_email.value.indexOf ('@',0) == -1 || email.ds_email.value.indexOf ('.',0) == -1){
       alert("E-mail invalido")
       email.ds_email.select()
       return false;}

       if (tel.ds_tel.value=="") {
       alert("campo Telefone está em branco") 
       tel.ds_tel.focus()
       return false;}

       if (depto.ds_depto.value=="") {
       alert("campo Departamento está em branco") 
       depto.ds_depto.focus()
       return false;}

       if (cargo.ds_cargo.value=="") {
       alert("campo Cargo está em branco") 
       cargo.ds_cargo.focus()
       return false;}

       if (razao.ds_rz_soc.value=="") {
       alert("campo Razão Social está em branco") 
       razao.ds_rz_soc.focus()
       return false;}


       if (end.ds_end.value=="") {
       alert("campo Endereço está em branco") 
       end.ds_end.focus()
       return false;}

       if (cidade.ds_cidade.value=="") {
       alert("campo Cidade está em branco") 
       cidade.ds_cidade.focus()
       return false;}

       if (estado.ds_estado.value=="") {
       alert("campo Estado está em branco") 
       estado.ds_estado.focus()
       return false;}


       if (cep.ds_cep.value=="") {
       alert("campo Cep está em branco") 
       cep.ds_cep.focus()
       return false;}

 
      if (curso.ds_curso.selectedIndex==0) {
      alert("Por favor selecione pelo menos um curso") 
      curso.ds_curso.focus()
      return false;}


}


window.defaultStatus="www.tgtreinamento.com.br"

if (window!= top)
top.location.href=location.href;


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//imagem randômica

Fotografia = new Array("img/fotos/01.jpg","img/fotos/02.jpg","img/fotos/03.jpg","img/fotos/04.jpg","img/fotos/05.jpg","img/fotos/06.jpg","img/fotos/07.jpg")
	imgCt = Fotografia.length 

	function novaImagem() {
		if (document.images) {
			randomNum = Math.floor((Math.random() * imgCt))
			document.Foto.src = Fotografia[randomNum]
		}
	}

	
//ilumina os forms	
	
var highlightcolor="#ffffcc"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

var intended=/INPUT|TEXTAREA|SELECT|OPTION/


function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}

// janela do cadastro

function createTarget(t){
window.open("", t, "width=400,height=180");
return true;
}
	
	
// Pop-up artigos

var win = null;
function Popup(mypage,myname,settings){
LeftPosition = (screen.width) ? (screen.width-500)/2 : 0;
TopPosition = (screen.height) ? (screen.height-370)/2 : 0;
settings =
'height=370,width=500,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable'
win = window.open(mypage,myname,settings)

}	