// funções genéricas para o Flash
function swf_transp(flash,width,height)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" />');
	document.write('<param name="movie" value="'+flash+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="0" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+flash+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" menu="0" wmode="transparent"></embed>');
	document.write('</object>');
}

function swf_opaq(flash,width,height)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" />');
	document.write('<param name="movie" value="'+flash+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="0" />');
	document.write('<param name="wmode" value="opaque" />');
	document.write('<embed src="'+flash+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" menu="0" wmode="opaque"></embed>');
	document.write('</object>');
}


// somente números
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}
// somente números - fim


// validação do contato
function contato()
{
	//valida o nome
	if (document.form_contato.nome.value == "")
	{
		err('Seu Nome Completo');
		document.form_contato.nome.focus();
		return false;
	}
	//valida o e-mail
	if (document.form_contato.email.value == "")
	{
		err('Seu E-mail');
		document.form_contato.email.focus();
		return false;
	}
	apos=document.form_contato.email.value.indexOf("@");
	dotpos=document.form_contato.email.value.lastIndexOf(".");
	strng = document.form_contato.email.value;
	if (apos<1||dotpos-apos<2) 
	{
		err('Seu E-mail');
		document.form_contato.email.focus();
		return false;
	}
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (strng.match(illegalChars))
	{
		err('Seu E-mail');
		document.form_contato.email.focus();
		return false;
	}
	//valida o dddtel
	if (document.form_contato.dddtel.value == "")
	{
		err('Seu DDD');
		document.form_contato.dddtel.focus();
		return false;
	}
	if (isNaN(document.form_contato.dddtel.value))
	{
		err('Seu DDD');
		document.form_contato.dddtel.focus();
		return false;
	}
	if (document.form_contato.dddtel.value.length != 2)
	{
		err('Seu DDD');
		document.form_contato.dddtel.focus();
		return false;
	}
	//valida o Telefone
	if (document.form_contato.tel.value == "")
	{
		err('Seu Telefone');
		document.form_contato.tel.focus();
		return false;
	}
	if (isNaN(document.form_contato.tel.value))
	{
		err('Seu Telefone');
		document.form_contato.tel.focus();
		return false;
	}
	if (document.form_contato.tel.value.length != 8)
	{
		err('Seu Telefone');
		document.form_contato.tel.focus();
		return false;
	}
	
	//Valida a Mensagem
	if (document.form_contato.mensagem.value == "")
	{
		err('Mensagem');
		document.form_contato.mensagem.focus();
		return false;
	}

	return true;
}
// validação do contato - fim


// erro geral
function err(campo)
{
	GB_showCenter('Villa de Espanha', '/includes/err.asp?err='+campo, 114, 362)
}


function mostraOpcao(idDiv) {
	document.getElementById('conteudo_1').style.display = 'none';
	document.getElementById('conteudo_2').style.display = 'none';
	document.getElementById('conteudo_3').style.display = 'none';
	document.getElementById('conteudo' + idDiv).style.display = 'block';
	
	document.getElementById('imagem_1').src = '../imagens/saiba_mais_02.gif';
	document.getElementById('imagem_2').src = '../imagens/saiba_mais_02.gif';
	document.getElementById('imagem_3').src = '../imagens/saiba_mais_02.gif';
	document.getElementById('imagem' + idDiv).src = '../imagens/saiba_mais_01.gif';
}
