<!--
var ie45,ns6,ns4,dom,el,els;
if (navigator.appName=="Microsoft Internet Explorer")
  	ie45=parseInt(navigator.appVersion)>=4;
else if (navigator.appName=="Netscape"){
	ns6=parseInt(navigator.appVersion)>=5;
	ns4=parseInt(navigator.appVersion)<5;}

dom=ie45 || ns6;

function open_media() {
	url = "http://www2.accon.com.br/stabranca.com.br/open_media.asp";
	window.open(url,"Media_StaBranca","width=295,height=355,left=400,top=250,resizable=no,scrollbars=no,resizable=no").focus();
}


var imagesa = new Array();

//imagesa[1]='images/gal_1.jpg';
imagesa[1]='images/tirolesa.jpg';
//imagesa[2]='images/gal_2.jpg';
imagesa[2]='images/morada.jpg';
imagesa[3]='images/arara.jpg';
imagesa[4]='images/aqua_ride.jpg';
imagesa[5]='images/gal_5.jpg';
imagesa[6]='images/gal_6.jpg';

imagesa[7]='images/piscinas_01.jpg';
imagesa[8]='images/piscinas_02.jpg';
imagesa[9]='images/piscinas_03.jpg';
imagesa[10]='images/pousada_01.jpg';
imagesa[11]='images/pousada_02.jpg';
imagesa[12]='images/pousada_03.jpg';

imagesa[13]='images/tirolesa_01.jpg';
imagesa[14]='images/tirolesa_02.jpg';
imagesa[15]='images/tirolesa_03.jpg';
imagesa[16]='images/trilhas_01.jpg';
imagesa[17]='images/trilhas_02.jpg';
imagesa[18]='images/trilhas_03.jpg';

imagesa[19]='images/minigolf_01.jpg';
imagesa[20]='images/minigolf_02.jpg';
imagesa[21]='images/caverna_grande.jpg';
imagesa[22]='images/cavalgada_santabranca.jpg';

var credito = new Array();
credito[1]='Rodrigo Yamada - Accon fone: (62) 242 0172';
credito[2]='Rodrigo Yamada - Accon fone: (62) 242 0172';
credito[3]='Rodrigo Yamada - Accon fone: (62) 242 0172';
credito[4]='Rodrigo Yamada - Accon fone: (62) 242 0172';
credito[5]='Rodrigo Yamada - Accon fone: (62) 242 0172';
credito[6]='Rodrigo Yamada - Accon fone: (62) 242 0172';

credito[7]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[8]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[9]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[10]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[11]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[12]='Luis - (62) 282 1702 - photolaam@ad.com';

credito[13]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[14]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[15]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[16]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[17]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[18]='Luis - (62) 282 1702 - photolaam@ad.com';

credito[19]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[20]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[21]='Luis - (62) 282 1702 - photolaam@ad.com';
credito[22]='Luis - (62) 282 1702 - photolaam@ad.com';


	
function getCellValue (cellOrId) {
  var cell = 
    typeof cellOrId == 'string' ? 
      (document.all ? document.all[cellOrId] : document.getElementById
(cellOrId)) :
      cellOrId;
  if (document.all)
    return cell.innerText;
  else {
    cell.normalize();
    if (cell.firstChild.nodeType == 3)
      return cell.firstChild.nodeValue;
    else 
      return '';
  }
}

function setCellValue (cellOrId,value) {
  var cell = 
    typeof cellOrId == 'string' ? 
      (document.all ? document.all[cellOrId] : document.getElementById
(cellOrId)) :
      cellOrId;
  if (document.all)
    cell.innerText = value;
  else {
    cell.normalize();
    if (cell.firstChild.nodeType == 3)
      cell.firstChild.nodeValue = value;
    else 
      return '';
  }
}


function valida (form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    if (el.type == 'text' || el.type == 'textarea' ||
        el.type == 'password' || el.type == 'file' ) { 
      if ((el.value == '')&&(!(el.disabled))&&(!(el.readonly))&&((el.alt!=-1))) {
        alert('Você deve preencher o campo ' + el.id);
        el.focus();
        return false;
      }
    }
    else if (el.type=='select') {
      if (el.selectedIndex == 0) {
        alert('Você deve selecionar um valor no campo ' + el.id);
        el.focus();
        return false;
      }
    }
    else if (el.type == 'radio') {
      var group = form[el.name];
      var checked = false;
      if (!group.length)
        checked = el.checked;
      else
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
      if (!checked) {
        alert('Você deve escolher uma das opções no campo ' + el.id);
        el.focus();
        return false;
      }
    }
    else if (el.type == 'checkbox') {
      var group = form[el.name];
      if (group.length) {
        var checked = false;
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
        if (!checked) {
          alert('Você deve escolher pelo menos uma das opções no campo ' + el.id);
          el.focus();
          return false;
        }
      }
    }
  }
  
