var idItemPop = 0;
var id_user = 0;
var tipoItemPop = 'V';
var conteudoPoliticadeprivacidadeWindowShow = false;
var conteudoComofuncionaWindowShow = false;
var comentarioWindowShow = false;
var centralderelacionamentosWindowShow = false;
var buscaportalindzooomWindowShow = false;
var denuncieWindowShow = false;
var favoritosWindowShow = false;
var indiqueWindowShow = false;
var eventoWindowShow = false;
var starsWindowShow = false;
var privacidadeWindowShow =  false;
var tagsWindowShow = false;
var titulandodiretorWindowShow = false;
var gosteiWindowShow = false;
var loginWindowShow = false;
var membrosWindowShow = false;
var faWindowShow = false;
var amizadeWindowShow = false;
var allcrewsWindowShow = false;
var fotoshomepistaWindowShow = false;
var localizarcrewWindowShow = false;
var localizarpistaWindowShow=false;
var localizarafterridingWindowShow=false;
var naogosteiWindowShow = false;
var aceitoCadastro = false;
var aceitoCadastro2 = false;
var popIndicaShow = false;
var popComentaShow = false;
var popTagShow = false;
var popDenunciaShow = false;
var popFavoritosShow = false;
var popEstrelasShow = false;
var windowNameJanelaPop = "";
var linkUrlJanelaPop = "";
var captionJanelaPop = "";
var alturaWindow = 1000;
var larguraWindow = 1000;
var alturaJanelaPop = 491;
var larguraJanelaPop = 592;
var alturaJanelaComentario = 300;
var larguraJanelaComentario = 350;
var alturaJanelaGaleria = 441;
var larguraJanelaGaleria = 591;
var alturaJanelaNoticia = 500;
var larguraJanelaNoticia = 770;
var leftPosJanelaPop = 0;
var topPosJanelaPop = 0;
var leftPosJanelaComentario = 0;
var topPosJanelaComentario = 0;
var leftPosJanelaGaleria = 0;
var topPosJanelaGaleria = 0;
var leftPosJanelaNoticia = 0;
var topPosJanelaNoticia = 0;
var janelaName = '#showWindowJanelaPop';
var requerLogin = "";
var estaLogado = "";
var id_item_comentario = 0;
var headerSkate = "";
var enterdoform = "default";
var idtipopista;
var hoje = new Date();
var idMesAtual = hoje.getMonth() + 1;
var indiceEvento = 0;
var cssCursor = "hand";
var overlayShowed = false;
var glbQuem = "";
var glbNivel = 0;
var idcidade = 0;
var idestado = 0;

//noticias
var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;
var cont = 0;
var scrollH = 0; 
var pauseMaster = 0;
var target = "";

//eventos
var headline_count_evento;
var headline_interval_evento;
var old_headline_evento = 0;
var current_headline_evento = 0;
var cont_evento = 0;
var scrollH_evento = 0; 
var pauseMaster_evento = 0;
var target_evento = "";

//aconteceu
var headline_count_aconteceu;
var headline_interval_aconteceu;
var old_headline_aconteceu = 0;
var current_headline_aconteceu = 0;
var cont_aconteceu = 0;
var scrollH_aconteceu = 0; 
var pauseMaster_aconteceu = 0;
var target_aconteceu = "";

//pistas
var headline_count_pista;
var headline_interval_pista;
var old_headline_pista = 0;
var current_headline_pista = 0;
var cont_pista = 0;
var scrollH_pista = 0; 
var pauseMaster_pista = 0;
var target_pista = "";

//after
var headline_count_after;
var headline_interval_after;
var old_headline_after = 0;
var current_headline_after = 0;
var cont_after = 0;
var scrollH_after = 0; 
var pauseMaster_after = 0;
var target_after = "";

var preloadimage1 = new Image();
var preloadimage2 = new Image();
var preloadimage3 = new Image();
var preloadimage4 = new Image();
var preloadimage5 = new Image();
var preloadimage6 = new Image();
var preloadimage7 = new Image();
var preloadimage8 = new Image();
var preloadimage9 = new Image();
var preloadimage10 = new Image();
var preloadimage11 = new Image();
preloadimage1.src = "interface/images/header/fndskateheader.png";
preloadimage2.src = "interface/images/header/logotipoindzooom.png";
preloadimage3.src = "interface/images/header/fndbuscaskate.png";
preloadimage4.src = "interface/images/header/fndinputskate.png";
preloadimage5.src = "interface/images/header/btnlupageral.png";
preloadimage6.src = "interface/images/header/clipskate_on.png";
preloadimage7.src = "interface/images/header/clipgames_off.png";
preloadimage8.src = "interface/images/header/clipmusica_off.png";
preloadimage9.src = "interface/images/header/clipperfil_dis.png";
preloadimage10.src = "interface/images/header/clipperfil_off.png";
preloadimage11.src = "interface/images/header/linhaskate.png";

