function validaFormLogin() {

	if(document.frm_login.str_login.value==""){
		alert("Preencha seu login antes de continuar!");
		return false;
	}
	if(document.frm_login.str_senha.value=="") {
		alert("Preencha sua senha antes de continuar!");
		return false;
	}	
	return true;
}

function abreGaleria(num_evento){
	window.open('fotos/index.php?cd_evento='+num_evento,'Galeria','width=800,height=450');
}

function abreGaleriaMaior(num_evento){
	window.open('fotos/index.php?cd_evento='+num_evento,'Galeria','width=750,height=420');
}

function abreReceita(url){
	window.open(url,'Receitas','scrollbars=yes,width=450,height=500');
}

function abreEspacoVip(url){
	window.open('messenger/'+url,'Messenger','scrollbars=yes,width=321,height=320');
}


function validaEmail (emailStr) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		alert("O endereço de e-mail não está correto.")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) {
		// user is not valid
		alert("O endereço de e-mail não está correto.")
		return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("O endereço de e-mail não está correto.")
			return false
			}
		}
		return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert("O endereço de e-mail não está correto.")
		return false
	}

	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) {
	   alert("O endereço de e-mail não está correto.")
	   return false
	}

	if (len<2) {
	   var errStr="O endereço de e-mail não está correto."
	   alert(errStr)
	   return false
	}

return true;
}

function validaCadastroUsuario(){

	if(document.frm_cad_usuario.str_login.value == ""){
		alert("O login precisa ser preenchido!");
		return false;
	}

	if(document.frm_cad_usuario.str_senha.value == ""){
		alert("A senha precisa ser preenchido!");
		return false;
	}

	if(document.frm_cad_usuario.str_senha.value != document.frm_cad_usuario.str_senha2.value){
		alert("A senha fornecida não é a mesma da confirmação!");
		return false;
	}

	if(!validaEmail(document.frm_cad_usuario.str_email.value)){
		return false;
	}

	if(document.frm_cad_usuario.str_nome.value == ""){
		alert("O nome precisa ser preenchido!");
		return false;
	}

	if(document.frm_cad_usuario.str_ano.value == ""){
		alert("O ano de nascimento precisa ser preenchido!");
		return false;
	}

	if(document.frm_cad_usuario.str_logradouro.value == ""){
		alert("O endereço precisa ser preenchido!");
		return false;
	}	

	if(document.frm_cad_usuario.str_cidade.value == ""){
		alert("A cidade precisa ser preenchido!");
		return false;
	}

	if(document.frm_cad_usuario.str_estado.value == ""){
		alert("O estado precisa ser preenchido!");
		return false;
	}
	
	return true;
}


function TrocaCarinha(form){ 
	if (form.str_emoticon.options[form.str_emoticon.selectedIndex].value != "")  {
		  var result= (form.str_emoticon.options[form.str_emoticon.selectedIndex].value);
		  carinha.style.display='block';
		  document.images.img_carinha.src='../img/messenger/carinhas/'+result+'.gif';
	}
	else {
		carinha.style.display='none';
		document.images.img_carinha.src='';
	}
}






/***********************************/
/* Aqui começa o Script do Menu Suspenso */
/***********************************/

// define the default values
webfxMenuDefaultWidth			= 100;
webfxMenuDefaultBorderWidth		= 1;
webfxMenuDefaultPaddingWidth	= 10;
webfxMenuDefaultBorderTop		= 1;
webfxMenuDefaultPaddingTop		= 1;

webfxMenuItemDefaultHeight		= 16;
webfxMenuItemDefaultText		= "Untitled";
webfxMenuItemDefaultHref		= "javascript:void(0)";

webfxMenuImageDefaultHeight		= 54;
webfxMenuSeparatorDefaultHeight	= 2;
webfxMenuDefaultImagePath		= "img/menu/";
webfxMenuDefaultEmptyText		= "Empty";

