$(document).ready(function() {
    $("#footer li:last-child,").addClass("lastChild");
    var ticker_holder = $('#latestNews');
    var ticker_text = $('ul#newsTicker');
    var ticker_data = [];
    Watermark("#txtSearch", "Search...");
    $("#search").submit(function() {
        var query = $("#txtSearch").val();
        if (window.location.host == "staging.pauleycreative.co.uk")
            window.location = "http://staging.pauleycreative.co.uk/millbrook.co.uk/Search/" + query.replace(/\./g, ' ');
        else
            window.location = "/Search/" + query.replace(/\./g, ' ');
        return false;
    });
    $('#latestNews li').each(function() { ticker_data.push($(this).html()); });
    $(ticker_text).parent().html('<marquee scrollamount="3" scrolldelay="0">' + ticker_data.join('&nbsp;|&nbsp;') + '</marquee>');
    $('#latestNews').hover(function() { $('marquee', this).get(0).stop(); }, function() { $('marquee', this).get(0).start(); });

    $('.anythingSlider .wrapper').jCarouselLite({
        btnNext: '.arrow.forward',
        btnPrev: '.arrow.back',
        visible: 5
    });
    
    //$('.anythingSlider').anythingSlider({ easing: "swing", autoPlay: false, startStopped: false, animationTime: 600, hashTags: false, buildNavigation: false, pauseOnHover: false });

    /* This is the biggest heap of crap... ever. */
    /*
    $(".sliderItem img").mouseover(function(){
    $(this).after('<div class="hoverText"><p>'+$(this).attr('longdesc')+'...</p></div>');
    });
    $('.hoverText').live("mouseout",function() {$('.hoverText').each(function(){$(this).remove();});});
    $('.hoverText').live("mouseover",function() {
    var item = this;
    $('.hoverText').each(function() {
    if (this != item)
    $(this).remove();
    });
    });
    */
});
function Watermark(selector,value){var watermark=value;if($(selector).val()==""){$(selector).val(watermark);}
$(selector).focus(function(){if(this.value==watermark){this.value="";}}).blur(function(){if(this.value==""){this.value=watermark;}});}
function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+
((expiredays==null)?"":";expires="+exdate.toGMTString());}