$(document).ready(function(){
	$('#coluna1 .materiasColuna1').show();

	dataSistema = new Date();
	diaHoje = dataSistema.getDate();
	if (diaHoje < 10) {
		diaHoje = "0" + diaHoje;
	}
	dataSistema.setDate(diaHoje - 1);
	diaOntem = dataSistema.getDate();
	if (diaOntem < 10) {
		diaOntem = "0" + diaOntem;
	}

	$("#fundoAgenda").css("background","url(imagens/backgrounds/skate/calendario/fundo_"+diaHoje+"_agendacoluna1.png) no-repeat 0 0");
	$("#fundoAconteceu").css("background","url(imagens/backgrounds/skate/calendario/fundo_"+diaOntem+"_agendacoluna1.png) no-repeat 0 0");

	var FO07 = { movie:"galerias/gzdddcarousel.swf", width:"440", height:"130", majorversion:"8", build:"40", wmode:"transparent" };
	var FO08 = { movie:"imagens/banners/vertical/comofunfa.swf", width:"90", height:"340", majorversion:"8", build:"40", wmode:"transparent" };
	var FO09 = { movie:"imagens/banners/vertical/news.swf", width:"90", height:"340", majorversion:"8", build:"40", wmode:"transparent" };
	var FO10 = { movie:"imagens/banners/vertical/videos.swf", width:"90", height:"340", majorversion:"8", build:"40", wmode:"transparent" };
	var FO11 = { movie:"imagens/banners/horizontal/crewcad.swf", width:"480", height:"70", majorversion:"8", build:"40", wmode:"transparent" };
	var FO12 = { movie:"imagens/banners/horizontal/crewfunc.swf", width:"480", height:"70", majorversion:"8", build:"40", wmode:"transparent" };
	var FO13 = { movie:"imagens/banners/horizontal/enquete.swf", width:"480", height:"70", majorversion:"8", build:"40", wmode:"transparent" };
	var FO14 = { movie:"interface/swf/gzerotecnewstickerperfil.swf", width:"150", height:"150", majorversion:"8", build:"40", wmode:"transparent" };
	var FO15 = { movie:"interface/swf/agendaaconteceuperfil.swf", width:"150", height:"150", majorversion:"8", build:"40", wmode:"transparent" };
	var FO16 = { movie:"interface/swf/agendaanovosperfil.swf", width:"150", height:"150", majorversion:"8", build:"40", wmode:"transparent" };
	
	UFO.create(FO07, "flashHotZoneHome");
	UFO.create(FO08, "imgbanner1");
	UFO.create(FO09, "imgbanner2");
	UFO.create(FO10, "imgbanner3");
	UFO.create(FO11, "flashBannerHorizontal");
	UFO.create(FO12, "flashBannerHorizontal2");
	UFO.create(FO13, "flashBannerHorizontal3");
	
	$.extend($.blockUI.defaults.overlayCSS, { backgroundColor: '#505050' });
		
	$.browser.msie?cssCursor="hand":cssCursor="pointer";
	
	$("input[@type$=button]").css("cursor",cssCursor);	
	$(".btnarrw").css("cursor",cssCursor);
	$(".headline").css("cursor",cssCursor);
	$(".buscabtn").css("cursor",cssCursor);
	$(".clip").css("cursor",cssCursor);
	$(".linkmenu").css("cursor",cssCursor);
	$(".btnentrarlogin").css("cursor",cssCursor);
	$(".btnsairlogin").css("cursor",cssCursor);
	$(".cadastrolink").css("cursor",cssCursor);
	$(".esquecilink").css("cursor",cssCursor);
	$(".mfebutton").css("cursor",cssCursor);
	$("#btnradioonline").css("cursor",cssCursor);
	$(".btnAddCrewFotosInsert").css("cursor",cssCursor);
	$(".rssButton").css("cursor",cssCursor);
	$(".comoFunciona").css("cursor",cssCursor);
	
	$(".comoFunciona").bind("click",function(){
		callFaqWindow();
	});
	$(".rssButton").bind("click",function(){
		var rssReader = window.open("indzooom.rss", "rssreader", "location=0,status=0,addressbar=0,scrollbars=1,resizable=1,maximized=1,width=778,height=540");
	});

	$("#btnradioonline").bind("click",function(){
		if (mywin){ 
			mywin.focus();
		}else{ 
			var mywin = window.open("interface/swf/radioonline.swf", "radioonline", "location=0,status=0,addressbar=0,scrollbars=0,width=350,height=240");
			mywin.focus();
		}
	});

	$('img[@src$=.png]').ifixpng();
	$('h4').ifixpng();
	$('div').ifixpng();
	$('span').ifixpng();
	$('a').ifixpng();
	
	if($("#clipperfil").attr("rel") == "dis"){
		$("#clipperfil").css("cursor","default");
	}

	$("#clipperfil").css("background-image","URL(interface/images/header/clipperfil_"+$("#clipperfil").attr("rel")+".png)");
	$('#clipperfil').ifixpng();
	
	$(".headline").bind("mouseover",function(){
		$(this).css("background-color","#7ED7ED");
	});
	
	$(".headline").bind("mouseout",function(){
		$(this).css("background-color","#B2E7F4");
	});
	
	$("#bannerHorizontal").bind("click",function(){
		callComofunciona();
	});

	$("#banner1").bind("click",function(){
		callComofunciona();
	});

	$(".btnentrarlogin").bind("click",function(){
		emailUser = $("#usuariologin").val();
		senhaUser = $("#senhalogin").val();
		processLogin(emailUser, senhaUser);
	});
	
	$("#usuariologin").focus(function(){
		enterdoform = "login";
	});

	$("#senhalogin").focus(function(){
		enterdoform = "login";
	});
	
	$("#buscatxtfield").focus(function(){
		enterdoform = "busca";
	});

	$('#buscatxtfield').ifixpng();
	
	
	$(document).bind("keydown", function(e) {
		switch(enterdoform){
			case "default":
		        if (e.keyCode == 13) {
					return false;
				}else
				return true;
			break;
			case "login":
		        if (e.keyCode == 13) {
					emailUser = $("#usuariologin").val();
					senhaUser = $("#senhalogin").val();
					processLogin(emailUser, senhaUser);
		            return false;
		        }
			break;
			case "busca":
		        if (e.keyCode == 13) {
					$(".buscabtn").click();
					//processBusca(buscaTxt,"skate");
		        }
			break;
		}
	});

	$(".buscabtn").bind("click",function(){
		if($("#buscatxtfield").val().length){
			$(this).attr("rel", "showWindow2");
			$(this).attr("data", "0");
			$(this).attr("longdesc", "includes/buscaportalindzooominsert.inc.php");
			$(this).attr("caption", "Busca no Portal Indzooom");
			$(this).attr("mode", "busca");
			
			//showMiniPop(0,"", "buscaportalindzooom");
			jqModalBindClick($(this));
		}else{
			alert("Busca mínima por 5 caracteres!");
		}
	});
	
	$(".btnSbt").bind("click",function(){
		caller = $(this).parent().attr("id");
		if (caller != "loginWindow" && caller != "comentarioWindow" && caller != "denuncieWindow" && caller != "favoritosWindow" && caller != "indiqueWindow" && caller != "starsWindow" && caller != "tagsWindow" && caller != "gosteiWindow" && caller != "naogosteiWindow"){
			hideOverlay();
		}
	});
	
	$(".jqmClose").bind("click",function(){
		decGlbNivel();
		
		caller = $(this).parent().attr("id");
		if (caller != "loginWindow" && caller != "comentarioWindow" && caller != "denuncieWindow" && caller != "favoritosWindow" && caller != "indiqueWindow" && caller != "starsWindow" && caller != "tagsWindow" && caller != "gosteiWindow" && caller != "naogosteiWindow"){
			hideOverlay();
		}
	});
	
	$(".cadastrolink").bind("click",function(){
		showCadastramento(0);
	});
	$(".esquecilink").bind("click",function(){
		showEsqueciSenha();
	});
	$(".btnsairlogin").bind("click",function(){
		processLogout();
	});
	//abas principais
	$("#clipskate").bind("click",function(){
		if ($(this).attr("rel") == "dis"){
			return false;
		}
		return false;
	});
	$("#clipgames").bind("click",function(){
		if ($(this).attr("rel") == "dis"){
			return false;
		}
		document.location.href = "index_games.php";
		//alert("Em desenvolvimento");
	});
	$("#clipmusica").bind("click",function(){
		if ($(this).attr("rel") == "dis"){
			return false;
		}
		document.location.href = "index_musica.php";
		//alert("Em desenvolvimento");
	});
	$("#clipperfil").bind("click",function(){
		if ($(this).attr("rel") == "dis"){
			return false;
		}
		document.location.href = "index_perfil.php";
	});
	
	//links menu
	$(".linkmenu").bind("click",function(){
		opcao = $(this).attr("rel");
		status = $(this).attr("longdesc");
		label = $(this).html();
		if (status != "on"){
			if (opcao != "aovivo"){
				document.location.href = opcao + ".php";
				$(".linkmenu").attr("longdesc","off");
				$(this).attr("longdesc","on");
				$(this).html("<u>" + label + "</u>");
			}else{
				var rssReader = window.open("http://www.indzooom.com.br/tv/", "tvaovivo", "location=0,status=0,addressbar=0,scrollbars=0,resizable=1,maximized=1,width=800,height=600");
			}
		}
	});
	
	$(".headline").bind("click",function(){
		switch($(this).attr("id")){
			case "newstickerpista":
				document.location.href = 'homepista.php?id_pista='+ $(this).attr("rel");
			break;
			case "newstickerafter":
				document.location.href = "homeafterriding.php?id_afterriding="+ $(this).attr("rel");
			break;
			case "newstickeraconteceu": 
				
				id_evento = $(this).attr("rel");
				titulo_evento = $(this).attr("longdesc");
				showeventopop(id_evento,titulo_evento);
			break;
			case "newstickeragenda":
				id_evento = $(this).attr("rel");
				titulo_evento = $(this).attr("longdesc");
				showeventopop(id_evento,titulo_evento);
			break;
			default: 
				id_materia = $(this).attr("rel");
				tit_materia = $(this).attr("longdesc");
				showmateriapop(id_materia,tit_materia);
			break;
		}
	});

	if($.browser.msie){
		alturaWindow = parseInt($("body").height());
		larguraWindow = parseInt($("body").width());
	}else{
		alturaWindow = parseInt($(window).height());
		larguraWindow = parseInt($(window).width());
	}
	if($.browser.msie){
		$(".captionSmallWindow").css("width", "330px");
	}else{
		$(".captionSmallWindow").css("width", "310px");
	}

	leftPosJanelaPop = parseInt(Math.round((larguraWindow - larguraJanelaPop) / 2)) + "px";
	topPosJanelaPop = parseInt(Math.round((alturaWindow - alturaJanelaPop) / 2)) + "px";
	leftPosJanelaNoticia = parseInt(Math.round((larguraWindow - larguraJanelaNoticia) / 2)) + "px";
	topPosJanelaNoticia = parseInt(Math.round((alturaWindow - alturaJanelaNoticia) / 2)) + "px";
	leftPosJanelaComentario = parseInt(Math.round((larguraWindow - larguraJanelaComentario) / 2)) + "px";
	topPosJanelaComentario = parseInt(Math.round((alturaWindow - alturaJanelaComentario) / 2)) + "px";
	leftPosJanelaGaleria = parseInt(Math.round((larguraWindow - larguraJanelaGaleria) / 2)) + "px";
	topPosJanelaGaleria = parseInt(Math.round((alturaWindow - alturaJanelaGaleria) / 2)) + "px";
	
	if (!$("a.galeriaLink").onclick){
		$("a.galeriaLink").bind("click", function(){
			linkUrlJanelaPop = $(this).attr("href");
			captionJanelaPop = $(this).attr("caption");
			$("#galeriaWindow H1.alertCaption").html(captionJanelaPop);
			$("#galeriaWindow").css("position", "absolute");
			$("#galeriaWindow").css("left", leftPosJanelaGaleria);
			$("#galeriaWindow").css("top", topPosJanelaGaleria);					
			$("#galeriaWindow").css("width", larguraJanelaGaleria + "px");					
			$("#galeriaWindow").css("height", alturaJanelaGaleria + "px");					
			$.ajax({
				type: 'post',
				dataType: 'html, script',
				url: linkUrlJanelaPop,
				success: function (retornoJanela){
					$("#galeriaWindow div.jqmnContent").html(retornoJanela);
				}
			});
		});
	}
	if (!$("a.magicbookLink").onclick){
		$("a.magicbookLink").bind("click", function(){
			linkUrlJanelaPop = $(this).attr("href");
			captionJanelaPop = $(this).attr("caption");
			$("#magicbookWindow H1.alertCaption").html(captionJanelaPop);
			$("#magicbookWindow").css("position", "absolute");
			$("#magicbookWindow").css("left", leftPosJanelaGaleria);
			$("#magicbookWindow").css("top", topPosJanelaGaleria);					
			$("#magicbookWindow").css("width", larguraJanelaGaleria + "px");					
			$("#magicbookWindow").css("height", alturaJanelaGaleria + "px");					
			$.ajax({
				type: 'post',
				dataType: 'html, script',
				url: linkUrlJanelaPop,
				success: function (retornoJanela){
					$("#magicbookWindow div.jqmnContent").html(retornoJanela);
				}
			});
		});
	}
	$("span.jqModal").css("cursor", cssCursor);
	$(".btnFindPista").css("cursor", cssCursor);
	$(".btnAddFa").css("cursor", cssCursor);
	$(".btnAddVideoPista").css("cursor", cssCursor);
	$(".votarEstrelas").css("cursor", cssCursor);

	$(".mfebutton").css("margin","0px");
	$(".mfebutton").css("padding","0px");
	$(".mfebutton").css("width","16px");
	$(".mfebutton").css("position","relative");
	$(".mfebutton").css("left","-10px");
	
	$("#minifisheye").css("width","160px");
	$("#minifisheye").css("display","block");
	$("#minifisheye").css("float","none");
	$("#minifisheye").css("clear","none");
	$("#minifisheye").css("position","relative");
	$("#minifisheye").css("left","25px");
	$("#minifisheye").css("top","-35px");
	
	$(".mfebutton").bind("mouseover",function(){
		nome_item = $(this).attr("rel");
		$("#minifisheyelegenda").html(nome_item);
	});

	$(".mfebutton").bind("mouseout",function(){
		$("#minifisheyelegenda").html("");
	});
	
	$(".btnFindPista").bind("click",function(){
		id_item = $(this).attr("rel");
		showMiniPop(id_item, "P", "localizepista");
	});

	$("#privacidade").bind("click",function(){
		//id_item = $(this).attr("rel");
		showMiniPop(0, "", "politicadeprivacidade");
	});
	$("#relacionamento").bind("click",function(){
		//id_item = $(this).attr("rel");
		showMiniPop(0, "", "centralderelacionamentos");
	});
	$("#btnEnviarDenunciaPop").bind("click",function(){
		id_item = $(this).attr("rel");
		tipo_item = $(this).attr("longdesc");
		showMiniPop(id_item, tipo_item, "denuncie");
	});
	
	var janelaName = "";
	if (!$("span.jqModal").onclick){
		$("span.jqModal").bind("click", function(){
			jqModalBindClick($(this));
		});
	}
	$('img.janelaClose').click(function(){
		//alert('img. janelaClose 1');
		if (comentarioWindowShow){$("#comentarioWindow").hide();}
		if (denuncieWindowShow){$("#denuncieWindow").hide();}
		if (favoritosWindowShow){$("#favoritosWindow").hide();}
		if (indiqueWindowShow){$("#indiqueWindow").hide();}
		if (starsWindowShow){$("#starsWindow").hide();}
		if (tagsWindowShow){$("#tagsWindow").hide();}
		if (gosteiWindowShow){$("#gosteiWindow").hide();}
		if (naogosteiWindowShow){$("#naogosteiWindow").hide();}
		if (eventoWindowShow){$("#eventoWindow").hide();}
		if (faWindowShow){$("#faWindow").hide();}
		if (membrosWindowShow){$("#membrosWindow").hide();}
		if (amizadeWindowShow){$("#amizadeWindow").hide();}
		if (allcrewsWindowShow){$("#allcrewsWindow").hide();}
		if (fotoshomepistaWindowShow){$("#fotoshomepistaWindow").hide();}
		if (privacidadeWindowShow){$("#privacidadeWindow").hide();}
		if (conteudoPoliticadeprivacidadeWindowShow){$("#conteudoPoliticadeprivacidadeWindow").hide();}
		if (conteudoComofuncionaWindowShow){$("#conteudoComofuncionaWindow").hide();}
		if (centralderelacionamentosWindowShow){$("#centralderelacionamentosWindow").hide();}
		if (buscaportalindzooomWindowShow){$("#buscaportalindzooomWindow").hide();}
		if (titulandodiretorWindowShow){$("#titulandodiretorWindow").hide();}
		
		
		if(!janelaName){
			$("#showWindowJanelaPop2").hide();	
			$("#showWindowJanelaPop2Conteudo").html("");
			$("#showWindowJanelaPop").hide();	
			$("#showWindowJanelaPopConteudo").html("");
		}else{
			$(janelaName + "Conteudo").html("");
			$(janelaName).hide();
		}
		hideOverlay();
		glbNivel = 0;
		/*
		caller = $(this).parent().attr("id");
		if (caller != "loginWindow" && caller != "comentarioWindow" && caller != "denuncieWindow" && caller != "favoritosWindow" && caller != "indiqueWindow" && caller != "starsWindow" && caller != "tagsWindow" && caller != "gosteiWindow" && caller != "naogosteiWindow"){
			hideOverlay();
		}
		*/
		//decGlbNivel();
	});
	$('.jqmClose').click(function(){
		var quem = $(this).parent().attr("id");
		$("#"+quem+" .jqmnContent").html("");
		$("#"+quem).hide();
		if (quem == "noticiaWindow"){
			hideOverlay();
		}
		if (quem == "novacrewWindow"){
			window.location="homecrew.php?id_crew=134";
			//alert($("#abrir_home_crew").attr("rel"));
		}
		decGlbNivel();
	});
	
	headline_count = $(".headlineNoticia").size();
	headline_count_evento = $(".headlineEvento").size();
	headline_count_aconteceu = $(".headlineAconteceu").size();
	headline_count_pista = $(".headlinePista").size();
	headline_count_after = $(".headlineAfter").size();
	
	$(".controlBtn").css("cursor", cssCursor);
	$(".toUp").bind("click",function(){
		switch($(this).attr("longdesc")){
			case "newsticker":
				if ($('#runNoticia').attr("rel") == "stop"){
					$('#runNoticia').attr("rel","play");
					$('#runNoticia').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster);
				cont++;
				if (cont == headline_count){
					cont = 0;
				}
				//alert("noticia: " + cont);
				scrollIt(cont,0);
				return false;
			break;
			case "newstickeragenda":
				if ($('#runEvento').attr("rel") == "stop"){
					$('#runEvento').attr("rel","play");
					$('#runEvento').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_evento);
				cont_evento++;
				if (cont_evento == headline_count_evento){
					cont_evento = 0;
				}
				//alert("evento: " + cont_evento);
				scrollIt_evento(cont_evento,0);
				return false;
			break;
			case "newstickeraconteceu":
				if ($('#runAconteceu').attr("rel") == "stop"){
					$('#runAconteceu').attr("rel","play");
					$('#runAconteceu').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_aconteceu);
				cont_aconteceu++;
				if (cont_aconteceu == headline_count_aconteceu){
					cont_aconteceu = 0;
				}
				//alert("evento: " + cont_evento);
				scrollIt_aconteceu(cont_aconteceu,0);
				return false;
			break;
			case "newstickerpista":
				if ($('#runPista').attr("rel") == "stop"){
					$('#runPista').attr("rel","play");
					$('#runPista').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_pista);
				cont_pista++;
				if (cont_pista == headline_count_pista){
					cont_pista = 0;
				}
				//alert("evento: " + cont_evento);
				scrollIt_pista(cont_pista,0);
				return false;
			break;
			case "newstickerafter":
				if ($('#runAfter').attr("rel") == "stop"){
					$('#runAfter').attr("rel","play");
					$('#runAfter').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_after);
				cont_after++;
				if (cont_after == headline_count_after){
					cont_after = 0;
				}
				//alert("evento: " + cont_evento);
				scrollIt_after(cont_after,0);
				return false;
			break;
		}
	}); 

	$(".toDown").bind("click",function(){
		switch($(this).attr("longdesc")){
			case "newsticker":
				if ($('#runNoticia').attr("rel") == "stop"){
					$('#runNoticia').attr("rel","play");
					$('#runNoticia').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster);
				cont--;
				if (cont < 0){
					cont = headline_count - 1;
				}
				//alert("noticia: " + cont);
				scrollIt(cont,0);
				return false;
			break;
			case "newstickeragenda":
				if ($('#runEvento').attr("rel") == "stop"){
					$('#runEvento').attr("rel","play");
					$('#runEvento').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_evento);
				cont_evento--;
				if (cont_evento < 0){
					cont_evento = headline_count_evento - 1;
				}
				scrollIt_evento(cont_evento,0);
				return false;
			break;
			case "newstickeraconteceu":
				if ($('#runAconteceu').attr("rel") == "stop"){
					$('#runAconteceu').attr("rel","play");
					$('#runAconteceu').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_aconteceu);
				cont_aconteceu--;
				if (cont_aconteceu < 0){
					cont_aconteceu = headline_count_aconteceu - 1;
				}
				scrollIt_aconteceu(cont_aconteceu,0);
				return false;
			break;
			case "newstickerpista":
				if ($('#runPista').attr("rel") == "stop"){
					$('#runPista').attr("rel","play");
					$('#runPista').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_after);
				cont_after--;
				if (cont_after < 0){
					cont_after = headline_count_after - 1;
				}
				scrollIt_after(cont_after,0);
				return false;
			break;
			case "newstickerpista":
				if ($('#runPista').attr("rel") == "stop"){
					$('#runPista').attr("rel","play");
					$('#runPista').html("<b>Rolar</b>");
				}
				clearInterval(pauseMaster_pista);
				cont_pista--;
				if (cont_pista < 0){
					cont_pista = headline_count_pista - 1;
				}
				scrollIt_pista(cont_pista,0);
				return false;
			break;
		};
	});

	$(".toRun").bind("click",function(){
		switch($(this).attr("longdesc")){
			case "newsticker":
				if ($(this).attr("rel") != "stop"){
					$(this).attr("rel","stop");
					$(this).html("<b>Parar  <img src='interface/images/animated_clock.gif' width='12' border='0' align='top' hspace='1' /></b>");
					rollTheBones();
					pauseMaster = setInterval(rollTheBones, 7000);
				}else{
					$(this).attr("rel","play");
					$(this).html("<b>Rolar</b>");
					clearInterval(pauseMaster);
				}
				return false;
			break;
			
			case "newstickeragenda":
				if ($(this).attr("rel") != "stop"){
					$(this).attr("rel","stop");
					$(this).html("<b>Parar  <img src='interface/images/animated_clock.gif' width='12' border='0' align='top' hspace='1' /></b>");
					rollTheBones_evento();
					pauseMaster_evento = setInterval(rollTheBones_evento, 7000);
				}else{
					$(this).attr("rel","play");
					$(this).html("<b>Rolar</b>");
					clearInterval(pauseMaster_evento);
				}
				return false;
			break;
			
			case "newstickeraconteceu":
				if ($(this).attr("rel") != "stop"){
					$(this).attr("rel","stop");
					$(this).html("<b>Parar  <img src='interface/images/animated_clock.gif' width='12' border='0' align='top' hspace='1' /></b>");
					rollTheBones_aconteceu();
					pauseMaster_aconteceu = setInterval(rollTheBones_aconteceu, 7000);
				}else{
					$(this).attr("rel","play");
					$(this).html("<b>Rolar</b>");
					clearInterval(pauseMaster_aconteceu);
				}
				return false;
			break;
			case "newstickerpista":
				if ($(this).attr("rel") != "stop"){
					$(this).attr("rel","stop");
					$(this).html("<b>Parar  <img src='interface/images/animated_clock.gif' width='12' border='0' align='top' hspace='1' /></b>");
					rollTheBones_pista();
					pauseMaster_pista = setInterval(rollTheBones_pista, 7000);
				}else{
					$(this).attr("rel","play");
					$(this).html("<b>Rolar</b>");
					clearInterval(pauseMaster_pista);
				}
				return false;
			break;
			case "newstickerafter":
				if ($(this).attr("rel") != "stop"){
					$(this).attr("rel","stop");
					$(this).html("<b>Parar  <img src='interface/images/animated_clock.gif' width='12' border='0' align='top' hspace='1' /></b>");
					rollTheBones_after();
					pauseMaster_after = setInterval(rollTheBones_after, 7000);
				}else{
					$(this).attr("rel","play");
					$(this).html("<b>Rolar</b>");
					clearInterval(pauseMaster_after);
				}
				return false;
			break;
		}
		return false;
	});
	
	$(".toRun").attr("rel","stop");
	$(".toRun").html("<b>Parar  <img src='interface/images/animated_clock.gif' width='12' border='0' align='top' hspace='1' /></b>");
	pauseMaster = setInterval(rollTheBones, 7000);
	pauseMaster_evento = setInterval(rollTheBones_evento, 7000);
	pauseMaster_aconteceu = setInterval(rollTheBones_aconteceu, 7000);
	pauseMaster_pista = setInterval(rollTheBones_pista, 7000);
	pauseMaster_after = setInterval(rollTheBones_after, 7000);
});

function rollTheBones(){
	cont++;
	if (cont < 0){
		cont = headline_count - 1;
	}
	if (cont >= headline_count){
		cont = 0;
	}
	scrollIt(cont,7000);
}

function rollTheBones_evento(){
	cont_evento++;
	if (cont_evento < 0){
		cont_evento = headline_count_evento - 1;
	}
	if (cont_evento >= headline_count_evento){
		cont_evento = 0;
	}
	scrollIt_evento(cont_evento,7000);
}

function rollTheBones_aconteceu(){

	cont_aconteceu++;
	if (cont_aconteceu < 0){
		cont_aconteceu = headline_count_aconteceu - 1;
	}
	if (cont_aconteceu >= headline_count_aconteceu){
		cont_aconteceu = 0;
	}
	scrollIt_aconteceu(cont_aconteceu,7000);
}
function rollTheBones_after(){
	cont_after++;
	if (cont_after < 0){
		cont_after = headline_count_after - 1;
	}
	if (cont_after >= headline_count_after){
		cont_after = 0;
	}
	scrollIt_after(cont_after,7000);
}
function rollTheBones_pista(){
	cont_pista++;
	if (cont_pista < 0){
		cont_pista = headline_count_pista - 1;
	}
	if (cont_pista >= headline_count_pista){
		cont_pista = 0;
	}
	scrollIt_pista(cont_pista,7000);
}
function scrollIt(cont,timer){
	var divOffset = $("#newsticker").offset().top;
	var pOffset = $(".headlineNoticia:eq(" + cont+")").offset().top;
	var pScroll = pOffset - divOffset;
	$("#newsticker").animate({scrollTop: '+=' + pScroll + 'px'}, "slow");
	var tempTimer = setTimeout(endPause,timer);
}
function scrollIt_evento(cont,timer){
	var divOffset = $("#newstickeragenda").offset().top;
	var pOffset = $(".headlineEvento:eq(" + cont+")").offset().top;
	var pScroll = pOffset - divOffset;
	$("#newstickeragenda").animate({scrollTop: '+=' + pScroll + 'px'}, "slow");
	var tempTimer = setTimeout(endPause,timer);
}

function scrollIt_aconteceu(cont,timer){
	
	var divOffset = $("#newstickeraconteceu").offset().top;
	var pOffset = $(".headlineAconteceu:eq(" + cont+")").offset().top;
	var pScroll = pOffset - divOffset;
	$("#newstickeraconteceu").animate({scrollTop: '+=' + pScroll + 'px'}, "slow");
	
	var tempTimer = setTimeout(endPause,timer);
}
function scrollIt_pista(cont,timer){
	var divOffset = $("#newstickerpista").offset().top;
	var pOffset = $(".headlinePista:eq(" + cont+")").offset().top;
	var pScroll = pOffset - divOffset;
	$("#newstickerpista").animate({scrollTop: '+=' + pScroll + 'px'}, "slow");
	var tempTimer = setTimeout(endPause,timer);
}
function scrollIt_after(cont,timer){
	var divOffset = $("#newstickerafter").offset().top;
	var pOffset = $(".headlineAfter:eq(" + cont+")").offset().top;
	var pScroll = pOffset - divOffset;
	$("#newstickerafter").animate({scrollTop: '+=' + pScroll + 'px'}, "slow");
	var tempTimer = setTimeout(endPause,timer);
}