// check browsers
var op = /opera 5|opera\/5/i.test(navigator.userAgent);
var ie = !op && /msie/i.test(navigator.userAgent);	// preventing opera to be identified as ie
var mz = !op && /mozilla\/5/i.test(navigator.userAgent);	// preventing opera to be identified as mz
var ieBox = ie && /win/.test(navigator.platform) && (document.compatMode == null || document.compatMode != "BackCompat");	// IE proprietary box model
var popupPrimeira = 0;
var menuAparente = 0;
var rapido = 0;
if (ie)	{
	var colSelec = this.document.all.tags("SELECT");
	var ex = colSelec.length;
	var escondido = 0;
}
if (ie && document.getElementById == null) {	// ie4
	document.getElementById = function(sId) {
		return document.all[sId];
	};
}
function escondeMenu() {
 	if (menuAparente && !popupPrimeira) {
		if (escondido) {
			document.body.focus();
			rapido = 1;
		} else
			window.setTimeout("if (!menuAparente) document.body.focus()",600);
		menuAparente = 0;
		aparece();
	} else
	 	if (popupPrimeira)
			esconde()
}
function esconde() {
	menuAparente = 1;
	if ((ex && !escondido) || popupPrimeira) {
		for (iCnt = 0; iCnt < ex; iCnt++) {
			colSelec(iCnt).style.display  = "none";
		}
		escondido = 1;
	}
}
function aparece() {
	if (ex && escondido && !popupPrimeira) {
		for (iCnt = 0; iCnt < ex; iCnt++) {
			colSelec(iCnt).style.display  = "";
		}
		escondido = 0;
	}
}
var webFXMenuHandler = { 
	idCounter		:	0,
	idPrefix		:	"webfx-menu-object-",
	getId			:	function () { return this.idPrefix + this.idCounter++; },
	overMenuItem	:	function (oItem) {
		var jsItem = this.all[oItem.id];
		if (jsItem.subMenu) {
			jsItem.parentMenu.hideAllSubs();
			jsItem.subMenu.show();
		}
		else {
			jsItem.parentMenu.hideAllSubs();
		}
	},
	blurMenu		:	function (oMenuItem) {
		if (rapido) {
			webFXMenuHandler.all[oMenuItem.id].subMenu.hide();
			rapido = 0;
		} else
			window.setTimeout("webFXMenuHandler.all[\"" + oMenuItem.id + "\"].subMenu.hide();", 600);
	},
	all				:	{}
};

function WebFXMenu() {
	this._menuItems	= [];
	this._subMenus	= [];
	this.id			= webFXMenuHandler.getId();
	this.top		= 0;
	this.left		= 0;
	this.shown		= false;
	webFXMenuHandler.all[this.id] = this;
}
WebFXMenu.prototype.width			= webfxMenuDefaultWidth;
WebFXMenu.prototype.borderWidth		= webfxMenuDefaultBorderWidth;
WebFXMenu.prototype.paddingWidth	= webfxMenuDefaultPaddingWidth;
WebFXMenu.prototype.borderTop		= webfxMenuDefaultBorderTop;
WebFXMenu.prototype.paddingTop		= webfxMenuDefaultPaddingTop;
WebFXMenu.prototype.emptyText		= webfxMenuDefaultEmptyText;

