// abre imagem


function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}



// Menu


if(document.images) {
img1on=new Image();
img1on.src="imagens/b1a.gif";
img2on=new Image();
img2on.src="imagens/b2a.gif";
img3on=new Image();
img3on.src="imagens/b3a.gif";
img4on=new Image();
img4on.src="imagens/b4a.gif";
img5on=new Image();
img5on.src="imagens/b5a.gif";



img1off=new Image();
img1off.src="imagens/b1b.gif";
img2off=new Image();
img2off.src="imagens/b2b.gif";
img3off=new Image();
img3off.src="imagens/b3b.gif";
img4off=new Image();
img4off.src="imagens/b4b.gif";
img5off=new Image();
img5off.src="imagens/b5b.gif";


}
function imgOn(imgName) {
if (document.images) {
	document[imgName].src=eval(imgName+"on.src"); }}
	
function imgOff(imgName) {
if (document.images) {
	document[imgName].src=eval(imgName+"off.src"); }}
	
// fim menu


// abre imagem2


var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}


// fim abre imagem


// trocafoto com link modificado para 2 caixas

// Tempo de Cada Foto (Mili segundos)
var slideShowSpeed = 5000

// Duração do Fade (segundos)
var crossFadeDuration = 3

var Pic = new Array()
var Link = new Array()
var Pic2 = new Array()
var Link2 = new Array()
var Pic3 = new Array()
var Link3 = new Array()


Pic[0] = 'imagens/fotoinicio1.jpg';
Pic[1] = 'imagens/fotoinicio2.jpg';
Pic[2] = 'imagens/fotoinicio3.jpg';
Pic[3] = 'imagens/fotoinicio4.jpg';
Pic[4] = 'imagens/fotoinicio5.jpg';

Pic2[0] = 'imagens/vert1.jpg';
Pic2[1] = 'imagens/vert2.jpg';
Pic2[2] = 'imagens/vert3.jpg';


var t
var t2

var j = 0
var j2 = 0

var p = Pic.length
var p2 = Pic2.length


var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}
var preLoad2 = new Array()
for (i2 = 0; i2 < p2; i2++){
   preLoad2[i2] = new Image()
   preLoad2[i2].src = Pic2[i2]
}


function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   
   document.images.SlideShow.src = preLoad[j].src
   document.getElementById("Link").href = Link[j]

   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
function runSlideShow2(){
   if (document.all){
      document.images.SlideShow2.style.filter="blendTrans(duration=2)"
      document.images.SlideShow2.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow2.filters.blendTrans.Apply()      
   }
   
   document.images.SlideShow2.src = preLoad2[j2].src
   document.getElementById("Link2").href = Link2[j2]

   if (document.all){
      document.images.SlideShow2.filters.blendTrans.Play()
   }
   j2 = j2 + 1
   if (j2 > (p2-1)) j2=0
   t2 = setTimeout('runSlideShow2()', slideShowSpeed)
}


// fim trocafoto



// Para flash sem bug

function EscreveJS(src) { 
document.write(src); 
} 





// valida formularios


function validate( ) {


if (document.form.Nome.value.length < 1) {
  alert("Você deve digitar seu nome!");
  return false;
}


if (document.form.email.value.length < 1) {
  alert("Você deve digitar seu e-mail!");
  return false;
}

if (document.form.Telefones.value.length < 1) {
  alert("Você deve digitar seu telefone!");
  return false;
}


if (form.email.value != '') {
var emailok = 0;
var checkStr = form.email.value;
var priaroba = checkStr.indexOf('@');
var ultponto = checkStr.lastIndexOf('.');

if (checkStr.indexOf('@') > 0 ) {
if (checkStr.lastIndexOf('@') == checkStr.indexOf('@')) {
if (checkStr.lastIndexOf('.') > 0 ) {

if ( checkStr.lastIndexOf('.') != checkStr.length - 1) {
if ( ultponto > priaroba ) {
var emailok = 1;
}
}
}
}
}

if (emailok != 1) {
alert("E-mail inválido.");
form.email.focus();
return false;
}
}

return true;
}



// data

hoje = new Date();
dia = hoje.getDate();
dias = hoje.getDay();
mes = hoje.getMonth();
ano = hoje.getYear();

if (dia < 10)
	dia = "0" + dia;
if (ano < 2000)
	ano = "19" + ano;

function CriaArray (n) 
{
	this.length = n;
}

NomeDia = new CriaArray(7);
NomeDia[0] = "Domingo, ";
NomeDia[1] = "Segunda, ";
NomeDia[2] = "Terça, ";
NomeDia[3] = "Quarta, ";
NomeDia[4] = "Quinta, ";
NomeDia[5] = "Sexta, ";
NomeDia[6] = "Sabado, ";

//-- Onde está São Paulo, podemos substituir por cada dia da semana 

NomeMes = new CriaArray(12);
NomeMes[0] = "Janeiro";
NomeMes[1] = "Fevereiro";
NomeMes[2] = "Março";
NomeMes[3] = "Abril";
NomeMes[4] = "Maio";
NomeMes[5] = "Junho";
NomeMes[6] = "Julho";
NomeMes[7] = "Agosto";
NomeMes[8] = "Setembro";
NomeMes[9] = "Outubro";
NomeMes[10] = "Novembro";
NomeMes[11] = "Dezembro";

function imprime() 
{
document.write ("<font color='#876E3F'  face='Verdana' size='1'>" + NomeDia[dias]  + dia + " de " + NomeMes[mes] + " de " + ano + ". </font>");
}

// funcao abre popup

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}



