$(document).ready(function () {
    Cufon.replace('h1,.brandTitle', { fontFamily: 'Helvetica Neue LT Std 900' });
    Cufon.replace('h2,h3,.pollTitle', { fontFamily: 'Helvetica Neue LT Std 700' });
    $('li.hidden').hide();

    var slideDown = $('.tabBorderSlideOut');
    if (slideDown.length) slideDown.parent().parent().find('.tabBorder:eq(0)').hide();




    $('.moreButton').click(function (event) {
        event.preventDefault();
        $(this).parent().parent().find('li.hidden').slideDown('fast');
        $(this).hide();
    });

    $('.slideOutMoreButton').click(function (event) {
        event.preventDefault();
        $(this).parent().parent().find('.slideOutDetail').slideDown('fast');
        $(this).parent().parent().find('.tabBorderSlideOut').slideUp('fast');
        $(this).hide();
        var slideDown = $('.tabBorderSlideOut')
        if (slideDown.length) slideDown.parent().parent().find('.tabBorder:eq(0)').show();
    });

    /* watermark ASK FIELD*/

    $('#ask_field input').focus(function () {
        if ($(this).val() == 'e.g. Where is illegal tobacco made?') {
            $(this).val('');
            $(this).css('color', 'black');
        }
    }
                ).blur(function () {
                    //if ($.trim($(this).val()) == "") {
                    //    $(this).val('e.g. Where is illegal tobacco made?');
                    //    $(this).css('color', '#999');
                    //}
                }
                 ).bind("keypress", function (e) {
                     if (e.keyCode == 13)
                         $("#askButton").trigger("click");
                 });


    /* watermark GET SOME ANSWERS*/


    $('#contactContent textarea').focus(function () {
        if ($(this).val() == 'Where is illegal tobacco made?') {
            $(this).val('');
            $(this).css('color', 'black');
        }
    }
                ).blur(function () {
                    if ($.trim($(this).val()) == "") {
                        $(this).val('Where is illegal tobacco made?');
                        $(this).css('color', '#999');
                    }
                }
                 );

    $('#emailContact input').focus(function () {
        if ($(this).val() == 'Your email address') {
            $(this).val('');
            $(this).css('color', 'black');
        }
    }
                ).blur(function () {
                    if ($.trim($(this).val()) == "") {
                        $(this).val('Your email address');
                        $(this).css('color', '#999');
                    }
                }
                 );


    $("#askButton").bind("click", function () {
        $("form")[0].action = "/did-you-mean.aspx";
        $("form").submit();
    });

    $('#pollAnswer1').show();


    $("#playerControls").toggle(function () {
        playAd(this.title);
        $("#radioAd")[0].src = "/images/Radio-Ad-Button-Pause.gif";
    },
    function () {
        stopAd();
        $("#radioAd")[0].src = "/images/Radio-Ad-Button.gif";
    });

});

function playAd(file) {
    $("#player").append('<object width="0" height="0" id="radioAdvert"><param name="src" value="' + file + '" /><param name="autoplay" value="true" /><param name="controller" value="false" /><param name="bgcolor" value="#fff" /><embed src="' + file + '" autostart="true" loop="false" width="0" height="0" controller="false" bgcolor="#fff"></embed></object>');
}

function stopAd() {
    $("#player").empty();
}


 
