    var tela='';
    var movie='';
    function mostradivfrmPostComment(){
	
	$("#divfrmPostComment").toggle(400);
	return false;
    }
    function mostravideo(tela,movie,w,h){
	 if (w == null){
	    w = 425;
	  }
	   if (h == null){
	    h = 344;
	  }
	$("#Mostravid_"+tela).html('<div id="fechavid'+tela+'"><a href="#'+tela+'" onclick="fechavideo(\''+tela+'\'); return false;"><img src="http://www.comidadibuteco.com.br/imagens/btn_fechar.gif" border="0"></a></div><br><object  width="'+w+'" height="'+h+'"><param name="movie" value="http://www.youtube.com/v/'+movie+'&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+movie+'&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+w+'" height="'+h+'"></embed></object>');
	$("#Mostravid_"+tela).css("visibility","visible");
	return true;
    }
    function fechavideo(tela){
	$("#Mostravid_"+tela).html('&nbsp;');
	$("#Mostravid_"+tela).css("visibility","hidden");
	return false;
    }
    $(function () {
	    var $alert = $('#alert');
	    if($alert.length)
	    {
		    var alerttimer = window.setTimeout(function () {
			    $alert.trigger('click');
		    }, 20000);
		    $alert.animate({height: $alert.css('line-height') || '50px'}, 200)
		    .click(function () {
			    window.clearTimeout(alerttimer);
			    $alert.animate({height: '0'}, 200);
		    });
	    }
    });
    function mostraAlert(qual){
	    var $alert = $('#'+qual);
	    
	    if($alert.length)
	    {
		    var alerttimer = window.setTimeout(function () {
			    $alert.trigger('click');
		    }, 20000);
		    $alert.animate({height: $alert.css('line-height') || '50px'}, 200)
		    .click(function () {
			    window.clearTimeout(alerttimer);
			    $alert.animate({height: '0'}, 200);
		    });
	    }
    }
    function carregaFotosBoteco(pagina,prg){
	var targetUrl = "fotosajax.php?p=" + pagina+"&prg="+prg;
	$("#listaFotos").load(targetUrl, function() {
	carregaFotosAjax();
	});
	return false;
    }        
    function carregaVideosBoteco(pagina,prg){
	var targetUrl = "videosajax.php?p=" + pagina+"&prg="+prg;
	$("#listaVideos").load(targetUrl);
	return false;
    }       
    function carregaCommentsBoteco(pagina,prg){
	var targetUrl = "commentsajaxboteco.php?p=" + pagina+"&prg="+prg;
	$("#listaCommentsBoteco").load(targetUrl);
	return false;
    }       
    function carregaComments(pagina,prg){
	var targetUrl = "commentsajax.php?p=" + pagina+"&prg="+prg;
	$("#listaComments").load(targetUrl);
	return false;
    }    
    function carregaMural(pagina,prg){
	var targetUrl = "muralajax.php?p=" + pagina+"&prg="+prg;
	$("#listaMural").load(targetUrl);
	return false;
    }
    function removerCommentsBoteco(idPostBotequeiro){
	var targetUrl = "commentsajaxboteco.php?r="+idPostBotequeiro;
	$("#listaCommentsBoteco").load(targetUrl);
	return false;
    }    
    function removerComments(idPostBotequeiro){
	var targetUrl = "commentsajax.php?r="+idPostBotequeiro;
	$("#listaComments").load(targetUrl);
	return false;
    }
     function removerFoto(idFoto){
	$("#frm_remove_"+idFoto).submit();
	return false;
    }
    function removerBotecoCoracao(idBar){
	var targetUrl = "listabotecoscoracao.php?r="+idBar;
	$("#listaCoracao").load(targetUrl);
	return false;
    }        
    function removerMural(idPostBotequeiro){
	var targetUrl = "muralajax.php?r="+idPostBotequeiro;
	$("#listaMural").load(targetUrl);
	return false;
    }        
    function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
	    field.value = field.value.substring(0, maxlimit);
        else countfield.value = maxlimit - field.value.length;
    }
    function trim(stringToTrim) {
	    return stringToTrim.replace(/^\s+|\s+$/g,"");
    }
    function save(url, data) {
      $.ajax({
	type: "POST",
	url: url,
	data: data,
	success: function(response) {
	    //alert(response);
	  if (trim(response) != '1') {
	    alert('Erro ao Salvar!');
	  }
	},
	error: function(response) {
	  alert(response.responseText);
	}
      });
      
    }
    function carregaFotosAjax(){
		    $.Lightbox.construct({
			show_linkback:	        false,
			show_helper_text:	false,
			show_info:	        true,
			show_extended_info:	true,
			download_link:	        false,
			ie6_upgrade:	        false,
			show_linkback:	        false,
			text: {
			    image: 'Foto',
			    of: 'de',
			    close: '<img src="http://www.comidadibuteco.com.br/images/close.gif" alt="fechar" />',
			    closeInfo: 'Fechar',
			    download: '',
			    'help.close': '',
			    'help.interact': '',
			    'about.text': '',
			    'about.title': '',
			    'about.link': ''
			}
		    });
    }
    function mostravideoVimeo(movie,w,h){
	if (w == null){
	   w = 400;
	}
	if (h == null){
	   h = 225;
	}
	$("#divVideo").html('<object width="'+w+'" height="'+h+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id="+movie+"&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id="+movie+"&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+w+'" height="'+h+'"></embed></object>');
	return false;
    }    
    function mostraservico(qual){
	var sinal = "+";
	$('#divServico'+qual).toggle();
	if($('#maismenos'+qual).html()=="+"){
	    sinal="-";
	}
	$('#maismenos'+qual).html(sinal);
    }
    
    function chamaVideo(video){
		dataString = "video="+video;
		$.ajax({
		      type: "POST",
		      url: "videoajax.php",
		      data: dataString,
		      cache: false,
		      success: function(html_main){
			  $("#divVideo").html(html_main);
		      }
		  });
		  return false;
    }
    
    
    