WebFXMenu.prototype.add = function (menuItem) {
	this._menuItems[this._menuItems.length] = menuItem;
	if (menuItem.subMenu)
		this._subMenus[this._subMenus.length] = menuItem.subMenu;
	
	menuItem.parentMenu = this;
};
WebFXMenu.prototype.show = function () {
	if (ie && !escondido)
		esconde();
	var divElement = document.getElementById(this.id);
	divElement.style.left = op ? this.left : this.left + "px";
	divElement.style.top = op ? this.top : this.top + "px";
	divElement.style.visibility = "visible";
	menuAparente = 1;
	this.shown = true;
	if (this.parentMenu)
		this.parentMenu.show();
};
WebFXMenu.prototype.hide = function () {
	this.hideAllSubs();
	var divElement = document.getElementById(this.id);
	divElement.style.visibility = "hidden";
	this.shown = false;
	if (ie && this._subMenus.length > 0 && this.parentMenu && escondido) {
		aparece();
		menuAparente = 0;
	}
};
WebFXMenu.prototype.hideAllSubs = function () {
	for (var i = 0; i < this._subMenus.length; i++) {
		if (this._subMenus[i].shown) {
			this._subMenus[i].hide();
		}
	}
};
WebFXMenu.prototype.toString = function () {
	var top = this.top + this.borderTop + this.paddingTop;
	var str = "<div align='left' id='" + this.id + "' class='webfx-menu' style='" + 
	"width:" + (!ieBox  ?  this.width - this.borderWidth - this.paddingWidth  :  this.width) + "px;" +
	"left:" + this.left + "px;" +
	"top:" + this.top + "px;" +
	" onmouseover='esconde()'" +
	"'>";

	if (this._menuItems.length == 0) {
		str += "<span class='webfx-menu-empty'>" + this.emptyText + "</span>";
	}
	else {	
		// loop through all menuItems
		for (var i = 0; i < this._menuItems.length; i++) {
			var mi = this._menuItems[i]
			str += mi;
			if (mi.subMenu)
				mi.subMenu.top = top - mi.subMenu.borderTop - mi.subMenu.paddingTop;
			top += mi.height;
		}

	}
	str += "</div>";
	for (var i = 0; i < this._subMenus.length; i++) {
		this._subMenus[i].left = this.left + this.width - this._subMenus[i].borderWidth/2;
		str += this._subMenus[i];
	}
	return str;
};
function WebFXMenuItem(sText, sHref, sToolTip, oSubMenu) {
	this.text = sText || webfxMenuItemDefaultText;
	this.href = (sHref == null || sHref == "") ? webfxMenuItemDefaultHref : sHref;
	this.subMenu = oSubMenu;
	if (oSubMenu)
		oSubMenu.parentMenuItem = this;
	this.toolTip = sToolTip;
	this.id = webFXMenuHandler.getId();
	webFXMenuHandler.all[this.id] = this;
};
WebFXMenuItem.prototype.height = webfxMenuItemDefaultHeight;
WebFXMenuItem.prototype.toString = function () {
	return	"<a" +
			" id='" + this.id + "'" +
			" href='" + this.href + "'" +
			(this.toolTip ? " title='" + this.toolTip + "'" : "") +
			" onmouseover='menuAparente=1;webFXMenuHandler.overMenuItem(this);'" +
			">" +
			(this.subMenu ? "<img class='arrow' src='" + webfxMenuDefaultImagePath + "arrow.right.gif'>" : "") +
			this.text + 
			"</a>";
};


function WebFXMenuSeparator() {
	this.id = webFXMenuHandler.getId();
	webFXMenuHandler.all[this.id] = this;
};
WebFXMenuSeparator.prototype.height = webfxMenuSeparatorDefaultHeight;
WebFXMenuSeparator.prototype.toString = function () {
	return "<div></div>"
};

function WebFXMenuBar() {
	this._parentConstructor = WebFXMenu;
	this._parentConstructor();
}
WebFXMenuBar.prototype = new WebFXMenu;
WebFXMenuBar.prototype.barra = 1;
WebFXMenuBar.prototype.toString = function () {
	var str = "<div id='" + this.id + "' class='webfx-menu-bar'>";
	
	// loop through all menuButtons
	for (var i = 0; i < this._menuItems.length; i++)
		str += this._menuItems[i];
	
	str += "</div>";

	for (var i = 0; i < this._subMenus.length; i++)
		str += this._subMenus[i];
	
	return str;
};

function WebFXMenuButton(sText, sHref, sToolTip, oSubMenu) {
	this._parentConstructor = WebFXMenuItem;
	this._parentConstructor(sText, sHref, sToolTip, oSubMenu);
}
WebFXMenuButton.prototype = new WebFXMenuItem;
WebFXMenuButton.prototype.toString = function () {
	return	"<a" +
			" id='" + this.id + "'" +
			" href='" + this.href + "'" +
			(this.toolTip ? " title='" + this.toolTip + "'" : "") +
			(op ? (
				" onoperafocus='webFXMenuHandler.overMenuItem(this)'" +
				(this.subMenu ? " onoperablur='webFXMenuHandler.blurMenu(this)'" : "")
			) : (
				" onfocus='webFXMenuHandler.overMenuItem(this)'" +
				(this.subMenu ? " onblur='webFXMenuHandler.blurMenu(this)'" : "")
			)) +
			" onmouseover='menuAparente=1;webFXMenuHandler.overMenuItem(this);this.focus()'" +
			">" +
			this.text + 
			(this.subMenu ? " <img class='arrow' src='" + webfxMenuDefaultImagePath + "arrow.down.gif' align='absmiddle' width='6' height='3'>" : "") +				
			"</a>";
};

