/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function () {
    
    $('.email_no_js').hide();//info that js has to be enabled for viewing email
    $('tr td:even').css('background', '#ffff99');

    if($('.en').length){
        //initially hide the English translation
        $('.en').hide();
        $('.blue').show();

        $('.ph .blue').click(function(){
            $('.ph').hide();
            $('.en').show();
            $('.blue').show();
        });
        $('.en .blue').click(function(){
            $('.en').hide();
            $('.ph').show();
            $('.blue').show();
        });
    }


    if($('.map').length){
        $('.map').betterTooltip();//jquery.betterTooltip.js

        //change the title attribute so that in prettyPhoto it is more descriptive
        var title = '<b>Location map of the Church'
                    +'<br/>About 5 minutes walk '
                    +'from Golders Green Tube Station'
                    +'<br/>[Northen Line - Edgware Branch]</b>';

        $('.map').each(function(){
            //$(this).css('cursor', 'pointer');
            $(this).click(function(){
                $(this).attr('title', title);
            });
        });
    }
    if($('.gallery_menu').length){
        $('.link').betterTooltip();
    }
    //jquery.prettyPhoto.js
    if($("a[rel^='prettyPhoto']").length)
    {
        $("a[rel^='prettyPhoto']").prettyPhoto({
            //callback when prettyPhoto window closed;
            callback: function(){

                //revert to original title attributes
                $('.map').each(function(){
                    var title = 'Click for Location Map view';
                    $(this).attr('title', title);
                    //remove the tooltip handler otherwise duplicated tool tip
                    $(this).unbind('mouseenter mouseleave');
                });
                $('.map').betterTooltip();//re-apply tooltip handler
            }
        });
    }

});