function endPause(){
	return false;
}

function callNovaBusca(){
	$.ajax({
		type: 'post',
		url: "includes/localize2insert.inc.php",
		beforeSend: function(){
			$("#conteudoLocalize2Window").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function(retornoJanela){
			$("#conteudoLocalize2Window").html(retornoJanela);
			enableInteractiveForm("localize2");
		}
	});
}
function callNovaBuscaPista(){
	$.ajax({
		type:'post',
		url:"includes/localizepistainsert.inc.php",
		beforeSend: function(){
			$("#conteudoLocalizePistaWindow").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function(retornoJanela){
			$("#conteudoLocalizePistaWindow").html(retornoJanela);
			enableInteractiveForm("localizepista");
		}
	});
}function callNovaBuscaAfterRiding(){
	$.ajax({
		type:'post',
		url:"includes/localizeafterridinginsert.inc.php",
		
		beforeSend: function(){
			$("#conteudoLocalizeAfterRidingWindow").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function(retornoJanela){
			$("#conteudoLocalizeAfterRidingWindow").html(retornoJanela);
			enableInteractiveForm("localizeafterriding");
		}
	});
}
function callFecharBusca(){	
	/*
	if (glbQuem != "login" && glbQuem != "comentario" && glbQuem != "denuncie" && glbQuem != "favoritos" && glbQuem != "indique" && glbQuem != "stars" && glbQuem != "tags" && glbQuem != "gostei" && glbQuem != "naogostei"){
		hideOverlay();
	}
	*/
	$("#localize2Window").hide();	
	$("#localizepistaWindow").hide();	
	$("#localizeafterridingWindow").hide();
	$("#denuncieWindow").hide();
	$("#indiqueWindow").hide();
	$("#tagsWindow").hide();
	$("#gosteiWindow").hide();
	$("#comentarioWindow").hide();
	$("#favoritosWindow").hide();
	$("#naogosteiWindow").hide();
	$("#starsWindow").hide();
	$("#privacidadeWindow").hide();
	$("#politicadeprivacidadeWindow").hide();
	$("#comofuncionaWindow").hide();
	$("#centralderelacionamentosWindow").hide();
	$("#buscaportalindzooomWindow").hide();
	$("#btnCancel4").hide();
	$("#btnSubmit5").hide();
	$("#titulandodiretorWindow").hide();
	$("#starstatusWindow").hide();
	$("#gosteistatusWindow").hide();
	$("#naogosteistatusWindow").hide();
	$("#tagstatusWindow").hide();
	$("#noticiapopWindow").hide();
	$("#faqWindow").hide();
	$("#eventoWindow").hide();
	$("#fotosWindow").hide();
	$("#novapistaWindow").hide();
	$("#graffitesWindow").hide();
	$("#afterridingWindow").hide();
	$("#addmembrohomecrewWindow").hide();
	$("#excluiitemhomecrewWindow").hide();
	$("#creweditWindow").hide();
	
	decGlbNivel();
}

function jqModalBindClick(elCaller){
	winType = $(elCaller).attr("rel");
	data = $(elCaller).attr("data");
	eleMode = $(elCaller).attr("mode");
	
	incGlbNivel();
	
	//alert("rel: " + winType + " - data: " + data + " - mode: " + eleMode);
	switch(winType){
		case "showWindow":
			janelaName = '#showWindowJanelaPop';
		break;
		case "showWindow2":
			janelaName = '#showWindowJanelaPop2';
		break;
	}
	if (overlayShowed == false){
		showOverlay();
	}
	if($.browser.msie){
		$(janelaName).css("top", topPosJanelaPop);
		
		if (winType == "showWindow2"){
			$(janelaName).css("left", parseInt(leftPosJanelaPop) - 110 + "px");
		}else{
			$(janelaName).css("left", leftPosJanelaPop);
		}
	}else{
		$.position(janelaName,'center', 'center');
	}
	$(janelaName + " div.loadingcenter").show();
	linkUrlJanelaPop = $(elCaller).attr("longdesc");
	captionJanelaPop = $(elCaller).attr("caption");	
	$.ajax({
		type: 'post',
		dataType: 'html, script',
		url: linkUrlJanelaPop,
		data: data,
		success: function (retornoJanela){
			$(janelaName + "Conteudo").html(retornoJanela);
		},
		error: function(){
			alert("Erro ao abrir janela!");
		},
		complete: function(){
			$('.jqModal').unbind("click");
			$('.jqModal').css("cursor", cssCursor);
			$('.jqModal').bind("click", function(){
				jqModalBindClick($(this));
			});

			if (linkUrlJanelaPop == "cadastramento.php"){
				enableCadastramento();
			}
			$(janelaName + " div.loadingcenter").hide();
			$(".linkRelacionadas").css("cursor",cssCursor);

			if ((eleMode == "video")||(eleMode == "foto")||(eleMode == "graffiti")||(eleMode == "fotopista")||(eleMode == "afterriding")){
				var FO02V = { movie: "interface/swf/tvindzooom.swf?"+data, width:"437", height:"378", majorversion:"8", build:"40", wmode:"transparent" };
				UFO.create(FO02V, "videobox");
				$(".vejamaisvideopopup").css("cursor", cssCursor);
		
				$(".vejamaisvideopopup").bind("click",function(){
					top.document.location.href = "videos.php";
				});
				fisheyemenuHorizontal(data);
			}else if(eleMode == "busca"){
				$("#frmBuscaPortal").prepend("<input type='hidden' id='area_portal' name='area_portal' value='skate' />");
				$("input[@type='button']").css("cursor", cssCursor);
				$("#txtBuscaPortal").attr("value", $("#buscatxtfield").val());

				var optionBuscaPortal = {
					target: janelaName+"Conteudo",
					type: "post",
					url: "includes/buscaportalindzooominsert.inc.php",
					success: enableScriptBuscaResult
				}
				$("#sbtBuscaPortal").bind("click", function(){
					var buscaLength = $("#txtBuscaPortal").val().length;
					
					if(buscaLength>=5){
						$("#frmBuscaPortal").submit();
					}else{
						alert("Busca mínima por 5 caracteres!");
					}
				});
				
				$("#frmBuscaPortal").submit(function(){
					$("#frmBuscaPortal").ajaxSubmit(optionBuscaPortal);
					return false;
				});
				
			}else{
				fisheyemenuVertical(data);
			}
		}
	});
	$(janelaName + " H1.alertCaption").html(captionJanelaPop);
	$(janelaName).css('z-index','10000');
	$(janelaName).show();
	scroll(0,0);
}
function jqModalBindCaller(elCaller,winType,data,eleMode,caption,longdesc){
	/*winType = $(elCaller).attr("rel");
	data = $(elCaller).attr("data");
	eleMode = $(elCaller).attr("mode");
	*/
	switch(winType){
		case "showWindow":
			janelaName = '#showWindowJanelaPop';
		break;
		case "showWindow2":
			janelaName = '#showWindowJanelaPop2';
		break;
	}
	if (overlayShowed == false){
		showOverlay();
	}
	if($.browser.msie){
		$(janelaName).css("top", topPosJanelaPop);
		if (winType == "showWindow2"){
			$(janelaName).css("left", parseInt(leftPosJanelaPop) - 110 + "px");
		}else{
			$(janelaName).css("left", leftPosJanelaPop);
		}
	}else{
		$.position(janelaName,'center', 'center');
	}
	
	$(janelaName + " div.loadingcenter").show();
	linkUrlJanelaPop = longdesc;
	captionJanelaPop = caption;	
	$.ajax({
		type: 'post',
		dataType: 'html, script',
		url: linkUrlJanelaPop,
		data: data,
		success: function (retornoJanela){
			$(janelaName + "Conteudo").html(retornoJanela);
		},
		complete: function(){
			if (linkUrlJanelaPop == "cadastramento.php"){
				enableCadastramento();
			}
			$(janelaName + " div.loadingcenter").hide();
			$(".linkRelacionadas").css("cursor",cssCursor);
			var FO01V = { movie: "interface/swf/magicmenuvertical.swf?"+data, width:"120", height:"450", majorversion:"8", build:"40", wmode:"transparent" };
			UFO.create(FO01V, "fisheye");
			if (eleMode == "video"){
				var FO02V = { movie: "interface/swf/tvindzooom.swf?"+data, width:"437", height:"378", majorversion:"8", build:"40", wmode:"transparent" };
				UFO.create(FO02V, "videobox");
				$(".vejamaisvideopopup").css("cursor", cssCursor);
		
				$(".vejamaisvideopopup").bind("click",function(){
					top.document.location.href = "videos.php";
				});
			}
		}
	});
	$(janelaName + " H1.alertCaption").html(captionJanelaPop);
	$(janelaName).css('z-index','10000');
	$(janelaName).show();
}

function callPoliticadePrivacidade(){
	showMiniPop(0, "", "politicadeprivacidade");
	
	$("#fecharPolitica").bind("click", function(){
		//alert("cliquei");
	});
}

function callTermoUso(){
	showMiniPop(0, "", "termodeuso");
	$("#fecharTermo").bind("click", function(){
		$("#conteudoTermodeusoWindow").html("");
		$("#termodeusoWindow").hide();
		hideOverlay();
	});
}
function callCentraldeRelacionamento(){
	showMiniPop(0, "", "centralderelacionamentos");
	//fecharFaleconosco
	$("#fecharFaleconosco").bind("click", function(){
		//alert("cliquei");
	});
}
function callFaqWindow(){
	//alert("FAQ");
}

function callComofunciona(){
	 $.ajax({
		type: 'post',
		url: "includes/criarcrewanima.inc.php",
	
		beforeSend: function(){
			if($.browser.msie){
				$('#faqWindow').css("top", topPosJanelaPop);
				$('#faqWindow').css("left", leftPosJanelaComentario);
			}else{
				$.position("#faqWindow",'center', 'center');
			}
			if (overlayShowed == false){
				showOverlay();
			}
			$("#faqWindow").show();
			scroll(0,0);
			$("#conteudoFaqWindow").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function(retornoJanela){
			$("#conteudoFaqWindow").html(retornoJanela);
			var FO010000 = { movie: "interface/swf/criarcrew.swf", width:"538", height:"478", majorversion:"8", build:"40", wmode:"transparent" };
			UFO.create(FO010000, "mvCriarCrew");
			$("#mvCriarCrew").css("position","relative");
			$("#mvCriarCrew").css("top","+20px");
			$("#mvCriarCrew").css("left","+8px");
			$("#mvCriarCrew").css("cursor",cssCursor);
			$("#mvCriarCrew").bind("click",function(){
				//alert("cadastro");
			});
		}
	});
}


function beforeSubmitEsqueciSenha(formData, jqForm, options){
	var emailValue = $('input[@name=email]').fieldValue(); 
	if (!emailValue || emailValue == "") { 
		$("#errorMessage").html("O campo e-mail é de preenchimento obrigatório!"); 
		$("#emailField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
}
function afterSubmitEsqueciSenha(){
	$("#showWindowJanelaPop div.loadingcenter").show();
	$('#showWindowJanelaPopConteudo').hide();
}

function enableEnviaSenha(){
	var options = { 
		target: '#showWindowJanelaPopConteudo',
		url: 'esquecisenha.php',
		type: 'post',
		beforeSubmit:  beforeSubmitEsqueciSenha,
		success:       afterSubmitCadastramento2
	}; 

	$('#frmEnviaSenha').submit(function(){ 
		$(this).ajaxSubmit(options); 
		return false;
	}); 

	$("#btnSubmitEsqueci").bind("click", function(){
		$('#frmEnviaSenha').submit();
	});
	
	$("#btnSubmitEsqueci").css("cursor",cssCursor);
}

function enableCadastramento(){
	aceitoCadastro = false;
	if (aceitoCadastro){
		$("#btnSubmit").show();
	}else{
		$("#btnSubmit").hide();
	}
	$(".inputForm").css("border-color","#CCCCCC");
	$(".inputForm").css("background-color","#FFFFFF");
	
	var options = { 
		target: '#showWindowJanelaPopConteudo',
		url: 'cadastramento.php',
		type: 'post',
		beforeSubmit:  beforeSubmitCadastramento,  
		success:       afterSubmitCadastramento
	}; 

	$('#frmCadastro').submit(function(){ 
		$(this).ajaxSubmit(options); 
		return false;
	}); 

	$("#btnSubmit").bind("click", function(){
		$('#frmCadastro').submit();
	});
	
	$("#aceitoCadastro").bind("click", function(){
		if (aceitoCadastro==true){
			aceitoCadastro = false;
			$("#btnSubmit").hide();
		}else{
			aceitoCadastro = true;
			$("#btnSubmit").show();
		}
	});

	$("#btnSubmit").css("cursor",cssCursor);
}
function comboAtualiza(valor){
	if(valor != 'nenhum'){
		$.ajax({
			type: "POST",
			url: "includes/combocidades.inc.php",
			data: "estado="+valor,
			dataType: "html",
			success: function(retornoCidades){
				$("#cidades").html(retornoCidades);
			}
		});		
	}
}
function comboLoading(){
	$('#cidades').html("<img src='interface/images/loading.gif'> carregando...");
	return false;
}
function enableCadastramento2(){
	$("#errorMessageDiv").hide();

	$(".inputForm").bind("focus",function(){
		$(this).css("border-color","red");
		$(this).css("background-color", "#E2E2E2");
	});
	$(".inputForm").bind("blur",function(){
		$(this).css("border-color","#00AFDB");
		$(this).css("background-color", "#FFFFFF");
	});
	$("#comboEstados").bind("change",function(){
		comboLoading();
		comboAtualiza(this.value);
	});

	$("#btnSubmit5ConfirmaEmail").bind("click", function(){
		$('#frmCadastro5').submit();
	});
	
	$("#aceitoCadastro2").bind("click", function(){
		if (aceitoCadastro==true){
			aceitoCadastro = false;
			$("#btnSubmit").hide();
		}else{
			aceitoCadastro = true;
			$("#btnSubmit").show();
			
		}
	});

	$("#btnSubmit").css("cursor",cssCursor);
}		

function beforeSubmitCadastramento(){
	$("#showWindowJanelaPop div.loadingcenter").show();
	$('#showWindowJanelaPopConteudo').hide()
}
function beforeSubmitCadastramento2(formData, jqForm, options){
	var nomeValue = $('input[@name=nome]').fieldValue(); 
	var sobrenomeValue = $('input[@name=sobrenome]').fieldValue(); 
	var apelidoValue = $('input[@name=apelido]').fieldValue(); 
	var emailValue = $('input[@name=email]').fieldValue(); 
	var emailconfirmaValue = $('input[@name=emailconfirma]').fieldValue();
	var senhaValue = $('input[@name=senha]').fieldValue(); 
	
	
	if (!nomeValue || nomeValue == "") { 
		$("#errorMessage").html("O campo nome é de preenchimento obrigatório!"); 
		$("#nomeField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
	if (!sobrenomeValue || sobrenomeValue == "") { 
		$("#errorMessage").html("O campo sobrenome é de preenchimento obrigatório!"); 
		$("#sobrenomeField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
	if (!apelidoValue || apelidoValue == "") { 
		$("#errorMessage").html("O campo apelido é de preenchimento obrigatório!"); 
		$("#apelidoField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
	if (!emailValue || emailValue == "") { 
		$("#errorMessage").html("O campo e-mail é de preenchimento obrigatório!"); 
		$("#emailField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
	if (!emailconfirmaValue || emailconfirmaValue == "") { 
		$("#errorMessage").html("O campo confirma e-mail é de preenchimento obrigatório!"); 
		$("#emailconfirmaField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
	email1 = new String(emailValue);
	email2 = new String(emailconfirmaValue);
	if (email1.toString() != email2.toString()) { 
		$("#errorMessage").html("O campo confirma e-mail e e-mail estão diferentes!"); 
		$("#emailconfirmaField").focus();
		$("#errorMessageDiv").show();
		return false; 
	}
	if (!senhaValue || senhaValue == "") { 
		$("#errorMessage").html("O campo senha é de preenchimento obrigatório!"); 
		$("#senhaField").focus();
		$("#errorMessageDiv").show();
		return false; 
	} 
}
function afterSubmitCadastramento(){
	$("#showWindowJanelaPop div.loadingcenter").hide();
	$('#showWindowJanelaPopConteudo').show()
	$("#errorMessageDiv").hide();
	
	$(".inputForm").bind("focus",function(){
		$(this).css("border-color","red");
		$(this).css("background-color", "#E2E2E2");
	});
	$(".inputForm").bind("blur",function(){
		$(this).css("border-color","#00AFDB");
		$(this).css("background-color", "#FFFFFF");
	});
	
	var options = { 
		target: "#showWindowJanelaPopConteudo",
		url: "cadastramento.php",
		type: "post",
		beforeSubmit:  beforeSubmitCadastramento2,
		success: afterSubmitCadastramento2
	}; 
	$("#frmCadastro2").submit(function(){ 
		$(this).ajaxSubmit(options); 
		return false;
	}); 

	$("#btnSubmit2").bind("click", function(){
		
		$('#frmCadastro2').submit();
	});
	
	$("#nomeField").focus();
}
function afterSubmitCadastramento2(){
	$("#btnSubmit").click(function(){
		$("#showWindowJanelaPop").hide();
		$("#showWindowJanelaPop").html("");
		hideOverlay();	
	});
	var options = { 
		target: "#showWindowJanelaPopConteudo",
		url: "cadastramento.php",
		type: "post",
		success: afterSubmitCadastramento
	}; 
	
	$("#btnCancel4").bind("click",function(){
		$("#showWindowJanelaPop").hide();	
		$("#showWindowJanelaPopConteudo").html("");
		hideOverlay();
	});

	$("#frmRetorno").submit(function(){ 
		$(this).ajaxSubmit(options); 
		return false;
	}); 

	$("#btnSubmit3").bind("click", function(){
		$('#frmRetorno').submit();
	});
}
function showOverlay(){
	$('#overlay').css("z-index", "900");
	$('#overlay').css("height", $(document).innerHeight());
	$('#overlay').css("display", "block");
	$('#overlay').show();
	overlayShowed = true;
}
function hideOverlay(){
	$('#overlay').css("z-index", "900");
	$('#overlay').css("display", "none");
	$('#overlay').hide();
	overlayShowed = false;
}
function showTransparentOverlay(){
	$('<div id="transparentOverlay" style="display: none;"></div>').prependTo('body');
	var zIndex = 11000 + contaJanela - 1;

	$("#transparentOverlay").css("position", "absolute");
	$("#transparentOverlay").css("top", "0px");
	$("#transparentOverlay").css("left", "0px");
	$("#transparentOverlay").css("cursor", "wait");
	$("#transparentOverlay").css("z-index", zIndex);
	$("#transparentOverlay").css("height", $(document).innerHeight());
	$("#transparentOverlay").css("width", $(document).innerWidth());
	//$("#transparentOverlay").css("background-color", "white");
	$("#transparentOverlay").css("background", "transparent url(interface/images/bgtransparent.png)");
	$("#transparentOverlay").show();
}
function hideTransparentOverlay(){
	$('#transparentOverlay').remove();
	/*
	$("#transparentOverlay").css("position", "absolute");
	$("#transparentOverlay").css("top", "0px");
	$("#transparentOverlay").css("left", "0px");
	$("#transparentOverlay").css("cursor", "wait");
	$("#transparentOverlay").css("z-index", zIndex);
	$("#transparentOverlay").css("height", $(document).innerHeight());
	$("#transparentOverlay").css("width", $(document).innerWidth());
	//$("#transparentOverlay").css("background-color", "white");
	$("#transparentOverlay").css("background", "transparent url(interface/images/bgtransparent.png)");
	$("#transparentOverlay").show();
	*/
}

function showMagicBook(codMagicBook, caption){
	$(this).attr("rel", "showWindow2");
	$(this).attr("caption", caption);
	$(this).attr("longdesc", "showmagicbook.php?cod_magicbook="+codMagicBook);
	$(this).attr("data","id_item="+codMagicBook); 
	jqModalBindClick($(this));
}
function showmateriapop(id_materia,caption){
	$(this).attr("rel", "showWindow2");
	$(this).attr("caption", caption);
	$(this).attr("longdesc", "showmateriapop.php?id_item="+id_materia);
	$(this).attr("data","id_item="+id_materia+"&tipo_item=M"); 
	jqModalBindClick($(this));
}
function showeventopop(id_evento,caption){
	$(this).attr("rel", "showWindow2");
	$(this).attr("caption", caption);
	$(this).attr("longdesc", "showeventopop.php?id_evento="+id_evento);
	$(this).attr("data","id_item="+id_evento+"&tipo_item=E"); 
	jqModalBindClick($(this));
}
function showafterridingpop(id_afterriding,caption){
	$(this).attr("rel", "showWindow2");
	$(this).attr("caption", caption);
	$(this).attr("longdesc", "showafterridingpop.php?id_afterriding="+id_afterriding);
	$(this).attr("data","id_item="+id_afterriding+"&tipo_item=A"); 
	jqModalBindClick($(this));
}
function showpistapop(id_pista,caption){
	$(this).attr("rel", "showWindow2");
	$(this).attr("caption", caption);
	$(this).attr("longdesc", "showpistapop.php?id_pista="+id_pista);
	$(this).attr("data","id_item="+id_pista+"&tipo_item=P"); 
	jqModalBindClick($(this));
}
function showfotopop(id_foto,caption){
	$(this).attr("rel", "showWindow");
	$(this).attr("caption", caption);
	$(this).attr("data","id_item="+id_foto+"&tipo_item=F"); 
	$(this).attr("longdesc", "showfotopop.php?id_foto="+id_foto);
	jqModalBindClick($(this));
}
function showvideopop(id_video,caption){
	$(this).attr("rel", "showWindow2");
	$(this).attr("caption", caption);
	$(this).attr("longdesc", "showvideo.php?id_video="+id_video);
	$(this).attr("mode", "video");
	leftPosJanelaPop = parseInt(Math.round((larguraWindow - larguraJanelaPop) / 2) + 110) + "px";
	topPosJanelaPop = parseInt(Math.round((alturaWindow - alturaJanelaPop) / 2)) + "px";
	$(this).attr("data","id_item="+id_video+"&tipo_item=V"); 
	jqModalBindClick($(this));
}
function showgraffitipop(id_graffiti,caption){
	$(this).attr("rel", "showWindow");
	$(this).attr("caption", caption);
	$(this).attr("data", "id_item="+id_graffiti+"&tipo_item=G");
	$(this).attr("longdesc", "showgraffitepop.php");
	jqModalBindClick($(this));
}

var contaJanela = 1;
function showLogin(id_item,tipo_item){
	$("#loadingMini").hide();
	quem = "login";
	contaJanela++;
	eval(quem + "WindowShow = true;");
	if (overlayShowed == false){
		showOverlay();
	}
	if($.browser.msie){
		$('#'+quem+'Window').css("top", '250');
		$('#'+quem+'Window').css("left", '450');
	}else{
		$.position("#"+quem+"Window",'center', 'center');
	}
	linkUrlJanelaPop = "includes/"+quem+"insert.inc.php";
	$.ajax({
		type: 'post',
		data: 'id_usuario='+id_usuario+'&id_item=' + id_item + "&tipo_item=" + tipo_item + "&show=true",
		dataType: 'html, script',
		url: linkUrlJanelaPop,
		async: false,
		beforeSend: function(){
			$("#"+quem+"Window .jqmnContent").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function (retornoJanela){
			$("#"+quem+"Window .jqmnContent").html(retornoJanela);
				$("#"+quem+"Window .jqmnContent").ready(function(){
					$("p.jqModal").css("cursor", cssCursor);
					$("input[@type$=button]").css("cursor",cssCursor);	
					
					var janelaName = "";
					if (!$("p.jqModal").onclick){
						$("p.jqModal").bind("click", function(){
							$("#showWindowJanelaPop2").hide();	
							$("#showWindowJanelaPop2Conteudo").html("");
							$("#showWindowJanelaPop").hide();	
							$("#showWindowJanelaPopConteudo").html("");
							winType = $(this).attr("rel");
							data = $(this).attr("data");
							switch(winType){
								case "showWindow":
									janelaName = '#showWindowJanelaPop';
								break;
								case "showWindow2":
									janelaName = '#showWindowJanelaPop2';
								break;
							}
							if (overlayShowed == false){
								showOverlay();
							}
							if($.browser.msie){
								$(janelaName).css("top", topPosJanelaPop);
								if (winType == "showWindow2"){
									$(janelaName).css("left", parseInt(leftPosJanelaPop) - 110 + "px");
								}else{
									$(janelaName).css("left", leftPosJanelaPop);
								}
							}else{
								$.position(janelaName,'center', 'center');
							}
							$(janelaName + " div.loadingcenter").show();
							linkUrlJanelaPop = $(this).attr("longdesc");
							captionJanelaPop = $(this).attr("caption");	
							$.ajax({
								type: 'post',
								dataType: 'html, script',
								url: linkUrlJanelaPop,
								data: data,
								success: function (retornoJanela){
									$(janelaName + "Conteudo").html(retornoJanela);
								},
								complete: function(){
									if (linkUrlJanelaPop == "cadastramento.php"){
										enableCadastramento();
									}
									$(janelaName + " div.loadingcenter").hide();
								}
							});
							$(janelaName + " H1.alertCaption").html(captionJanelaPop);
							$(janelaName).css('z-index','15000');
							$(janelaName).show();
						});
					}
					$('#btnEnvia3').click(function(){
						emailUser = document.getElementById("loginUserLogin").value;
						senhaUser = document.getElementById("senhaUserLogin").value;
						if (emailUser == ""){
							$("#mensagemErroLogin").html("Informe o seu e-mail");
							$("#loginUserLogin").focus();
						}else if (senhaUser == ""){
							$("#mensagemErroLogin").html("Informe a sua senha");
							$("#senhaUserLogin").focus();
						}else{
							processLogin(emailUser, senhaUser);
						}
					});
					$('img.janelaClose').click(function(){
						//alert('img.janelaClose 2');
						if (comentarioWindowShow){$("#comentarioWindow").hide();}
						if (denuncieWindowShow){$("#denuncieWindow").hide();}
						if (favoritosWindowShow){$("#favoritosWindow").hide();}
						if (indiqueWindowShow){$("#indiqueWindow").hide();}
						if (starsWindowShow){$("#starsWindow").hide();}
						if (tagsWindowShow){$("#tagsWindow").hide();}
						if (gosteiWindowShow){$("#gosteiWindow").hide();}
						if (naogosteiWindowShow){$("#naogosteiWindow").hide();}
						if (loginWindowShow){$("#loginWindow").hide();}
						if (eventoWindowShow){$("#eventoWindow").hide();}
						if (faWindowShow){$("#faWindow").hide();}
						if (membrosWindowShow){$("#membrosWindow").hide();}
						if (amizadeWindow){$("#amizadeWindow").hide();}
						if (privacidadeWindowShow){$("#privacidadeWindow").hide();}
						if (conteudoPoliticadeprivacidadeWindowShow){$("#conteudoPoliticadeprivacidadeWindow").hide();}
						if (conteudoComofuncionaWindowShow){$("#conteudoComofuncionaWindow").hide();}
						if (centralderelacionamentosWindowShow){$("#centralderelacionamentosWindow").hide();}
						if (buscaportalindzooomWindowShow){$("#buscaportalindzooomWindowWindow").hide();}
						if (titulandodiretorWindowShow){$("#titulandodiretorWindow").hide();}
						/*
						if(!janelaName){
							$("#showWindowJanelaPop2").hide();	
							$("#showWindowJanelaPop2Conteudo").html("");
							$("#showWindowJanelaPop").hide();	
							$("#showWindowJanelaPopConteudo").html("");
							hideOverlay();
						}else{
							$(janelaName + "Conteudo").html("");
							$(janelaName).hide();
							hideOverlay();
						}
						*/
						hideOverlay();
						glbNivel = 0;
						//decGlbNivel();
					});
					$('#btnCancela3').click(function(){
						if (comentarioWindowShow){$("#comentarioWindow").hide();}
						if (denuncieWindowShow){$("#denuncieWindow").hide();}
						if (favoritosWindowShow){$("#favoritosWindow").hide();}
						if (indiqueWindowShow){$("#indiqueWindow").hide();}
						if (starsWindowShow){$("#starsWindow").hide();}
						if (tagsWindowShow){$("#tagsWindow").hide();}
						if (gosteiWindowShow){$("#gosteiWindow").hide();}
						if (naogosteiWindowShow){$("#naogosteiWindow").hide();}
						if (loginWindowShow){$("#loginWindow").hide();}
						if (eventoWindowShow){$("#eventoWindow").hide();}
						if (faWindowShow){$("#faWindow").hide();}
						if (membrosWindowShow){$("#membrosWindow").hide();}
						if (amizadeWindowShow){$("#amizadeWindow").hide();}
						if (allcrewsWindowShow){$("#allcrewsWindow").hide();}
						if (localizarcrewWindowShow){$("#localizarcrewWindow").hide();}
						if (localizarpistaWindowShow){$("#localizarpistaWindow").hide();}
						if (localizarafterridingWindowShow){$("#localizarafterridingWindow").hide();}
						if (fotoshomepistaWindowShow){$("#fotosHhmepistaWindow").hide();}
						if (privacidadeWindowShow){$("#privacidadeWindow").hide();}
						if (conteudoPoliticadeprivacidadeWindowShow){$("#conteudoPoliticadeprivacidadeWindow").hide();}
						if (conteudoComofuncionaWindowShow){$("#conteudoComofuncionaWindow").hide();}
						if (centralderelacionamentosWindowShow){$("#centralderelacionamentosWindow").hide();}
						if (buscaportalindzooomWindowShow){$("#buscaportalindzooomWindow").hide();}
						if (titulandodiretorWindowShow){$("#titulandodiretorWindow").hide();}
						
						if(!janelaName){
							$("#showWindowJanelaPop2").hide();	
							$("#showWindowJanelaPop2Conteudo").html("");
							$("#showWindowJanelaPop").hide();	
							$("#showWindowJanelaPopConteudo").html("");
							hideOverlay();
						}else{
							$(janelaName + "Conteudo").html("");
							$(janelaName).hide();
							hideOverlay();
						}
						//hideOverlay();
					});
				$("#loginUser").focus();
			});
		}
	});

	var depth = 11000 + contaJanela;
	$('#'+quem+'Window').css('z-index',depth);
	$('#'+quem+'Window').show();
	$("#loginUser").focus();
}
	function showMiniPop(id_item, tipo_item, quem){
		
		scroll(0,0);
		
		idItemPop = id_item;
		tipoItemPop = tipo_item;
		elEvento = $(this);
		requerLogin = true;
		glbQuem = quem;
		contaJanela++;
		
		incGlbNivel();
		
		if (quem == "votar"){
			quem = "stars";
		}
		if (quem == "comentarios"){
			quem = "comentario";
		}
		switch(quem){
			case "faq":
				estaLogado = false;
				requerLogin = false;
				quem = "faq";
			break;
			case "comentario": 
				if(id_usuario == 0){
					estaLogado = false;
					requerLogin = false;
					id_item_comentario = idItemPop;
				}else{
					estaLogado = true;
					requerLogin = false;
					id_item_comentario = 0;
				}
			break;
			case "stars":
				if(id_usuario == 0){
					estaLogado = false;
					requerLogin = false;
					id_item_comentario = idItemPop;
					quem = "starstatus";
					
				}else{
					estaLogado = true;
					requerLogin = false;
					id_item_comentario = 0;
				}
			break;	
			case "gostei":
				if(id_usuario == 0){
					estaLogado = false;
					requerLogin = false;
					id_item_comentario = idItemPop;
					quem = "gosteistatus";			
				}else{
					estaLogado = true;
					requerLogin = false;
					id_item_comentario = 0;
				}
			break;	
			case "naogostei":
				if(id_usuario == 0){
					estaLogado = false;
					requerLogin = false;
					id_item_comentario = idItemPop;
					quem = "naogosteistatus";
				}else{
					estaLogado = true;
					requerLogin = false;
					id_item_comentario = 0;
				}
			break;	
			case "tags":
				if(id_usuario == 0){
					estaLogado = false;
					requerLogin = false;
					id_item_comentario = idItemPop;
					quem = "tagstatus";
				}else{
					estaLogado = true;
					requerLogin = false;
					id_item_comentario = 0;
				}
			break;	
			case "allcrews": 
				requerLogin = false;
			break;
			case "localizeafterriding":
				requerLogin = false;
			break;
			case "localizepista":
				requerLogin = false;
			break;
			case "localize2":
				requerLogin = false;
			break;
			case "politicadeprivacidade":
				requerLogin = false;
			break;
			case "comofunciona":
				requerLogin = false;
			break;
			case "centralderelacionamentos":
				requerLogin = false;
			break;
			case "buscaportalindzooom":
				requerLogin = false;
			break;
		}
		
		if ((id_usuario == 0) && (requerLogin == true)){
			showLogin(id_item,tipo_item);
		}else{
			$("#loadingMini").hide();
			eval(quem + "WindowShow = true;");
			
			if($.browser.msie){
				$('#'+quem+'Window').css("top", topPosJanelaComentario);
				$('#'+quem+'Window').css("left", leftPosJanelaComentario);
			}else{
				$.position("#"+quem+"Window",'center', 'center');
			}

			if (id_user != 0){
				datapost = "&id_membro="+id_user;
			}else{
				datapost = "";
			}

			linkUrlJanelaPop = "includes/"+quem+"insert.inc.php";
			
			$.ajax({
				type: 'post',
				data: 'id_usuario='+id_usuario+'&id_item=' + id_item + "&tipo_item=" + tipo_item + datapost,
				dataType: 'html, script',
				url: linkUrlJanelaPop,
				async: false,
				beforeSend: function(){
					$("#"+quem+"Window .jqmnContent").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
				},
				success: function (retornoJanela){
					$("#"+quem+"Window .jqmnContent").html(retornoJanela);
					
					var depth = 11000 + contaJanela;
					$('#'+quem+'Window').css('z-index',depth);
					
					enableInteractiveForm(quem);
				}
			});
		
			if (overlayShowed == false){
				showOverlay();
			}else{
				//showTransparentOverlay();
			}
			
			$('#'+quem+'Window').show();
			scroll(0,0);
		}
		
	}	
	function callVoltarUpdateFotoMateria(){
		
		var data_linha = "insert=insert2&id_usuario=" + iun + "&titulo=" + tn + "&chamada=" + chn + "&texto=" + txn + "&fonte=" + fn + "&id_crew=" + icn + "&tipo_item=M";
			
		$.ajax({
			url: 'includes/noticiapopinsert.inc.php',
			type: 'post',
			data: data_linha,
			dataType: "html",
			success: function(optionsEventoPop){
			$("#conteudoNoticiaPop").html(optionsEventoPop);
				$("#noticiapopWindow .jqmnContent").ready(function(){
					var optionsEventoPop = { 
						target: '#conteudoNoticiaPop',
						url: 'includes/noticiapopinsert.inc.php?insert=insert',
						type: 'post',
						beforeSubmit:  beforeSubmitNoticia,
						success : function(optionsEventoPop){
							indiceEvento = $(".formComentarios").attr("rel");
							if (indiceEvento == 2){
								callVoltarUpdateFoto();
							}else{
								window.location="materias.php";
							}
						
						}
					}; 

					$('#frmNoticia').submit(function(){ 
						$(this).ajaxSubmit(optionsEventoPop); 
						return false;
					}); 

					$("#miniPopSubmitNoticia").bind("click", function(){
						$('#frmNoticia').submit();
					});
				});
			}
		});	
	}
	function callVoltarUpdateFotoEventoDados(){
			var data_linha = "insert=insert2&id_usuario=" + iue + "&titulo=" + te + "&texto=" + txe + "&chamada=" + che + "&data=" + de + "&data_fim=" +def+ "&hora=" +he+"&id_crew=" + ice + "&estado=" + ee + "&cidade=" + ce + "&bairro=" + be + "&endereco=" + ende + "&telefone="+ tel + "&email="	+ emaile +	"&url=" + ue + "&tipo_item=E"; 
			
			$.ajax({
			url: 'includes/eventoinsert.inc.php',
			type: 'post',
			data: data_linha,
			dataType: "html",
			success: function(resultEvento){
				$("#conteudoEventoPop").html(resultEvento);
				$("#eventoWindow .jqmnContent").ready(function(){
				var optionsEventoPop = { 
					target: '#conteudoEventoPop',
					url: 'includes/eventoinsert.inc.php?insert=insert',
					type: 'post',
					beforeSubmit:  beforeSubmitEvento,
					success:function(){
						$.ajax({
								type: "POST",
								url: "includes/subpages/listaeventosmes.subpage.inc.php",
								data: "mes="+idMesAtual,
								dataType: "html",
								beforeSend: function(){
									$("#conteudoEventos").html("<img src='interface/images/ajax-loading.gif' hspace='220' vspace='200' border='0' />");
								},
								success: function(resultEvento){
									$("#conteudoEventos").html(resultEvento);
									$("#conteudoEventos").ready(function(){
										//clickPlusMinus();
									});
								}
							});
							}
						}; 

						$('#frmEvento').submit(function(){ 
							$(this).ajaxSubmit(optionsEventoPop); 
							return false;
						}); 

						$("#miniPopSubmitEvento").bind("click", function(){
							$('#frmEvento').submit();
						});

						$(".btnCallCalendar").css("cursor",cssCursor);
						$(".btnCallCalendar2").css("cursor",cssCursor);
						
						$("#data_evento").bind("click", function(){
							$(".btnCallCalendar").click();
						});
						$("#data_evento_fim").bind("click", function(){
							$(".btnCallCalendar2").click();
						});

						$(".btnCallCalendar").bind("click", function(){
							$("#calendWindPop").css("position", "relative");
							$("#calendWindPop").css("top", "280px");
							$("#calendWindPop").css("left", "110px");
							$("#calendWindPop").css("z-index", "25000");
							$("#calendWindPop").show();
							$.ajax({
								type: "POST",
								url: "interface/js/datepicker.php",
								dataType: "html",
								beforeSend: function(){
									$("#calendWindPop .calendarContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#calendWindPop .calendarContent").html(resultEvento);
									$("#calendWindPop .calendarContent").ready(function(){
										diaCalend = $("#diaCalend").attr("value");
										mesCalend = $("#mesCalend").attr("value");
										anoCalend = $("#anoCalend").attr("value");
										$("#diaCalend").bind("change",function(){
											diaCalend = $(this).attr("value");
										});
										$("#mesCalend").bind("change",function(){
											mesCalend = $(this).attr("value");
										});
										$("#anoCalend").bind("change",function(){
											anoCalend = $(this).attr("value");
										});
										$(".submitDataCalend").css("cursor",cssCursor);
										$(".submitDataCalend").bind("click", function(){
											dataEscolhida = diaCalend + "/" + mesCalend + "/" + anoCalend;
											$("#data_evento").attr("value", dataEscolhida);
											$("#calendWindPop .calendarContent").html("");
											$("#calendWindPop").hide();
										});
									});
									
								}
							});
						});
						
						$(".btnCallCalendar2").bind("click", function(){
							$("#calendWindPop2").css("position", "relative");
							$("#calendWindPop2").css("top", "280px");
							$("#calendWindPop2").css("left", "318px");
							$("#calendWindPop2").css("z-index", "25000");
							$("#calendWindPop2").show();
							$.ajax({
								type: "POST",
								url: "interface/js/datepicker.php",
								dataType: "html",
								beforeSend: function(){
									$("#calendWindPop2 .calendarContent2").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#calendWindPop2 .calendarContent2").html(resultEvento);
									$("#calendWindPop2 .calendarContent2").ready(function(){
										diaCalend = $("#diaCalend").attr("value");
										mesCalend = $("#mesCalend").attr("value");
										anoCalend = $("#anoCalend").attr("value");
										$("#diaCalend").bind("change",function(){
											diaCalend = $(this).attr("value");
										});
										$("#mesCalend").bind("change",function(){
											mesCalend = $(this).attr("value");
										});
										$("#anoCalend").bind("change",function(){
											anoCalend = $(this).attr("value");
										});
										
										$(".submitDataCalend2").css("cursor",cssCursor);
										$(".submitDataCalend2").bind("click", function(){
											dataEscolhida2 = diaCalend + "/" + mesCalend + "/" + anoCalend;
											$("#data_evento_fim").attr("value", dataEscolhida2);
											$("#calendWindPop2 .calendarContent2").html("");
											$("#calendWindPop2").hide();
										});
										
									});
									
								}
							});
						});
						
						$(".btnCallTimePicker").css("cursor",cssCursor);
						
						$("#hora_evento").bind("click", function(){
							$(".btnCallTimePicker").click();
						});
						
						$(".btnCallTimePicker").bind("click", function(){
							$("#timepickerWindPop").css("position", "relative");
							$("#timepickerWindPop").css("top", "280px");
							$("#timepickerWindPop").css("left", "400px");
							$("#timepickerWindPop").css("z-index", "25000");
							$("#timepickerWindPop").show();
							$.ajax({
								type: "POST",
								url: "interface/js/timepicker.php",
								dataType: "html",
								beforeSend: function(){
									$("#timepickerWindPop .timepickerContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#timepickerWindPop .timepickerContent").html(resultEvento);
									$("#timepickerWindPop .timepickerContent").ready(function(){
										horaTimePicker = $("#horaTimePicker").attr("value");
										minutoTimePicker = $("#minutoTimePicker").attr("value");
										$("#horaTimePicker").bind("change",function(){
											horaTimePicker = $(this).attr("value");
										});
										$("#minutoTimePicker").bind("change",function(){
											minutoTimePicker = $(this).attr("value");
										});
										$(".submitTimePicker").css("cursor",cssCursor);
										$(".submitTimePicker").bind("click", function(){
											horaEscolhida = horaTimePicker + ":" + minutoTimePicker;
											$("#hora_evento").attr("value", horaEscolhida);
											$("#timepickerWindPop .timepickerContent").html("");
											$("#timepickerWindPop").hide();
										});
									});
								}
							});
						});
						$(".btnCallCidade").css("cursor",cssCursor);
						
						$("#cidade_evento").bind("click", function(){
							$(".btnCallCidade").click();
						});

						$(".btnCallCidade").bind("click", function(){
							$("#cidadeWindPop").css("position", "relative");
							$("#cidadeWindPop").css("top", "322px");
							$("#cidadeWindPop").css("left", "318px");
							$("#cidadeWindPop").css("z-index", "25000");
							$("#cidadeWindPop").show();
							$.ajax({
								type: "POST",
								url: "includes/cidadepicker.php",
								data: "estado="+idestado,
								dataType: "html",
								beforeSend: function(){
									$("#cidadeWindPop .cidadeContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#cidadeWindPop .cidadeContent").html(resultEvento);
									$("#cidadeWindPop .cidadeContent").ready(function(){
										$("#comboCidade").bind("focus",function(){
											nomecidade = this.options[this.selectedIndex].text;
											idcidade = this.options[this.selectedIndex].value;
										});
										$("#comboCidade").bind("change",function(){
											nomecidade = this.options[this.selectedIndex].text;
											idcidade = this.options[this.selectedIndex].value;
										});
										$(".submitCidadePop").css("cursor",cssCursor);
										$(".submitCidadePop").bind("click", function(){
											if (idestado != 0){
												$("#cidade_evento").attr("value", nomecidade);
												$("#id_cidade_evento").attr("value", idcidade);
											}
											$("#cidadeWindPop .cidadeContent").html("");
											$("#cidadeWindPop").hide();
										});
									});
									$("#comboCidade").focus();
								}
							});
						});
						$(".btnCallEstado").css("cursor",cssCursor);

						$("#estado_evento").bind("click", function(){
							$(".btnCallEstado").click();
						});

						$(".btnCallEstado").bind("click", function(){
							$("#estadoWindPop").css("position", "relative");
							$("#estadoWindPop").css("top", "322px");
							$("#estadoWindPop").css("left", "110px");
							$("#estadoWindPop").css("z-index", "25000");
							$("#estadoWindPop").show();
							$.ajax({
								type: "POST",
								url: "includes/estadopicker.php",
								dataType: "html",
								beforeSend: function(){
									$("#estadoWindPop .estadoContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#estadoWindPop .estadoContent").html(resultEvento);
									$("#estadoWindPop .estadoContent").ready(function(){
										$("#comboEstado").bind("focus",function(){
											nomeestado = this.options[this.selectedIndex].text;
											idestado = this.options[this.selectedIndex].value;
										});
										$("#comboEstado").bind("change",function(){
											nomeestado = this.options[this.selectedIndex].text;
											idestado = this.options[this.selectedIndex].value;
										});
										$(".submitEstadoPop").css("cursor",cssCursor);
										$(".submitEstadoPop").bind("click", function(){
											$("#estado_evento").attr("value", nomeestado);
											$("#id_estado_evento").attr("value", idestado);
											$("#estadoWindPop .estadoContent").html("");
											$("#estadoWindPop").hide();
										});
									});
									$("#comboEstado").focus();
								}
							});
						});
					});
						
				}
			});
	}
	
		
		
	function callVoltarUpdateFotoGraffite(){
		var data_linha = "insert=insert2&id_usuario=" + iug + "&titulo=" + tg + "&texto=" + txg + "&id_crew=" + icg + "&tipo_item=G";
		var pagina;
		
		$.ajax({
			url: 'includes/graffitesinsert.inc.php',
			type: 'post',
			data: data_linha,
			dataType: "html",
			success: function(retornoVideos){
				$("#conteudoGraffitesWindow").html(retornoVideos);
				$("#graffitesWindow .jqmnContent").ready(function(){
					var optionsGraffitePop = { 
						target: '#conteudoGraffitesWindow',
						url: 'includes/graffitesinsert.inc.php?insert=insert',
						type: 'post',
						beforeSubmit:  beforeSubmitGraffite,
						success:function(){
							$.ajax({
								type: "POST",
								url: "includes/subpages/subpagegraffitesallgalerias.ajx.inc.php",
								data: "pagina="+pagina,
								dataType: "html",
								success: function(retornoVideos){
									$("#fotosAllGalerias").html(retornoVideos);
									$(".thumbSubpageFoto").css("cursor", cssCursor);
								}
							});
						}
					};
					$("#miniPopSubmitGraffite").bind("click", function(){
						$('#frmGraffite').submit();
					});
					$('#frmGraffite').submit(function(){ 
						$(this).ajaxSubmit(optionsGraffitePop); 
						return false;
					}); 
				});
			}	
		});	
	}
	function callVoltarUpdateFotoPista(){
		var data_linha = "insert=insert2&id_usuario=" + iup + "&titulo=" + tp + "&texto=" + txp + "&nome=" + np +  "&id_crew=" + icp + "&id_tipo_pista=" + ipt + "&estado=" + ufp + "&cidade=" + cp + "&bairro=" + bp + "&endereco=" + endp + "&tipo_item=P";
		$.ajax({
			url: 'includes/novapistainsert.inc.php',
			type: 'post',
			data: data_linha,
			dataType: "html",
			success: function(retornoJanela){
				$("#conteudoNovapistaWindow").html(retornoJanela);
				$("#novapistaWindow .jqmnContent").ready(function(){
					var optionsPistaPop = { 
						target: '#conteudoNovapistaWindow',
						url: 'includes/novapistainsert.inc.php?insert=insert',
						type: 'post',
						beforeSubmit:  beforeSubmitPista,
						success: function(){
							$.ajax({
								type: "post",
								url: "includes/subpages/subpageallpistas.ajx.inc.php",
								success: function(retornoJanela){
									$(".destaqueTodasPistas").html(retornoJanela);
								},
								error: function(){
									//alert("erro!!!");
								}
							});
						}
					};
					$('#frmInterativoPistas').submit(function(){
						$(this).ajaxSubmit(optionsPistaPop); 
						return false;
					}); 
					$("#miniPopSubmitPista").bind("click", function(){
						$('#frmInterativoPistas').submit();
					});
				});
					
				$(".btnCallEstado").css("cursor", cssCursor);
				$(".btnCallCidade").css("cursor", cssCursor);
				$(".btnCallTipoPista").css("cursor", cssCursor);
				
				$("#tipo_pista").bind("click", function(){
					$(".btnCallTipoPista").click();
				});
						
				$(".btnCallTipoPista").click(function(){
					$("#tipopistaWindPopPista").css("position", "relative");
					$("#tipopistaWindPopPista").css("top", "-140px");
					$("#tipopistaWindPopPista").css("left", "125px");
					$("#tipopistaWindPopPista").css("z-index", "25000");
					$("#tipopistaWindPopPista").show();
					$.ajax({
						type: "POST",
						url: "includes/tipospistaspicker.php",
						data: "pistatipo="+idtipopista,
						dataType: "html",
						beforeSend: function(){
							$("#tipopistaWindPopPista .tipopistaContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
						},
						
						success: function(resultEvento){
							$("#tipopistaWindPopPista .tipopistaContent").html(resultEvento);
							$("#tipopistaWindPopPista .tipopistaContent").ready(function(){
								$("#comboTiposPistas").bind("focus",function(){
									nometipopista = this.options[this.selectedIndex].text;
									idtipopista = this.options[this.selectedIndex].value;
									});
								$("#comboTiposPistas").bind("change",function(){
									nometipopista = this.options[this.selectedIndex].text;
									idtipopista = this.options[this.selectedIndex].value;
									
								});
								$(".submitTipoPistaPop").css("cursor",cssCursor);
								$(".submitTipoPistaPop").bind("click", function(){
									if (idtipopista != 0){
										$("#tipo_pista").attr("value", nometipopista);
										$("#id_tipo_pista").attr("value", idtipopista);
									}
									$("#tipopistaWindPopPista .tipopistaContent").html("");
									$("#tipopistaWindPopPista").hide();
								});
							});
							$("#comboTipoPista").focus();
						}
					});
				});
				
				$("#cidade_pista").bind("click", function(){
					$(".btnCallCidade").click();
				});
				$(".btnCallCidade").click(function(){
					$("#cidadeWindPopPista").css("position", "relative");
					$("#cidadeWindPopPista").css("top", "-140px");
					$("#cidadeWindPopPista").css("left", "340px");
					$("#cidadeWindPopPista").css("z-index", "25000");
					$("#cidadeWindPopPista").show();
					$.ajax({
						type: "POST",
						url: "includes/cidadepicker.php",
						data: "estado="+idestado,
						dataType: "html",
						beforeSend: function(){
							$("#cidadeWindPopPista .cidadeContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
						},
						success: function(resultEvento){
							$("#cidadeWindPopPista .cidadeContent").html(resultEvento);
							$("#cidadeWindPopPista .cidadeContent").ready(function(){
								$("#comboCidade").bind("focus",function(){
									nomecidade = this.options[this.selectedIndex].text;
									idcidade = this.options[this.selectedIndex].value;
								});
								$("#comboCidade").bind("change",function(){
									nomecidade = this.options[this.selectedIndex].text;
									idcidade = this.options[this.selectedIndex].value;
								});
								$(".submitCidadePop").css("cursor",cssCursor);
								$(".submitCidadePop").bind("click", function(){
									if (idestado != 0){
										$("#cidade_pista").attr("value", nomecidade);
										$("#id_cidade_pista").attr("value", idcidade);
									}
									$("#cidadeWindPopPista .cidadeContent").html("");
									$("#cidadeWindPopPista").hide();
								});
							});
							$("#comboCidade").focus();
						}
					});
				});
			
				$("#estado_pista").bind("click", function(){
					$(".btnCallEstado").click();
				});
				$(".btnCallEstado").click(function(){
					$("#estadoWindPopPista").css("position", "relative");
					$("#estadoWindPopPista").css("top", "-140px");
					$("#estadoWindPopPista").css("left", "315px");
					$("#estadoWindPopPista").css("z-index", "25000");
					$("#estadoWindPopPista").show();
					$.ajax({
						type: "POST",
						url: "includes/estadopicker.php",
						dataType: "html",
						beforeSend: function(){
							$("#estadoWindPopPista .estadoContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
						},
						success: function(resultEvento){
							$("#estadoWindPopPista .estadoContent").html(resultEvento);
							$("#estadoWindPopPista .estadoContent").ready(function(){
								$("#comboEstado").bind("focus",function(){
									nomeestado = this.options[this.selectedIndex].text;
									idestado = this.options[this.selectedIndex].value;
								});
								$("#comboEstado").bind("change",function(){
									nomeestado = this.options[this.selectedIndex].text;
									idestado = this.options[this.selectedIndex].value;
								});
								$(".submitEstadoPop").css("cursor",cssCursor);
								$(".submitEstadoPop").bind("click", function(){
									$("#estado_pista").attr("value", nomeestado);
									$("#id_estado_pista").attr("value", idestado);
									$("#estadoWindPopPista .estadoContent").html("");
									$("#estadoWindPopPista").hide();
								});
							});
							$("#comboEstado").focus();
						}
					});
				});
			}	
		});
	}
	function callVoltarUpdateFotoAfter(){
		var data_linha = "insert=insert2&id_usuario=" + iua + "&titulo=" + ta + "&chamada=" + cha+ "&categoria=" + cta + "&endereco=" + enda +"&texto=" + txa + "&bairro=" + ba + "&cidade=" +ca+ "&uf=" +ufa+ "&email=" +ea+ "&telefone=" + tela + "&cep=" +cepa+ "&id_crew=" + ica + "&tipo_item=A";
		
		$.ajax({
			url: 'includes/afterridinginsert.inc.php',
			type: 'post',
			data: data_linha,
			dataType: "html",
			success: function(retornoAfter){
				$("#conteudoAfterridingWindow").html(retornoAfter);
				$("#afterridingWindow .jqmnContent").ready(function(){
						var optionsAfterridingPop = { 
							target: '#conteudoAfterridingWindow',
							url: 'includes/afterridinginsert.inc.php?insert=insert',
							type: 'post',
							beforeSubmit:  beforeSubmitAfterriding,
							success:function(){
								$.ajax({
									type: "POST",
									url: "includes/subpages/subpageafterridingallgalerias.ajx.inc.php",
									data: "pagina = 0",
									dataType: "html",
									beforeSend: function(){
										$("#fotosAllGalerias").html("<img src='interface/images/ajax-loading.gif' hspace='220' vspace='196' border='0' />");
									},
									success: function(retornoAfter){
										$("#fotosAllGalerias").html(retornoAfter);
										$(".thumbSubpageFoto").css("cursor", cssCursor);
									}
								});

							
							}
						};
						$("#miniPopSubmitAfterriding").bind("click", function(){
							$('#frmAfterriding').submit();
						});
						$('#frmAfterriding').submit(function(){ 
							$(this).ajaxSubmit(optionsAfterridingPop); 
							return false;
						});
						
						$(".btnCallEstado").css("cursor", cssCursor);
						$(".btnCallCidade").css("cursor", cssCursor);
						
						$("#cidade_afterriding").bind("click", function(){
							$(".btnCallCidade").click();
						});
					
						$(".btnCallCidade").bind("click", function(){
							$("#cidadeWindPopAfterriding").css("position", "relative");
							$("#cidadeWindPopAfterriding").css("top", "322px");
							$("#cidadeWindPopAfterriding").css("left", "318px");
							$("#cidadeWindPopAfterriding").css("z-index", "25000");
							$("#cidadeWindPopAfterriding").show();
							$.ajax({
								type: "POST",
								url: "includes/cidadepicker.php",
								data: "estado="+idestado,
								dataType: "html",
								beforeSend: function(){
									$("#cidadeWindPopAfterriding .cidadeContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#cidadeWindPopAfterriding .cidadeContent").html(resultEvento);
									$("#cidadeWindPopAfterriding .cidadeContent").ready(function(){
										$("#comboCidade").bind("focus",function(){
											nomecidade = this.options[this.selectedIndex].text;
											idcidade = this.options[this.selectedIndex].value;
										});
										$("#comboCidade").bind("change",function(){
											nomecidade = this.options[this.selectedIndex].text;
											idcidade = this.options[this.selectedIndex].value;
										});
										$(".submitCidadePop").css("cursor",cssCursor);
										$(".submitCidadePop").bind("click", function(){
											if (idestado != 0){
												$("#cidade_afterriding").attr("value", nomecidade);
												$("#id_cidade_afterriding").attr("value", idcidade);
											}
											$("#cidadeWindPopAfterriding .cidadeContent").html("");
											$("#cidadeWindPopAfterriding").hide();
										});
									});
									$("#comboCidade").focus();
								}
							});
						});
						$("#estado_afterriding").bind("click", function(){
							$(".btnCallEstado").click();
						});
						$(".btnCallEstado").click(function(){
							$("#estadoWindPopAfterriding").css("position", "relative");
							$("#estadoWindPopAfterriding").css("top", "322px");
							$("#estadoWindPopAfterriding").css("left", "110px");
							$("#estadoWindPopAfterriding").css("z-index", "25000");
							$("#estadoWindPopAfterriding").show();
							$.ajax({
								type: "POST",
								url: "includes/estadopicker.php",
								dataType: "html",
								beforeSend: function(){
									$("#estadoWindPopAfterriding .estadoContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
								},
								success: function(resultEvento){
									$("#estadoWindPopAfterriding .estadoContent").html(resultEvento);
									$("#estadoWindPopAfterriding .estadoContent").ready(function(){
										$("#comboEstado").bind("focus",function(){
											nomeestado = this.options[this.selectedIndex].text;
											idestado = this.options[this.selectedIndex].value;
										});
										$("#comboEstado").bind("change",function(){
											nomeestado = this.options[this.selectedIndex].text;
											idestado = this.options[this.selectedIndex].value;
										});
										$(".submitEstadoPop").css("cursor",cssCursor);
										$(".submitEstadoPop").bind("click", function(){
											$("#estado_afterriding").attr("value", nomeestado);
											$("#id_estado_afterriding").attr("value", idestado);
											$("#estadoWindPopAfterriding .estadoContent").html("");
											$("#estadoWindPopAfterriding").hide();
										});
									});
									$("#comboEstado").focus();
								}
							});
						});
				});

			}
		});	
		
				
	}
	function callVoltarUpdateFoto(){
		
		
		var data_linha = "insert=insert2&id_usuario=" + usuario + "&titulo=" + tf + "&texto=" + txf + "&id_crew=" + icf + "&tipo_item=F";
		$.ajax({
			url: 'includes/fotosinsert.inc.php',
			type: 'post',
			data: data_linha,
			dataType: "html",
			success: function(retornoFotos){
				$("#conteudoFotosWindow").html(retornoFotos);
				$("#fotosWindow .jqmnContent").ready(function(){
					var optionsFotoPop = { 
						target: '#conteudoFotosWindow',
						url: 'includes/fotosinsert.inc.php?insert=insert',
						type: 'post',
						beforeSubmit:  beforeSubmitFoto,
							success:function(){
								$.ajax({
									type: "POST",
									url: "includes/subpages/subpagefotosallgalerias.ajx.inc.php",
									data: "pagina = 0 ",
									dataType: "html",
									beforeSend: function(){
									$("#fotosAllGalerias").html("<img src='interface/images/ajax-loading.gif' hspace='220' vspace='196' border='0' />");
									},
									success: function(retornoFotos){
										$("#fotosAllGalerias").html(retornoFotos);
								}
							});
						}	
					};
					
					$("#miniPopSubmitFoto").bind("click", function(){
						$('#frmFoto').submit();
					});
					
					$('#frmFoto').submit(function(){ 
						$(this).ajaxSubmit(optionsFotoPop); 
						return false;
					});
				});
			}
		});
	}

function teste(){
	$(".membrosCrewIcone").css("cursor", cssCursor);
}


function enableInteractiveForm(quem){
	data = "";
	$(".hierCrew").css("cursor", cssCursor);
	$(".hierCrew").bind("click",function(){
		$(".hierCrew").parent().css("width","150px");
		$(".hierCrew").parent().css("background-color","#FFFFFF");
		$(this).parent().css("background-color","#C6ECFF");
		data = "hiercrew="+$(this).attr("rel");
	});
	
	if (quem == "novapista"){
		novaPistaAddContent();
	}
	if (quem == "fotospista"){
		btnAddFotoCaller();
	}
	if (quem == "fotoshomepista"){
		btnAddFotoHomePistaCaller();
	}
	if (quem == "filmespista"){
		btnAddVideoPistaCaller();
	}
	if (quem == "novacrew"){
		novaCrewAddContent();
	}
	if (quem == "afterriding"){
		novoAfterRidingAddContent();
	}
	$(".btnEstrela").css("cursor", cssCursor);
	
	$(".btnEstrela").bind("click", function(){
		valor = $(this).attr("rel");
		if (valor > 1) {
			posEstrela = "estrelas";
		}else{
			posEstrela = "estrela";
		}
		$(".selEstrela").html("<b> " + valor + " " + posEstrela + "</b>");
		$("#qtd_estrelas").attr("value",valor);
	});
	var options = { 
		target: "#"+quem+"Window .jqmnContent",
		url: "includes/"+quem+"insert.inc.php",
		data: data,
		type: "post",
		beforeSend: function(){
			$("#"+quem+"Window .jqmnContent").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function(){
			if (quem == "stars"){
				$("#indiqueAmigoPopStar").css("cursor", cssCursor);
					$("#indiqueAmigoPopStar").bind("click",function(){
						$("#starsWindow").hide();
						showMiniPop(idItemPop, tipoItemPop, "indique");
				});
			}
			
			if(quem == "comentario"){
				showMiniPop(idItemPop, tipoItemPop, "comentario");
				
			}
			
		}
	}; 
	$("#frmInterativo").submit(function(){ 
		if(quem == "comentario"){
			if(estaLogado == false){
				showLogin(id_item_comentario,"C");
			}else{
				$(this).ajaxSubmit(options);
			}
			
		}else if((quem == "stars")||(quem == "starstatus")){
			if(estaLogado == false){
				showLogin(id_item_comentario,"S");
			}else{
				$(this).ajaxSubmit(options);
			}
		}else if((quem == "gostei")||(quem == "gosteistatus")){
			if(estaLogado == false){
				showLogin(id_item_comentario,"S");
			}else{
				$(this).ajaxSubmit(options);
			}
		}else if((quem == "naogostei")||(quem == "naogosteistatus")){
			if(estaLogado == false){
				showLogin(id_item_comentario,"S");
			}else{
				$(this).ajaxSubmit(options);
			}	
		}else if((quem == "tag")||(quem == "tagstatus")){
			if(estaLogado == false){
				showLogin(id_item_comentario,"S");
			}else{
				$(this).ajaxSubmit(options);
			}
			
			
		}else{
			$(this).ajaxSubmit(options);
		}
		
		
		return false;
	}); 
	$("#miniPopSubmit").bind("click", function(){
		$('#frmInterativo').submit();
		
		if($(this).attr("rel") == "setarHierarquia"){
			$.ajax({
				type: "POST",
				data: "selecionada=membrosCrew&id_crew="+$("#idHomeCrew").attr("value"),
				url: "includes/subpages/crewmioloabas.subpage.inc.php",
				dataType: "html",
				beforeSend: function(){
					$("#crewsItensEnviadosBox_0").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
				},
				success: function(resultEvento){
					$("#crewsItensEnviadosBox_0").html(resultEvento);
					
					$(".membrosCrewIcone").css("cursor", cssCursor);
					$(".membrosCrewIcone").bind("click",function(){
						id_item = $("#idHomeCrew").attr("value");
						showMiniPop(id_item, "C", "titulandodiretor");
						scroll(0,0);
					});
				}
			});
		}	
	});
}
function callInsertTags(tipo_item, id_item, id_usuario){
		$.ajax({
		type:'post',
		url:"includes/tagsinsert.inc.php",
		data: "tipo_item="+tipo_item+"&id_item="+id_item+"&id_usuario="+id_usuario,
		beforeSend: function(){
			$("#conteudotagsWindow").html("<img src='interface/images/ajax-loading.gif' border='0' hspace='100' vspace='100' />");
		},
		success: function(retornoJanela){
			$("#conteudotagsWindow").html(retornoJanela);
				enableInteractiveForm("tags");
		}
	});
}

function callInserirNascimento(){
	var diaCalend = 0;
	var mesCalend = 0;
	var anoCalend = 0;
	
	$(".btnCallCalendarNascimento").css("cursor",cssCursor);
				
	$("#data_nascimento").bind("click", function(){
		$(".btnCallCalendarNascimento").click();
	});
	
	
	$(".btnCallCalendarNascimento").bind("click", function(){
		$("#calendWindPop").css("position", "relative");
		$("#calendWindPop").css("top", "-64px");
		$("#calendWindPop").css("left", "390px");
		$("#calendWindPop").css("z-index", "25000");
		$("#calendWindPop").show();
		$.ajax({
			type: "POST",
			url: "interface/js/ano.php",
			dataType: "html",
			beforeSend: function(){
				$("#calendWindPop .calendarContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
			},
			success: function(resultEvento){
				$("#calendWindPop .calendarContent").html(resultEvento);
				$("#calendWindPop .calendarContent").ready(function(){
					diaCalend = $("#diaCalendNascimento").attr("value");
					mesCalend = $("#mesCalendNascimento").attr("value");
					anoCalend = $("#anoCalendNascimento").attr("value");
					$("#diaCalendNascimento").bind("change",function(){
						diaCalend = $(this).attr("value");
					});
					$("#mesCalendNascimento").bind("change",function(){
						mesCalend = $(this).attr("value");
					});
					$("#anoCalendNascimento").bind("change",function(){
						anoCalend = $(this).attr("value");
					});
					$(".submitDataCalend").css("cursor",cssCursor);
					$(".submitDataCalend").bind("click", function(){
						dataEscolhida = diaCalend + "-" + mesCalend + "-" + anoCalend;
						
						$("#nascimento").attr("value", dataEscolhida);
						$("#calendWindPop .calendarContent").html("");
						$("#calendWindPop").hide();
					});
				});
				
			}
		});
	});
}

function centerDivMae(){
	var larguraDivMae = parseInt($("#mae").width());
	var leftPosDivMae = Math.round((larguraWindow - larguraDivMae) / 2) + "px";
	$("#mae").css("left",leftPosDivMae);
}
function showHands(){
	if (overlayShowed == false){
		showOverlay();
	}
	$("#handsOn").css('z-index','10000');
	$("#handsOn").show();
}
function positioningLoadingMini(callerEl){
	var pos = getAbsolutePosition(callerEl);
	$("#loadingMini").css("display", "block");
	$("#loadingMini").css("position", "absolute");
	$("#loadingMini").css("z-index", "999999");
	$("#loadingMini").css("top", pos.y);
	$("#loadingMini").css("left", pos.x);
	$("#loadingMini").show("slow");
}
function validateFormCadastro(){
	var freeToGo = true;
	if (doEmail(document.getElementById("email").value,3)==false){
		freeToGo = false; errorField = true;
		document.getElementById("email").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "e-mail inv&aacute;lido!";
		document.getElementById("email").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}else if(document.getElementById("nome").value == ""){
		freeToGo = false; errorField = true;
		document.getElementById("nome").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "Informe o seu nome!";
		document.getElementById("nome").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}else if(document.getElementById("sobrenome").value == ""){
		freeToGo = false; errorField = true;
		document.getElementById("sobrenome").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "Informe o seu sobrenome!";
		document.getElementById("sobrenome").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}else if(document.getElementById("apelido").value == ""){
		freeToGo = false; errorField = true;
		document.getElementById("apelido").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "Informe o seu apelido!";
		document.getElementById("apelido").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}else if(document.getElementById("email").value == ""){
		freeToGo = false; errorField = true;
		document.getElementById("email").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "Informe o seu e-mail!";
		document.getElementById("email").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}else if(document.getElementById("emailconfirma").value == ""){
		freeToGo = false; errorField = true;
		document.getElementById("emailconfirma").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "Informe o seu e-mail de confirmação!";
		document.getElementById("emailconfirma").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}else if(document.getElementById("senha").value == ""){
		freeToGo = false; errorField = true;
		document.getElementById("senha").className = "inputFormError";
		document.getElementById("errorMessage").innerHTML = "Informe a sua senha!";
		document.getElementById("senha").focus();
		$("#errorMessageDiv").css("visibility", "visible");
		$('#errorMessageDiv').show();
	}
	if (freeToGo){
		document.forms[0].submit();
	}else{
		return false;
	}
}
function showCadastramento(passo){
	winType = "showWindow";
	data = "passo="+passo;
	switch(winType){
		case "showWindow":
			janelaName = '#showWindowJanelaPop';
		break;
		case "showWindow2":
			janelaName = '#showWindowJanelaPop2';
		break;
	}
	if (overlayShowed == false){
		showOverlay();
	}
	if($.browser.msie){
		$(janelaName).css("top", topPosJanelaPop);
		if (winType == "showWindow2"){
			$(janelaName).css("left", parseInt(leftPosJanelaPop) - 110 + "px");
		}else{
			$(janelaName).css("left", leftPosJanelaPop);
		}
	}else{
		$.position(janelaName,'center', 'center');
	}
	$(janelaName + " div.loadingcenter").show();
	linkUrlJanelaPop = "cadastramento.php";
	captionJanelaPop = "Bem-vindo ao cadastro do Portal Indzooom";
	$.ajax({
		type: 'post',
		dataType: 'html, script',
		url: linkUrlJanelaPop,
		data: data,
		success: function (retornoJanela){
			$(janelaName + "Conteudo").html(retornoJanela);
		},
		complete: function(){
			if (linkUrlJanelaPop == "cadastramento.php"){
				enableCadastramento();
			}
			$(janelaName + " div.loadingcenter").hide();
			$(janelaName + "Conteudo").ready(function(){
				$('img.janelaClose').click(function(){
					//alert('img.janelaClose 3');
					if (comentarioWindowShow){$("#comentarioWindow").hide();}
					if (denuncieWindowShow){$("#denuncieWindow").hide();}
					if (favoritosWindowShow){$("#favoritosWindow").hide();}
					if (indiqueWindowShow){$("#indiqueWindow").hide();}
					if (starsWindowShow){$("#starsWindow").hide();}
					if (tagsWindowShow){$("#tagsWindow").hide();}
					if (gosteiWindowShow){$("#gosteiWindow").hide();}
					if (naogosteiWindowShow){$("#naogosteiWindow").hide();}
					if (eventoWindowShow){$("#eventoWindow").hide();}
					if (faWindowShow){$("#faWindow").hide();}
					if (membrosWindowShow){$("#membrosWindow").hide();}
					if (amizadeWindowShow){$("#amizadeWindow").hide();}
					if (allcrewsWindowShow){$("#allcrewsWindow").hide();}
					if (localizarcrewWindowShow){$("#localizarcrewWindow").hide();}
					if (localizarpistaWindowShow){$("#localizarpistaWindow").hide();}
					if (localizarafterridingWindowShow){$("#localizarafterridingWindow").hide();}
					if (fotoshomepistaWindowShow){$("#fotoshomepistaWindow").hide();}
					if (privacidadeWindowShow){$("#privacidadeWindow").hide();}
					if (conteudoPoliticadeprivacidadeWindowShow){$("#conteudoPoliticadeprivacidadeWindow").hide();}
					if (conteudoComofuncionaWindowShow){$("#conteudoComofuncionaWindow").hide();}
					if (centralderelacionamentosWindowShow){$("#centralderelacionamentosWindow").hide();}
					if (buscaportalindzooomWindowShow){$("#buscaportalindzooomWindow").hide();}
					if (titulandodiretorWindowShow){$("#titulandodiretorWindow").hide();}
					
					if(!janelaName){
						$("#showWindowJanelaPop2").hide();	
						$("#showWindowJanelaPop2Conteudo").html("");
						$("#showWindowJanelaPop").hide();	
						$("#showWindowJanelaPopConteudo").html("");
						hideOverlay();
					}else{
						$(janelaName + "Conteudo").html("");
						$(janelaName).hide();
					}
					//hideOverlay();
					hideOverlay();
					glbNivel = 0;
					
					//decGlbNivel();
				});
				$('.jqmClose').click(function(){
					var quem = $(this).parent().attr("id");
					$("#"+quem+" .jqmnContent").html("");
					$("#"+quem).hide();
					
					decGlbNivel();
					
					if (quem == "noticiaWindow"){
						hideOverlay();
					}
					
				});
			});
		}
	});
	$(janelaName + " H1.alertCaption").html(captionJanelaPop);
	$(janelaName).css('z-index','10000');
	$(janelaName).show();
}

function showCadastramentoComplementar(){
	janelaName = '#showWindowJanelaPop';
	$("#handsOn").hide();
	if (overlayShowed == false){
		showOverlay();
	}
	if($.browser.msie){
		$(janelaName).css("top",'250');
		$(janelaName).css("left",'330');
	}else{
		$.position(janelaName,'center', 'center');
	}
	$(janelaName + " div.loadingcenter").show();
	linkUrlJanelaPop = "cadastramento.php";
	captionJanelaPop = "Bem-vindo ao portal Indzooom!";	
	data = "passo=3";
	$.ajax({
		type: 'post',
		dataType: 'html, script',
		url: linkUrlJanelaPop,
		data: data,
		success: function (retornoJanela){
			$(janelaName + "Conteudo").html(retornoJanela);
		},
		complete: function(){
			if (linkUrlJanelaPop == "cadastramento.php"){
				enableCadastramento2();
			}
			$(janelaName + " div.loadingcenter").hide();
		}
	});
	$(janelaName + " H1.alertCaption").html(captionJanelaPop);
	$(janelaName).css('z-index','10000');
	$(janelaName).show();
}

function showEsqueciSenha(){
	winType = "showWindow";
	data = "passo=0";
	switch(winType){
		case "showWindow":
			janelaName = '#showWindowJanelaPop';
		break;
		case "showWindow2":
			janelaName = '#showWindowJanelaPop2';
		break;
	}
	if (overlayShowed == false){
		showOverlay();
	}
	
	if($.browser.msie){
		$(janelaName).css("top", topPosJanelaPop);
		if (winType == "showWindow2"){
			$(janelaName).css("left", parseInt(leftPosJanelaPop) - 110 + "px");
		}else{
			$(janelaName).css("left", leftPosJanelaPop);
		}
	}else{
		$.position(janelaName,'center', 'center');
	}
	$(janelaName + " div.loadingcenter").show();
	linkUrlJanelaPop = "esquecisenha.php";
	captionJanelaPop = "Esqueci minha senha";
	$.ajax({
		type: 'post',
		dataType: 'html, script',
		url: linkUrlJanelaPop,
		data: data,
		success: function (retornoJanela){
			$(janelaName + "Conteudo").html(retornoJanela);
		},
		complete: function(){
			if (linkUrlJanelaPop == "esquecisenha.php"){
				enableEnviaSenha();
			}
			$(janelaName + " div.loadingcenter").hide();
			$(janelaName + "Conteudo").ready(function(){
				$('img.janelaClose').click(function(){
					//alert('img.janelaClose 4');
					if (comentarioWindowShow){$("#comentarioWindow").hide();}
					if (denuncieWindowShow){$("#denuncieWindow").hide();}
					if (favoritosWindowShow){$("#favoritosWindow").hide();}
					if (indiqueWindowShow){$("#indiqueWindow").hide();}
					if (starsWindowShow){$("#starsWindow").hide();}
					if (tagsWindowShow){$("#tagsWindow").hide();}
					if (gosteiWindowShow){$("#gosteiWindow").hide();}
					if (naogosteiWindowShow){$("#naogosteiWindow").hide();}
					if (eventoWindowShow){$("#eventoWindow").hide();}
					if (faWindowShow){$("#faWindow").hide();}
					if (membrosWindowShow){$("#membrosWindow").hide();}
					if (amizadeWindowShow){$("#amizadeWindow").hide();}
					if (allcrewsWindowShow){$("#allcrewsWindow").hide();}
					if (localizarcrewWindowShow){$("#localizarcrewWindow").hide();}
					if (localizarpistaWindowShow){$("#localizarpistaWindow").hide();}
					if (localizarafterridingWindowShow){$("#localizarafterridingWindow").hide();}
					if (fotoshomepistaWindowShow){$("#fotoshomepistaWindow").hide();}
					if (privacidadeWindowShow){$("#privacidadeWindow").hide();}
					if (conteudoPoliticadeprivacidadeWindowShow){$("#conteudoPoliticadeprivacidadeWindow").hide();}
					if (conteudoComofuncionaWindowShow){$("#conteudoComofuncionaWindow").hide();}
					if (centralderelacionamentosWindowShow){$("#centralderelacionamentosWindow").hide();}
					if (buscaportalindzooomWindowShow){$("#buscaportalindzooomWindow").hide();}
					if (titulandodiretorWindowShow){$("#titulandodiretorWindow").hide();}
					
					if(!janelaName){
						$("#showWindowJanelaPop2").hide();	
						$("#showWindowJanelaPop2Conteudo").html("");
						$("#showWindowJanelaPop").hide();	
						$("#showWindowJanelaPopConteudo").html("");
					}else{
						$(janelaName + "Conteudo").html("");
						$(janelaName).hide();
					}
					hideOverlay();
					glbNivel = 0;
					
					//decGlbNivel();
				});
				$('.jqmClose').click(function(){
					var quem = $(this).parent().attr("id");
					$("#"+quem+" .jqmnContent").html("");
					$("#"+quem).hide();
					
					if (quem == "noticiaWindow"){
						hideOverlay();
					}
					
					decGlbNivel();
				});
			});
		}
	});
	$(janelaName + " H1.alertCaption").html(captionJanelaPop);
	$(janelaName).css('z-index','10000');
	$(janelaName).show();
}
	function adjustAllColumnsSizesMain(){
		//adjust all columns sizes
		coluna1Height = $("#coluna1").height();
		coluna2Height = $("#coluna2").height();
		coluna3Height = $("#coluna3").height();
		
		tmpHeight = 0;
		
		if (tmpHeight < coluna1Height){
			tmpHeight = coluna1Height;
		}
		if (tmpHeight < coluna2Height){
			tmpHeight = coluna2Height;
		}
		if (tmpHeight < coluna3Height){
			tmpHeight = coluna3Height;
		}
		
		$("#coluna1").css("height",tmpHeight);
		$("#coluna2B").css("height",tmpHeight);
		$("#coluna3").css("height",tmpHeight);
	}
	function adjustAllColumnsSizes(){
		coluna1Height = $("#coluna1").height();
		coluna2Height = $("#coluna2B").height();
		coluna3Height = $("#coluna3").height();
		
		tmpHeight = 0;
		
		if (tmpHeight < coluna1Height){
			tmpHeight = coluna1Height;
		}
		if (tmpHeight < coluna2Height){
			tmpHeight = coluna2Height;
		}
		if (tmpHeight < coluna3Height){
			tmpHeight = coluna3Height;
		}
		
		$("#coluna1").css("height",tmpHeight);
		$("#coluna2B").css("height",tmpHeight);
		$("#coluna3").css("height",tmpHeight);
	}
	/**
	 * Retrieve the coordinates of the given event relative to the center
	 * of the widget.
	 *
	 * @param event
	 *   A mouse-related DOM event.
	 * @param reference
	 *   A DOM element whose position we want to transform the mouse coordinates to.
	 * @return
	 *    A hash containing keys 'x' and 'y'.
	 */
	function getRelativeCoordinates(event, reference) {
	    var x, y;
	    event = event || window.event;
	    var el = event.target || event.srcElement;

	    if (!window.opera && typeof event.offsetX != 'undefined') {
	    // Use offset coordinates and find common offsetParent
	    var pos = { x: event.offsetX, y: event.offsetY };

	    // Send the coordinates upwards through the offsetParent chain.
	    var e = el;
	    while (e) {
		    e.mouseX = pos.x;
		    e.mouseY = pos.y;
		    pos.x += e.offsetLeft;
		    pos.y += e.offsetTop;
		    e = e.offsetParent;
		}
	    // Look for the coordinates starting from the reference element.
	    var e = reference;
	    var offset = { x: 0, y: 0 }
	    while (e) {
		    if (typeof e.mouseX != 'undefined') {
		        x = e.mouseX - offset.x;
		        y = e.mouseY - offset.y;
		        break;
		    }
		    offset.x += e.offsetLeft;
		    offset.y += e.offsetTop;
		    e = e.offsetParent;
	    }

	    // Reset stored coordinates
	    e = el;
	    while (e) {
		    e.mouseX = undefined;
		    e.mouseY = undefined;
		    e = e.offsetParent;
	    }
	}else{
	    // Use absolute coordinates
	    var pos = getAbsolutePosition(reference);
	    x = event.pageX  - pos.x;
	    y = event.pageY - pos.y;
	}
	  // Subtract distance to middle
	return { x: x, y: y };
	} 
	function getAbsolutePosition(element) {
		var r = { x: element.offsetLeft, y: element.offsetTop };
		if (element.offsetParent) {
			var tmp = getAbsolutePosition(element.offsetParent);
			r.x += tmp.x;
			r.y += tmp.y;
		}
		return r;
	}
	function montaShowtip(){
		var tags = isDOM ? document.getElementsByTagName('*') : [];
		for (var i = 0; i < tags.length; i++){
			if (tags[i].title == "???")
				tags[i].title = "";
			tempTitle = tags[i].title;
			tempAlt = tags[i].alt;
			if (tempTitle == "")
				tempTitle = tempAlt;
			if (tempTitle){
				tags[i].onmouseover = new Function('docTips.newTip("tagTip' + i + '", 5, 5, 100, "' +
				tempTitle + '")');
				tags[i].onmouseout = new Function('docTips.hide();');//tags[i].title = tempTitle; tags[i].alt = tempAlt;');
			}
			tags[i].title = "";
			tags[i].alt = "";	
		}
	}
	function removeAlts(){
		 var tags = isDOM ? document.getElementsByTagName('*') : [];
		 for (var i = 0; i < tags.length; i++){
			if (tags[i].alt){
				tags[i].alt = '';
			}
		}
	}
	function titlesToTips(){
		var tags = isDOM ? document.getElementsByTagName('*') : [];
		for (var i = 0; i < tags.length; i++){
			if (tags[i].title == "???")
				tags[i].title = "";
			if (tags[i].title){
				tags[i].onmouseover = new Function('docTips.newTip("tagTip' + i + '", 5, 5, 100, "' +
				tags[i].title + '")');
				tags[i].onmouseout = new Function('docTips.hide()');
				//tags[i].title = '';
			}
			
		}
	}
	function positioningLoadingMini(callerEl){
		var pos = getAbsolutePosition(callerEl);
		$("#loadingMini").css("display", "block");
		$("#loadingMini").css("position", "absolute");
		$("#loadingMini").css("z-index", "999999");
		$("#loadingMini").css("top", pos.y);
		$("#loadingMini").css("left", pos.x);
		$("#loadingMini").show();
	}
	
	function processBusca(texto, area){
		alert("Em desenvolvimento");
	}
	
	function showImagemGaleria(elCaller){
		jqModalBindClick($(elCaller));
/*	srcImage = $(elCaller).attr("longdesc");
		captionImage = $(elCaller).attr("caption");
		idFoto = $(elCaller).attr("idfoto");
		janelaName = '#showWindowJanelaPop';
		showOverlay();
		if($.browser.msie){
			$(janelaName).css("top", topPosJanelaPop);
			$(janelaName).css("left", parseInt(leftPosJanelaPop) + "px");
		}else{
			$.position(janelaName,'center', 'center');
		}
		$(janelaName + " div.loadingcenter").show();
		
		$.ajax({
			type: 'post',
			dataType: 'html, script',
			data: "src_foto="+srcImage+"&id_foto="+idFoto,
			url: "showfotopop.php",
			success: function (retornoJanela){
				$(janelaName + "Conteudo").html(retornoJanela);
			},
			complete: function(){
				$(janelaName + " div.loadingcenter").hide();
			}
		});
		$(janelaName + " H1.alertCaption").html(captionImage);
		$(janelaName).css('z-index','10000');
		$(janelaName).show();

		return false; 
	*/
	}
	
	function fisheyemenuHorizontal(data){
		$(".btnfisheye").css("cursor",cssCursor);

		$("#fisheyemenu").css("width","720px");
		$("#fisheyemenu").css("height","78px");
		$("#fisheyemenu").css("display","block");
		$("#fisheyemenu").css("position","absolute");
		$("#fisheyemenu").css("bottom","30px");
		$("#fisheyemenu").css("left","130px");
		
		$("#fisheyemenu").css("float","none");
		$("#fisheyemenu").css("padding","0px");
		$("#fisheyemenu").css("padding-top","8px");
		$("#fisheyemenu").css("padding-left","0px");
		$("#fisheyemenu").css("margin","0px");
		$("#fisheyemenu").css("overflow","hidden");
		
		
		var btnFishEyeClass = $(".btnfisheye");
		var caminhoImagem = "interface/images/fisheye/";
		var suplementoImagemOn = "_h_on.png";
		var suplementoImagemOff = "_h_off.png";
		
		$(".btnfisheye").ready(function(){
			$(this).children("img").css("width","64px");
			$(this).children("img").css("margin","0px");
			$(this).children("img").css("padding","0px");
		});

		btnFishEyeClass.css("margin","0px");
		btnFishEyeClass.css("padding","0px");
		btnFishEyeClass.css("width","64px");
		btnFishEyeClass.css("display","block");
		btnFishEyeClass.css("float","left");
		btnFishEyeClass.css("clear","right");
		btnFishEyeClass.children("img").css("width","64px");
		btnFishEyeClass.children("img").css("margin","0px");
		btnFishEyeClass.children("img").css("padding","0px");

		$(".btnfisheye").bind("mouseover",function(){
			var iconeImagem = $(this).attr("rel");
			var fonteImagem = caminhoImagem + iconeImagem + suplementoImagemOn;
			$(this).children("img").attr("src",fonteImagem);
			$(this).animate({ width: "96px" });
			$(this).children("img").animate({ width: "96px" });
		});

		$(".btnfisheye").bind("mouseout",function(){
			var iconeImagem = $(this).attr("rel");
			var fonteImagem = caminhoImagem + iconeImagem + suplementoImagemOff;
			$(this).children("img").attr("src",fonteImagem);
			$(this).animate({ width: "64px" });
			$(this).children("img").animate({ width: "64px" });
		});
		
		$(".btnfisheye").bind("click",function(){
			var dataNew = data;
			
			actionLink = $(this).attr("rel");
			if (dataNew.substr(0,4) == "tipo"){
				dataNew = dataNew.replace("&tipo_item=",";tipo_item='");
				dataNew = dataNew.replace("&id","';id");
			}else{
				dataNew = dataNew.replace("&tipo_item=",";tipo_item='");
				dataNew = dataNew.replace("&id","';id");
				if (dataNew.indexOf("tipo") != -1){
					dataNew = dataNew + "'";
				}
			}
			dataNew = dataNew.replace("src_foto=","src_foto='");
			eval(dataNew);
			if (tipo_item == "" || !tipo_item){
				tipo_item = tipoItemPop;
			}
			showMiniPop(id_item, tipo_item ,actionLink);
		});
	}
	function fisheyemenuHorizontalMidPage(data){
		$(".btnfisheye").css("cursor",cssCursor);
		
		if($.browser.msie){
			$("#fisheyemenu").css("width","650px");
			$("#fisheyemenu").css("height","78px");
			$("#fisheyemenu").css("display","block");
			$("#fisheyemenu").css("position","relative");
			$("#fisheyemenu").css("top","0px");
			$("#fisheyemenu").css("left","0px");
			$("#fisheyemenu").css("float","none");
			$("#fisheyemenu").css("padding","0px");
			$("#fisheyemenu").css("padding-top","8px");
			$("#fisheyemenu").css("padding-left","0px");
			$("#fisheyemenu").css("margin","0px");
			$("#fisheyemenu").css("overflow","hidden");
		}else{
			$("#fisheyemenu").css("width","650px");
			$("#fisheyemenu").css("height","78px");
			$("#fisheyemenu").css("display","block");
			$("#fisheyemenu").css("position","relative");
			$("#fisheyemenu").css("top","0px");
			$("#fisheyemenu").css("left","0px");
			$("#fisheyemenu").css("float","left");
			$("#fisheyemenu").css("padding","0px");
			$("#fisheyemenu").css("padding-top","8px");
			$("#fisheyemenu").css("padding-left","0px");
			$("#fisheyemenu").css("margin","0px");
			$("#fisheyemenu").css("overflow","hidden");
		}
		
		var btnFishEyeClass = $(".btnfisheye");
		var caminhoImagem = "interface/images/fisheye/";
		var suplementoImagemOn = "_h_on.png";
		var suplementoImagemOff = "_h_off.png";
		
		$(".btnfisheye").ready(function(){
			$(this).children("img").css("width","64px");
			$(this).children("img").css("margin","0px");
			$(this).children("img").css("padding","0px");
		});

		btnFishEyeClass.css("margin","0px");
		btnFishEyeClass.css("padding","0px");
		btnFishEyeClass.css("width","64px");
		btnFishEyeClass.css("display","block");
		btnFishEyeClass.css("float","left");
		btnFishEyeClass.css("clear","right");
		btnFishEyeClass.children("img").css("width","64px");
		btnFishEyeClass.children("img").css("margin","0px");
		btnFishEyeClass.children("img").css("padding","0px");

		$(".btnfisheye").bind("mouseover",function(){
			var iconeImagem = $(this).attr("rel");
			var fonteImagem = caminhoImagem + iconeImagem + suplementoImagemOn;
			$(this).children("img").attr("src",fonteImagem);
			$(this).animate({ width: "96px" });
			$(this).children("img").animate({ width: "96px" });
		});

		$(".btnfisheye").bind("mouseout",function(){
			var iconeImagem = $(this).attr("rel");
			var fonteImagem = caminhoImagem + iconeImagem + suplementoImagemOff;
			$(this).children("img").attr("src",fonteImagem);
			$(this).animate({ width: "64px" });
			$(this).children("img").animate({ width: "64px" });
		});
		
		$(".btnfisheye").bind("click",function(){
			var dataNew = data;
			actionLink = $(this).attr("rel");
			if (dataNew.substr(0,4) == "tipo"){
				dataNew = dataNew.replace("tipo_item=","tipo_item='");
				dataNew = dataNew.replace("&id","'&id");
			}else{
				dataNew = dataNew.replace("tipo_item=","tipo_item='");
				if (dataNew.indexOf("tipo") != -1){
					dataNew = dataNew + "'";
				}
			}
			dataNew = dataNew.replace("\&",";");
			eval(dataNew);
			if (tipo_item == "" || !tipo_item){
				tipo_item = tipoItemPop;
			}
			showMiniPop(id_item, tipo_item ,actionLink);
		});
	}
	function fisheyemenuVertical(data){
		$(".btnfisheye").css("cursor",cssCursor);
		$("#fisheyemenu").css("width","96px");
		$("#fisheyemenu").css("height","420px");
		$("#fisheyemenu").css("z-index","1000");
		$("#fisheyemenu").css("display","block");
		$("#fisheyemenu").css("float","none");
		$("#fisheyemenu").css("padding","0px");
		$("#fisheyemenu").css("padding-top","8px");
		$("#fisheyemenu").css("padding-left","0px");
		$("#fisheyemenu").css("margin","0px");
		$("#fisheyemenu").css("overflow","hidden");
		
		var btnFishEyeClass = $(".btnfisheye");
		var caminhoImagem = "interface/images/fisheye/";
		var suplementoImagemOn = "_h_on.png";
		var suplementoImagemOff = "_h_off.png";
		
		btnFishEyeClass.css("margin","0px");
		btnFishEyeClass.css("padding","0px");
		btnFishEyeClass.css("width","64px");
		btnFishEyeClass.css("display","block");
		btnFishEyeClass.css("float","none");
		btnFishEyeClass.css("clear","none");
		btnFishEyeClass.children("img").css("width","64px");
		btnFishEyeClass.children("img").css("margin","0px");
		btnFishEyeClass.children("img").css("padding","0px");

		$(".btnfisheye").bind("mouseover",function(){
			var iconeImagem = $(this).attr("rel");
			var fonteImagem = caminhoImagem + iconeImagem + suplementoImagemOn;
			$(this).children("img").attr("src",fonteImagem);
			$(this).animate({ width: "96px" });
			$(this).children("img").animate({ width: "96px" });
		});

		$(".btnfisheye").bind("mouseout",function(){
			var iconeImagem = $(this).attr("rel");
			var fonteImagem = caminhoImagem + iconeImagem + suplementoImagemOff;
			$(this).children("img").attr("src",fonteImagem);
			$(this).animate({ width: "64px" });
			$(this).children("img").animate({ width: "64px" });
		});
		
		$(".btnfisheye").bind("click",function(){
			var dataNew = data;
			actionLink = $(this).attr("rel");
			if (dataNew.substr(0,4) == "tipo"){
				dataNew = dataNew.replace("tipo_item=","tipo_item='");
				dataNew = dataNew.replace("&id","'&id");
			}else{
				dataNew = dataNew.replace("tipo_item=","tipo_item='");
				if (dataNew.indexOf("tipo") != -1){
					dataNew = dataNew + "'";
				}
			}
			dataNew = dataNew.replace("\&",";");
			eval(dataNew);
			if (tipo_item == "" || !tipo_item){
				tipo_item = tipoItemPop;
			}
			showMiniPop(id_item, tipo_item ,actionLink);
		});
	
	}
	
	function enableFormCidade(){
		$(".btnCallCidade").css("cursor", cssCursor);
		
		$("#cidade_lista").bind("click", function(){
			$(".btnCallCidade").click();
		});
		$(".btnCallCidade").click(function(){
			$("#cidadeWindPopLista").css("position", "relative");
			$("#cidadeWindPopLista").css("top", "160px");
			$("#cidadeWindPopLista").css("left", "145px");
			$("#cidadeWindPopLista").css("z-index", "25000");
			$("#cidadeWindPopLista").show();
			$.ajax({
				type: "POST",
				url: "includes/cidadepicker.php",
				data: "estado="+idestado,
				dataType: "html",
				beforeSend: function(){
					$("#cidadeWindPopLista .cidadeContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
				},
				success: function(resultEvento){
					$("#cidadeWindPopLista .cidadeContent").html(resultEvento);
					$("#cidadeWindPopLista .cidadeContent").ready(function(){
						$("#comboCidade").bind("focus",function(){
							nomecidade = this.options[this.selectedIndex].text;
							idcidade = this.options[this.selectedIndex].value;
						});
						$("#comboCidade").bind("change",function(){
							nomecidade = this.options[this.selectedIndex].text;
							idcidade = this.options[this.selectedIndex].value;
						});
						$.browser.msie?$(".submitCidadePop").css("cursor","hand"):$(".submitCidadePop").css("cursor","pointer");
						$(".submitCidadePop").bind("click", function(){
							if (idestado != 0){
								$("#cidade_lista").attr("value", nomecidade);
								$("#id_cidade_lista").attr("value", idcidade);
							}
							$("#cidadeWindPopLista .cidadeContent").html("");
							$("#cidadeWindPopLista").hide();
						});
					});
					$("#comboCidade").focus();
				}
			});
		});
	}

	function enableFormEstado(){
		$(".btnCallEstado").css("cursor", cssCursor);
		
		$("#estado_lista").bind("click", function(){
			$(".btnCallEstado").click();
		});
		
		$(".btnCallEstado").click(function(){
			$("#estadoWindPopLista").css("position", "relative");
			$("#estadoWindPopLista").css("top", "160px");
			$("#estadoWindPopLista").css("left", "145px");
			$("#estadoWindPopLista").css("z-index", "25000");
			$("#estadoWindPopLista").show();
			$.ajax({
				type: "POST",
				url: "includes/estadopicker.php",
				dataType: "html",
				beforeSend: function(){
					$("#estadoWindPopLista .estadoContent").html("<img src='interface/images/ajax-loading.gif' hspace='60' vspace='10' border='0' />");
				},
				success: function(resultEvento){
					$("#estadoWindPopLista .estadoContent").html(resultEvento);
					$("#estadoWindPopLista .estadoContent").ready(function(){
						$("#comboEstado").bind("focus",function(){
							nomeestado = this.options[this.selectedIndex].text;
							idestado = this.options[this.selectedIndex].value;
						});
						$("#comboEstado").bind("change",function(){
							nomeestado = this.options[this.selectedIndex].text;
							idestado = this.options[this.selectedIndex].value;
						});
						$.browser.msie?$(".submitEstadoPop").css("cursor","hand"):$(".submitEstadoPop").css("cursor","pointer");
						$(".submitEstadoPop").bind("click", function(){
							$("#estado_lista").attr("value", nomeestado);
							$("#id_estado_lista").attr("value", idestado);
							$("#estadoWindPopLista .estadoContent").html("");
							$("#estadoWindPopLista").hide();
						});
					});
					$("#comboEstado").focus();
					$("#cidade_lista").attr("value", "");
					$("#id_cidade_lista").attr("value", "");
				}
			});
		});
	}
	
	function getCaretPos(obj){
	  obj.focus();
	  
	  if(obj.selectionStart) 
		return obj.selectionStart;
	  else if (document.selection){
	    var sel = document.selection.createRange();
	    var clone = sel.duplicate();
	    sel.collapse(true);
	    clone.moveToElementText(obj);
	    clone.setEndPoint('EndToEnd', sel);
	    return clone.text.length;
	  }
	  return 0;
	}
	function decGlbNivel(){
		//alert("glbNivel atual = " + glbNivel);
		if(glbNivel<2){
			hideOverlay();
		}
		hideTransparentOverlay();
		glbNivel--;	
		//alert("glbNivel dec = " + glbNivel);
	}
	
	function incGlbNivel(){
		//alert("glbNivel atual = " + glbNivel);
		glbNivel++;
		//alert("glbNivel inc = " + glbNivel);
	}
	function enableScriptBuscaResult(){
		$(".jqModal").css("cursor", cssCursor);
		$(".goTo").css("cursor", cssCursor);
		
		$(".jqModal").bind("click", function(){
			jqModalBindClick($(this));
		});
		$(".goTo").bind("click", function(){
			var url = $(this).attr("longdesc");
			var data = "?" + $(this).attr("data");
			document.location.href = url + data;
		});
		
		//alert("carregou");
	}
