﻿$(document).ready(function() {
    autoFill($("#global_search"), "Search our site");
    autoFill($("#bin_postcode"), "Enter your postcode");

    $('#AddrShow').css('cursor', 'pointer').siblings('address').hide();
    $('#AddrShow').click(function() {
        $(this).siblings('address').slideToggle();
        $(this).text($(this).text() == 'more info' ? 'less info' : 'more info');
    });

    var quotes = $('#content q');
    if (quotes.length > 0) {
        $('.panel.blue.tag-cloud').after($('<div class="panel green quotes-block"><div><h3>Quotes from the article</h3><div id="quotes"></div></div><div class="bottom"></div></div>'));
        $('q').each(function() {
            $('#quotes').append('<blockquote><p>' + $(this).text() + '</p><p class="author">- ' + $(this)[0].getAttribute('cite') + '</p></blockquote>');
        });

        $('#quotes blockquote').quovolver();
    }
});
function autoFill(id, v) {
    $(id).css({}).attr({ value: v }).focus(function() {
        if ($(this).val() == v) {
            $(this).val("").css({});
        }
    }).blur(function() {
        if ($(this).val() == "") {
            $(this).css({}).val(v);
        }
    });
}