if ((form)!=null) {
	 if (form.p_email != null) {
		 if (!isEmailAddress(form.p_email.value)) {
		    alert('Email inválido! Digite um email válido!');
		    form.p_email.focus();
		    form.p_email.select();
			return false;
		  }
	  }
	  
	 /*if (form.p_assunto != null) {
	  if (form.p_assunto.selectedIndex == 0) {
        alert('Você deve selecionar um assunto');
        form.p_assunto.focus();
        return false;
      }
	 } */

	 if (form.p_mensagem != null) {
		 form.p_mensagem.value = trimString(form.p_mensagem.value);
		 if (form.p_mensagem.value.length == 0) {
		    alert('Você deve digitar uma mensagem!');
		    form.p_mensagem.focus();
		    form.p_mensagem.select();
			return false;
		  }
	 }   


}  
  return true;
}

function valida2 (form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    if (el.type == 'text' || el.type == 'textarea' ||
        el.type == 'password' || el.type == 'file' ) { 
      if ((el.value == '')&&(!(el.disabled))&&(!(el.readonly))&&((el.alt!=-1))) {
        alert('Você deve preencher o campo ' + el.id);
        el.focus();
        return false;
      }
    }
    else if (el.type=='select') {
      if (el.selectedIndex == 0) {
        alert('Você deve selecionar um valor no campo ' + el.id);
        el.focus();
        return false;
      }
    }
    else if (el.type == 'radio') {
      var group = form[el.name];
      var checked = false;
      if (!group.length)
        checked = el.checked;
      else
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
      if (!checked) {
        alert('Você deve escolher uma das opções no campo ' + el.id);
        el.focus();
        return false;
      }
    }
    else if (el.type == 'checkbox') {
      var group = form[el.name];
      if (group.length) {
        var checked = false;
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
        if (!checked) {
          alert('Você deve escolher pelo menos uma das opções no campo ' + el.id);
          el.focus();
          return false;
        }
      }
    }
  }
  
if ((form)!=null) {
	 if (form.p_email != null) {
		 if (!isEmailAddress(form.p_email.value)) {
		    alert('Email inválido! Digite um email válido!');
		    form.p_email.focus();
		    form.p_email.select();
			return false;
		  }
	  }
	  
	 if (form.p_assunto != null) {
	  if (form.p_assunto.selectedIndex == 0) {
        alert('Você deve selecionar um assunto');
        form.p_assunto.focus();
        return false;
      }
	 } 

	 if (form.p_mensagem != null) {
		 form.p_mensagem.value = trimString(form.p_mensagem.value);
		 if (form.p_mensagem.value.length == 0) {
		    alert('Você deve digitar uma mensagem!');
		    form.p_mensagem.focus();
		    form.p_mensagem.select();
			return false;
		  }
	 }   


}  
  return true;
}
function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function isEmailAddress (string) {
  var addressPattern = 
    /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
  return addressPattern.test(string);
}

function checkMaxLength (textarea, evt, maxLength,form) {
  if (textarea.selected && evt.shiftKey) 
	// ignore shift click for select
    return true;
  var allowKey = false;
  if (textarea.selected && textarea.selectedLength > 0)
    allowKey = true;
  else {
    var keyCode = 
      document.layers ? evt.which : evt.keyCode;
	    //alert(keyCode);  
    if (keyCode < 32 && keyCode != 13 || ((keyCode >= 37)&&(keyCode <=40)))
      allowKey = true;
    else {
      allowKey = textarea.value.length < maxLength;
	}  

	
  }
  
	  

  textarea.selected = false;
  return allowKey;
}

function storeSelection (field) {
  if (document.all) {
    field.selected = true;
    field.selectedLength = 
      field.createTextRange ?
        document.selection.createRange().text.length : 1;
  }
}

function contac(ta,maxLength,obj) {
 obj.value = (maxLength - (ta.value.length+1));
}


function nav_action(cod) {

	if (cod == 1) { //menu adicionar eventos
		location = "adicionar_eventos.php";
	}
	
	if (cod == 2) { //menu editar eventos
		location = "listar_eventos.php";
	}

	if (cod == 3) { //menu excluir eventos
		location = "excluir_lista_eventos.php";
	}

	if (cod == 4) { //menu adicionar novidades
		location = "adicionar_novidades.php";
	}

	if (cod == 5) { //menu editar novidades
		location = "listar_novidades.php";
	}
	
	if (cod == 6) { //menu excluir novidades
		location = "excluir_novidades.php";
	}
	
	if (cod == 7) { //menu relat acesso
		//location = "ecluir_novidades.php";
		alert ("Ainda não disponível !!");
	}
	
	if (cod == 8) { //menu relat cadastros
		//location = "ecluir_novidades.php";
		alert ("Ainda não disponível !!");
	}
	
}