function WebFXMenuImage(sText, sHref, sToolTip, oSubMenu) {
	this._parentConstructor = WebFXMenuItem;
	this._parentConstructor(sText, sHref, sToolTip, oSubMenu);
}
WebFXMenuImage.prototype = new WebFXMenuItem;
WebFXMenuImage.prototype.height = webfxMenuImageDefaultHeight;
WebFXMenuImage.prototype.toString = function () {
	return	"<center><img border='0'" +
			" id='" + this.id + "'" +
			" src='" + this.href + "'" +
			(this.toolTip ? " title='" + this.toolTip + "'" : "") +
			(op ? (
				" onoperafocus='webFXMenuHandler.overMenuItem(this)'" +
				(this.subMenu ? " onoperablur='webFXMenuHandler.blurMenu(this)'" : "")
			) : (
				" onfocus='webFXMenuHandler.overMenuItem(this)'" +
				(this.subMenu ? " onblur='webFXMenuHandler.blurMenu(this)'" : "")
			)) +
			" onmouseover='menuAparente=1;webFXMenuHandler.overMenuItem(this);this.focus()'" +
			" alt='"+this.text + "'" +
			"></center>";
};

/* add onfocus/blur for anchors in opera
 * Opera 5.10 seems to support focus and blur but in reality it is even worse
 */
if (op) {
		document.onmousedown = function(e) {
		var a = e.target;
		while (a != null && a.tagName != "A") a = a.parentNode;

		if (document._oldFocus && document._oldFocus != a) {
			if (typeof document._oldFocus.onoperablur == "string") {
				var f = new Function ("event", document._oldFocus.onoperablur);
				document._oldFocus.onFakeBlur = f;
			}
			if (typeof document._oldFocus.onFakeBlur == "function") 
				document._oldFocus.onFakeBlur(e);
		}

		if (a && a != document._oldFocus) {
			document._oldFocus = a;
			if (typeof a.onoperafocus == "string") {
				var f = new Function ("event", a.onoperafocus);
				a.onFakeFocus = f;
			}
			if (typeof a.onFakeFocus == "function") 
				a.onFakeFocus(e);
		}
		else
			document._oldFocus = null;
	};
}



