function jIndique(iPagina, sTitulo, sTipo)
{
	popup( 'Indique.aspx?pagina=' + iPagina + '&tipo=' + sTipo +'&titulo=' + sTitulo, 'PSTurismoPop' , 510 , 490 , false );
}

function getBrwIE()
{
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		return true
	}
	return false
}
function popup( sUrl, sNome , nLargura , nAltura , bScroll )
{
	if (!getBrwIE())
	{
		nAltura += 16;
		nLargura += 15;
	}
	var winl = (screen.width - nLargura) / 2;
	var wint = (screen.height - nAltura) / 2;
	var sScroll = 'no';
	if(bScroll)
	{
		sScroll = (bScroll)?'yes':'no';
	}
	window.open( sUrl,sNome , 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + sScroll + ',resizable=no,width=' + nLargura + ',height=' + nAltura + ',top=' + wint + ',left=' + winl );
}

function jIsEmail(campo) {
	if(campo.value == "")
	{
		alert("Preencha o campo e-mail");
		campo.focus();
		return false;
	}
	var iAt = campo.value.indexOf('@');
	var iPoint = 0;
	for(i = 0; i < campo.value.length;i++ )
	{
		if(campo.value.substr(i,1) == ".")
		iPoint = i;
	}
	if(iAt<0 || iPoint < 0 || iPoint < iAt)
	{
		alert("Preencha o campo com um e-mail válido.")
		campo.focus();		
		return false;
	}
	if(iPoint >= (campo.value.length - 1))
	{
		alert("Preencha o campo com um e-mail válido.")
		campo.focus();		
		return false;
	}
	return true;
}
function jEnviar()
{
	var frm = document.forms[0];
	if(frm.txt_nome.value == "")
	{
		alert("Preencha o campo nome");
		frm.txt_nome.focus();
		return;
	}
	if(frm.txt_email.value != "")
	{
		if(!jIsEmail(frm.txt_email))
			return;
	}
	if(frm.txt_assunto.value == "")
	{
		alert("Preencha o campo assunto");
		frm.txt_assunto.focus();
		return;
	}
	if(frm.txt_email.value == "" && frm.txt_telefone.value == "")
	{
		alert("Informe o telefone ou e-mail");
		frm.txt_telefone.focus();
		return;
	}
	frm.action="EnviaContato.aspx";
	frm.btn_enviar.disabled = true;
	frm.submit();
	return;
}
function jModelos()
{
	popup( "modelo.htm" , 'FatimaDemarchi' , 640, 390 , false );
}
function jUpDown(tipo)
{
	var i = (tipo == 0 ? 2 : -2);
	lista.scrollBy(0,i)
	tempo = setTimeout("jUpDown(" + tipo + ")",10); 
}
function jStop(){
    clearTimeout(tempo);
}
function jClickThumb(nome,descricao)
{
	parent.portaFoto.src = "img/album/" + nome;
	parent.descricao.innerHTML = descricao;
}
function jFotos(iIdAlbum)
{
	popup( "album.aspx?iIdAlbum=" + iIdAlbum , 'PSTurismo' , 620, 510 , false );
}
function jBuscar()
{
	frm = document.forms[0];
	if(frm.txtBusca.value == "")
	{
		alert("Preencha o campo para efetuar uma busca.");
		frm.txtBusca.focus();
		return;
	}
	frm.action = "Index.aspx";
	frm.submit();
}
function jCadastrese()
{
	frm = document.forms[0];
	aCampo = new Array();
	aRotulo = new Array();
	aCampos = new Array(2);
	aCampo[0] = frm.txtNome;	aRotulo[0] = "Nome";
	aCampo[1] = frm.txtEmail;	aRotulo[1] = "E-mail";
	aCampos[0] = aCampo;
	aCampos[1] = aRotulo;
	if(!jValida(aCampos))
		return;
	if(!jIsEmail(frm.txtEmail))
		return;
	frm.action = "Cadastro.aspx";
	frm.submit();
}
function jValida(aCampo){
	var nSize = aCampo[0].length
	for(i=0;i<nSize;i++)
	{
		if(aCampo[0][i].value == "")
		{
			alert("Preencha o campo " + aCampo[1][i]);
			aCampo[0][i].focus();
			return false;
		}
	}
	return true;
}