function naveg(cod,oid) {

	if (cod == 1) { //menu home
		//document.imgr1.src = images1[1];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "home.php";
	}
	
	if (cod == 2) { //menu empresa
		//document.imgr1.src = images1[5];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "empresa.php";
	}

	if (cod == 3) { //menu servicos
		//document.imgr1.src = images1[8];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "servicos.php";
	}

	if (cod == 4) { //menu solucoes corporativas
		//document.imgr1.src = images1[6];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "corporativos.php";
	}

	if (cod == 5) { //menu clientes
		//document.imgr1.src = images1[9];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "clientes.php";
	}
	
	if (cod == 6) { //menu contato
		//document.imgr1.src = images1[2];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "contato.php";
	}

	if (cod == 7) { //barra accon
		//document.imgr1.src = images1[3];
		foid = document.all ? document.all[oid] : 
		dom ? document.getElementById(oid) : 
		document.layers[oid];
		foid.src = "creditos.php";
	}
	
}


function voltar_menu() {

	location="index.php";
	
}

function voltar_lista_eventos() {

	location="listar_eventos.php";

}


function voltar_lista_novidades() {
	location="listar_novidades.php";
}

function recarrega() {
   setTimeout("go_now()",2000);
}

function go_now() {
        location="index.php";
}

function recarrega_eventos() {
   setTimeout("go_now_eventos()",2000);
}

function go_now_eventos() {
        location="listar_eventos.php";
}

function recarrega_novidades() {
   setTimeout("go_now_novidades()",2000);
}

function go_now_novidades() {
        location="listar_novidades.php";
}


function fecha_janela(){
	window.close();
}

function conf_excluir() {
	if (!confirm (" Deseja excluir esse evento ?")) {
		return false ;
	}
}

function conf_excluir_nov() {
	if (!confirm (" Deseja excluir essa novidade ?")) {
		return false ;
	}
}

function conf_edicao() {
	if (!confirm (" Deseja editar esse evento ?")) {
		return false ;
	}
}

function fotos(cod) {
	var url = "eco_fotos.php?codigo=" + cod;
	window.open(url,"eco_fotos","resize=no,scrollbars=no,screenX=1,screenY=1,left=1,top=1,width=340,height=270").focus();
}

function abre_fotos(nome) {
	var url = "eco_fotos.php?nome_foto=" + nome;
	window.open(url,"eco_fotos","resize=no,scrollbars=no,screenX=1,screenY=1,left=1,top=1,width=340,height=270").focus();
}


function change_image(x) {
 	el = parent.document.all ? parent.document.all["im"] : 
	dom ? parent.document.getElementById("im") : 
	parent.document.layers["im"];
	el.src=imagesa[x];
	
	parent.document.all.creditos.innerHTML = "<FONT style='font:9px;color=#000000;'>Créditos: " + credito[x] + "</font>";
	parent.document.all.numero.innerHTML = "<FONT style='font:9px Verdana;color=#000000;'>Número: " + x + "</font>";
	
 	
}

function abre_galeria() {
	var url = "galeria.php";
    //alert("estou aqui");
	window.open(url,"galeria","resize=no,scrollbars=no,screenX=1,screenY=1,left=1,top=1,width=470,height=349").focus();
}

function abre_galeria2() {
	var url = "galeria2.php";
    //alert("estou aqui");
	window.open(url,"galeria2","resize=no,scrollbars=no,screenX=1,screenY=1,left=1,top=1,width=1000,height=700").focus();
}

function abre_eventos(cod) {
	var url = "eventos_detalhe.php?evt_codigo=" + cod;
	window.open(url,"eventos","resize=no,scrollbars=yes,screenX=1,screenY=1,left=1,top=1,width=600,height=400").focus();
}

function abre_direto(cod) {
	//var url = cod;
	window.location.href(cod);
	//window.open(url,"eventos","resize=yes,scrollbars=yes,screenX=0,screenY=0,left=0,top=0").focus();
}


function abre_mapa() {
	var url = "mapa.html";
	window.open(url,"mapa","scrollbars=no,left=1,top=1,width=400,height=510").focus();
}

function abre_faleconosco() {
	var url = "fale.php";
	window.open(url,"fale","resize=no,scrollbars=no,screenX=1,screenY=1,left=1,top=1,width=455,height=290").focus();
}

function abre_novidades(cod) {
	var url = "novidades_detalhe.php?nov_codigo=" + cod;
	window.open(url,"novidades","resize=no,scrollbars=yes,screenX=1,screenY=1,left=1,top=1,width=600,height=420").focus();
}

//-->