//Começa aqui o menu do Guia

		// Cidade
		var mCidade = new WebFXMenu; 
		mCidade.add(new WebFXMenuImage("", "img/menu/menu_cidade.gif", null)); 
		mCidade.add(new WebFXMenuSeparator()); 
		mCidade.add(new WebFXMenuItem("História", "cidade_historia.php", null)); 
		mCidade.add(new WebFXMenuItem("Geografia", "cidade_geografia.php", null));
		mCidade.add(new WebFXMenuItem("Economia", "cidade_economia.php", null)); 
		mCidade.add(new WebFXMenuItem("Hino e Brasão", "cidade_hino.php", null)); 
		mCidade.add(new WebFXMenuItem("População", "cidade_populacao.php", null)); 
		mCidade.add(new WebFXMenuItem("Distâncias", "cidade_distancias.php", null)); 
		
		// Cultura
		var mCultura = new WebFXMenu; 
		mCultura.add(new WebFXMenuImage("", "img/menu/menu_cultura.gif", null)); 
		mCultura.add(new WebFXMenuSeparator()); 
		mCultura.add(new WebFXMenuItem("Cursos", "cultura_cursos.php", null));
		mCultura.add(new WebFXMenuItem("Geoglifos", "geoglifos_home.php", null));
		mCultura.add(new WebFXMenuItem("Concursos", "noticia_categoria.php?id=7", null));
		mCultura.add(new WebFXMenuItem("Gastronomia", "cultura_gastronomia.php", null));
		mCultura.add(new WebFXMenuItem("Religião", "cultura_folclore.php", null)); 
		mCultura.add(new WebFXMenuItem("Museus", "cultura_museus.php", null));
		mCultura.add(new WebFXMenuItem("Universidades", "cultura_universidades.php", null)); 		


		// Esportes
		var mEsportes = new WebFXMenu; 
		mEsportes.add(new WebFXMenuImage("", "img/menu/menu_esportes.gif",null)); 
		mEsportes.add(new WebFXMenuSeparator()); 
		mEsportes.add(new WebFXMenuItem("Aeromodelismo", "esportes_aeromodelismo.php", null)); 
		mEsportes.add(new WebFXMenuItem("Futebol", "noticia_categoria.php?id=11", null)); 
		mEsportes.add(new WebFXMenuItem("Voleibol", "esportes_voleibol.php", null)); 



		// Eventos 
		var mEventos = new WebFXMenu; 
		mEventos.add(new WebFXMenuImage("", "img/menu/menu_eventos.gif",null)); 
		mEventos.add(new WebFXMenuSeparator()); 
		mEventos.add(new WebFXMenuItem("Próximos", "eventos_proximos.php", null)); 
		mEventos.add(new WebFXMenuItem("Tradicionais", "eventos_tradicionais.php", null)); 
		
		// Lazer 
		var mLazer = new WebFXMenu; 
		mLazer.add(new WebFXMenuImage("", "img/menu/menu_lazer.gif", null)); 
		mLazer.add(new WebFXMenuSeparator()); 
		mLazer.add(new WebFXMenuItem("Casas Noturnas", "lazer_casas_noturnas.php", null)); 
		mLazer.add(new WebFXMenuItem("Cinema", "noticia_categoria.php?id=9", null)); 
		mLazer.add(new WebFXMenuItem("Festas", "noticia_categoria.php?id=5", null)); 
		mLazer.add(new WebFXMenuItem("Shows", "noticia_categoria.php?id=8", null)); 
		mLazer.add(new WebFXMenuItem("Teatro", "lazer_teatro.php", null));

		 
		// Turismo
		var mTurismo = new WebFXMenu; 
		mTurismo.add(new WebFXMenuImage("", "img/menu/menu_turismo.gif", null)); 
		mTurismo.add(new WebFXMenuSeparator()); 
		mTurismo.add(new WebFXMenuItem("Antes e depois", "turismo_antes_depois.php", "Conheça Como era Rio Branco antigamente e como é hoje"));
		mTurismo.add(new WebFXMenuItem("Ecoturismo", "turismo_ecoturismo.php", "")); 
		mTurismo.add(new WebFXMenuItem("Mapa", "turismo_mapa.php", "")); 
		mTurismo.add(new WebFXMenuItem("Museus", "turismo_museus.php", "")); 
		mTurismo.add(new WebFXMenuItem("Parques", "turismo_parques.php", "")); 
		mTurismo.add(new WebFXMenuItem("Patrimônio", "turismo_patrimonio.php", "")); 
        mTurismo.add(new WebFXMenuItem("Outras Cidades", "turismo_outras_cidades.php", ""));
		
		//Menu Principal 
		var menuPrincipal = new WebFXMenuBar; 
		menuPrincipal.add(new WebFXMenuButton("Cidade", "", null, mCidade));
		menuPrincipal.add(new WebFXMenuButton("Cultura", "", null, mCultura));
		menuPrincipal.add(new WebFXMenuButton("Esportes", "", null, mEsportes));
		menuPrincipal.add(new WebFXMenuButton("Eventos", "", null, mEventos));
		menuPrincipal.add(new WebFXMenuButton("Lazer", "", null, mLazer));
		menuPrincipal.add(new WebFXMenuButton("Turismo", "", null, mTurismo));
		
		var top = 120; 
		var left = 0 ; 
		var leftMenuCidade = 80;

		if (screen.width==640)
			leftMenuCidade = 115;
		if (screen.width==720)
			leftMenuCidade = 115;
		if (screen.width==800)
			leftMenuCidade = 116;
		if (screen.width==1024)
			leftMenuCidade = 158;
		if (screen.width==1280)
			leftMenuCidade = 156;
		// POSIÇÕES 
		
		// Cidade
		mCidade.width = 150; 
		mCidade.left = leftMenuCidade; 
		mCidade.top = top; 
		
		// Cultura 
		mCultura.width = 150; 
		mCultura.left = mCidade.left+73; 
		mCultura.top = top; 

		// Esportes
		mEsportes.width = 150; 
		mEsportes.left = mCultura.left+76; 
		mEsportes.top = top; 


		// Eventos
		mEventos.width = 150; 
		mEventos.left = mEsportes.left+86; 
		mEventos.top = top; 
		
		// Lazer 
		mLazer.width = 150; 
		mLazer.left = mEventos.left+81; 
		mLazer.top = top; 
		
		// Turismo
		mTurismo.width = 150; 
		mTurismo.left = mLazer.left +63; 		
		mTurismo.top = top; 