// Para formulário da tela inicial

function envia_formulario(){
	document.form2.action='css_scripts/imovel_list.asp';
	document.form2.submit();
}



// 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";
img6on=new Image();
img6on.src="imagens/b6a.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";
img6off=new Image();
img6off.src="imagens/b6b.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




// trocafoto com link modificado para 3 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/cards.gif';

Pic[1] = 'imagens/enf1.jpg';

Pic[2] = 'imagens/enf2.jpg';

Pic[3] = 'imagens/enf3.jpg';

Pic[4] = 'imagens/cards.gif';

var t

var j = 0

var p = Pic.length


var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}


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)
}



// 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);
}



