$(function(){
    $(".delme").focus(function(){
        if ($(this).is('input')) {
            var orival = $(this).val();
            $(this).val("");
        }else{
            var orival = $(this).html();
            $(this).html("");
        }
        $(this).blur(function(){
            if($(this).is('input')){
                if ($(this).val() != "" && $(this).val() != orival) {
                    $(this).removeClass('delme').unbind('blur').unbind('focus');
                }else{
                    $(this).val(orival);
                }
            }else{
                if ($(this).html() != "" && $(this).html() != orival) {
                    $(this).removeClass('delme').unbind('blur').unbind('focus');
                }else if ($.browser.safari && $(this).val() != "" && $(this).val() != orival) {
                    $(this).removeClass('delme').unbind('blur').unbind('focus');
                }else{
                    $(this).html(orival);
                }
            }

        });
    });
    $("#menu-mainmenu li:first a").addClass("first");
    $("#menu-footermenu li:last").addClass("last");
    $(function(){
        // AUTOMATED SCROLLING
        $('a[href*=#]').click(function() {
            if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
                && location.hostname == this.hostname) {
                var $target = $(this.hash);
                $target = $target.length && $target
                || $('[name=' + this.hash.slice(1) +']');
                if ($target.length) {
                    var targetOffset = $target.offset().top;
                    $('html,body')
                    .animate({
                        scrollTop: targetOffset
                    }, 900);
                    return false;
                }
            }
        });
    });
});
