function imprimir(){width_=670;centro=(screen.width-width_)/2;popup_imprimir = window.open("imprimir.php","flyer","scrollbars=yes, resizable=yes, top=15px, left="+centro+", width="+width_+"px, height=600px");popup_imprimir.focus();return false;}
function gal_tools_twitpic(){$("#gal-tools").append('<li id="gal-twitpic"><a href="#" id="gal-twitpic-opts">Salvar foto no Twitpic e postar no Twitter</a> <form method="post" enctype="multipart/form-data" target="_blank" action="bm-galeria-twitpic.php"> <input type="hidden" id="arquivo_upar" name="arquivo_upar"> <label>&#117;&#115;&#117;á&#114;&#105;&#111;&#032;&#100;&#111;&#032;&#116;&#119;&#105;&#116;&#116;&#101;&#114;:</label><input type="text" id="t_u" name="t_u"> <label>&#115;&#101;&#110;&#104;&#097;&#032;&#100;&#111;&#032;&#116;&#119;&#105;&#116;&#116;&#101;&#114;:</label><input type="password" name="t_p" id="t_p"><label>Twitt/texto ( <span id="t_l">82</span> caracteres disponíveis ):</label><textarea maxlength="110" cols="35" rows="2" name="t_m" id="t_m">nossa foto no @bardamontanha</textarea> <p>obs: todos os dados são enviados diretamente para o Twitpic.</p><a id="twitpic_bt" class="enviar_bt" href="">Enviar!</a></form>');}
function denounce(comment_id,off_set){

    comment_txt_value = $('#'+comment_id+' .comment_txt').html();
    comment_id = comment_id.replace('c','');
    popup('<h1>Denunciar o comentário...</h1><bloquote>'+comment_txt_value+'</bloquote><p>Conte para nós qual o problema do comentário. Fale aê:</p><form action="denounce.php" method="post"><input type="hidden" name="n_comment" id="n_comment" value="'+comment_id+'"><textarea name=""></textarea><label>O seu nome: <input type="text" name="nome" id="nome"></label><label>O seu email: <input type="text" name="email" id="email"></label><button type="submit">enviar</button></form>',off_set);
    
}

$('#popup-bg,a#fecharpopup').live('click',function(){$('#popup,#popup-bg').css('display','none');});
$(window).resize(function(){ popup_centered(); });


function popup_centered(off_set){

largura = ($(window).width()-$('#popup').width())/2;
$('#popup').css('marginLeft',largura);


    if ( off_set !== undefined ) {
        
        $('#popup').css('marginTop',off_set.top-100);   
        
    }

}


function popup(conteudo,off_set){


    if( $('#popup').length == 0 ){
    
        $('body').prepend('<div id="popup-bg"></div><div id="popup"><a href="#" id="fecharpopup" onclick="return false;"> x </a><div id="popupcontent">'+conteudo+'</div></div>');
    }
    else
    {
        $('#popupcontent').html(conteudo);
        $('#popup,#popup-bg').css('display','block');
        
        
    }
    
    popup_centered(off_set);

    $('#popup-bg').height($(document).height());

}





function scroll_to_target ( target ){

    var offset = $( '#' + target ).offset();
    target_offset = offset.top + 'px';
    $.scrollTo( target_offset, { duration:1100 } );

}


function image_loader ( _target, _image ) {

    var img = new Image();

    $( img )
    .load( function () {

	$( this )
	.appendTo( _target )
	.hide()
	.delay(800)
	.fadeIn();

    })
    .error( function () { /* nao defini, não é necessário neste caso.  */  })
    .attr('src',  _image );

    img = null;

}


function change_picture ( picture_absolute_path ) {

    var img = new Image();

    $(img)
    .load(function () {

        $('#photop').delay(100).fadeOut('fast', function () {

            $('#photop').attr('src', picture_absolute_path ).fadeIn('fast');

        })

    })
    .error(function () { /* nao defini, nao eh necessario neste caso.    */ })
    .attr('src', picture_absolute_path );

    img = null;

}



function busca_galeria( keyword ){

    keyword = keyword.toLowerCase();
		
    if ( keyword != 'digite o nome da banda ou data' ){

	$('#content li').each( function() {
		
            txt = $(this).text();

            txt = txt.toLowerCase();


                if( txt.search( keyword ) != -1 ){

                    $(this).css('display','list-item');

                }
		else
		{

                    $(this).css('display','none');
                
                }



	    }); // content li

    }// end if

}

