
/* password boxes */
function swapBoxes() {
    jQuery(".texthide").hide();
    jQuery(".textshow").show().focus();
};

function swapBackBoxes() {
    var val = jQuery(".textshow").val();

    if (val == '') {
        jQuery(".texthide").val('Password *');
        jQuery(".textshow").hide();
        jQuery(".texthide").show();
    }
};

function swapBoxes1() {
    jQuery(".texthide1").hide();
    jQuery(".textshow1").show().focus();
};

function swapBackBoxes1() {
    var val = jQuery(".textshow1").val();

    if (val == '') {
        jQuery(".texthide1").val('Confirm Password *');
        jQuery(".textshow1").hide();
        jQuery(".texthide1").show();
    }
};

/*overstate*/
$(document).ready(function () {
    $(".menuoverstate").each(function (i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".jpg", "_o.jpg");

        $(this).hover(
            function () {
                if (this.src.indexOf("_o.jpg") == -1) {
                    this.src = this.src.replace(".jpg", "_o.jpg");
                }

            },

            function () {
                this.src = this.src.replace("_o.jpg", ".jpg");

            });

    }
        );

    /*calendar*/


    $(".side-calendar").hide();

    $(".calendar a").toggle(function () {
        $(".calendar-btn").addClass("active");
    }, function () {
        $(".calendar-btn").removeClass("active");
    });

    $(".calendar a").click(function () {
        $(".side-calendar").slideToggle("fast");
    });





    /*drop down box*/

    $(".drop-down-box").hide();
    $(".drop-down-box").css({ opacity: 0.9 });

    $(".side-btn a").click(function () {
        $(this).next(".drop-down-box").slideToggle("fast");
    });

    $(".shop-links a").click(function () {
        $(this).next(".drop-down-box").slideToggle("fast");
    });


    /*hidden content*/

    $(".view-more").click(function () {
        $(this).parent().next().next(".hidden-content").slideToggle("slow");
        $(this).children(".viewhide").text($(this).children(".viewhide").text() == 'Hide' ? 'View' : 'Hide');
    });

    /*hidden content artist*/

    $(".view-more-artist").click(function () {
        $(this).parent().parent().parent().next(".hidden-content").slideToggle("slow");
        $(".view-more-artist-text").text($(".view-more-artist-text").text() == 'Click to hide additional information about:' ? 'Click for more information about:' : 'Click to hide additional information about:');
    });


    /*overstate full-box*/

    $(".full-box-over").css({ opacity: 0.0 });

    $(".full-box").hover(
        function () {
            $(this).children(".full-box-over").stop().animate({ opacity: 0.8 }, 200);
        },
        function () {
            $(this).children(".full-box-over").stop().animate({ opacity: 0.0 }, 200);
        });


    /*overstate left-box*/

    $(".left-box-over").css({ opacity: 0.0 });

    $(".left-box").hover(
        function () {
            $(this).children(".left-box-over").stop().animate({ opacity: 0.8 }, 200);
        },
        function () {
            $(this).children(".left-box-over").stop().animate({ opacity: 0.0 }, 200);
        });


    /*overstate wide-box*/

    $(".full-box-over").css({ opacity: 0.0 });

    $(".full-box").hover(
        function () {
            $(this).children(".left-box-over").stop().animate({ opacity: 0.8 }, 200);
        },
        function () {
            $(this).children(".left-box-over").stop().animate({ opacity: 0.0 }, 200);
        });

    /*overstate left-wide-box*/

    $(".left-wide-box-over").css({ opacity: 0.0 });

    $(".left-wide-box").hover(
        function () {
            $(this).children(".left-wide-box-over").stop().animate({ opacity: 0.8 }, 200);
        },
        function () {
            $(this).children(".left-wide-box-over").stop().animate({ opacity: 0.0 }, 200);
        });


    /*overstate right-box*/

    $(".right-box-over").css({ opacity: 0.0 });

    $(".right-box").hover(
        function () {
            $(this).children(".right-box-over").stop().animate({ opacity: 0.8 }, 200);
        },
        function () {
            $(this).children(".right-box-over").stop().animate({ opacity: 0.0 }, 200);
        });

    /*overstate home-box*/

    $(".home-box-over").css({ opacity: 0.0 });

    $(".home-box").hover(
        function () {
            $(this).children(".home-box-over").stop().animate({ opacity: 0.8 }, 200);
        },
        function () {
            $(this).children(".home-box-over").stop().animate({ opacity: 0.0 }, 200);
        });

    /*slideshow*/

    $('.slideshow').cycle({
        fx: 'scrollHorz',
        timeout: 6000,
        next: '#next',
        prev: '#prev'
    });

    $("#slideshow-nav a").click(function () {

        $(".slideshow").cycle('pause');
    });


    /*slideshow text*/
    $(".slideshow-text").hide();
    $(".slideshow-text").css("opacity", "0.8");
    $(".slideshow-wrapper").hover(function () {
        $("#slideshow-nav").stop(true, true).fadeIn('1000');
        $(".slideshow-text").slideToggle('1000');

    },
        function () {

            $(".slideshow-text").slideToggle('1000')
            $("#slideshow-nav").fadeOut('1000').stop(false, true);
        });



    /*hidden comments*/

    $(".view-comments").click(function () {
        $("#hidden-comments").stop(false, true);
        $("#hidden-comments").slideToggle("slow");
        $(".comments-switch").text($(".comments-switch").text() == 'Hide' ? 'See' : 'Hide');

    });

    /** check box ***/

    $('a.chkTrees').click(function () {
        if ($(this).html() == 'X') {
            $(this).html('');
        }
        else {
            $('a.chkTrees').html('');
            $(this).html('X');
        }

        return false;
    });

    $('a.giftAid').click(function () {
        if ($(this).html() == 'X') {
            $(this).html('');
            $('.noGiftAid').html('X');
        }
        else {
            $(this).html('X');
            $('.noGiftAid').html('');
        }

        return false;
    });

    $('a.noGiftAid').click(function () {
        if ($(this).html() == 'X') {
            $(this).html('');
            $('.giftAid').html('X');
        }
        else {
            $(this).html('X');
            $('.giftAid').html('');
        }

        return false;
    });

    /**** basket ddl donations ****/

    $('.donation-amount > a').click(function () {
        $('.amounts').toggle();

        // return true;
    });

    $('.donation-ddl-val').click(function () {
        $('.donation-amount').html($(this).html());
        $('.amounts').hide();
        // return false;
    });

    $('.donation-campaign').click(function () {
        $('.campaigns').toggle();
        //return false;
    });

    $('.campaign-ddl-val').click(function () {
        $('.donation-campaign > a').html($(this).html());
        $('.campaigns').hide();
        //return false;
    });

    $(document).bind('click', function (e) {
        var $clicked = $(e.target);
        if (!$clicked.parents().hasClass("donation-amount") || $clicked.hasClass("donation-amount"))
        { $(".amounts").hide(); }

        if (!$clicked.parents().hasClass("donation-campaign") || $clicked.hasClass("donation-campaign"))
        { $(".campaigns").hide(); }
    });

});



