$(document).ready(function(){
    //photocat title - shadow
    if ($('#photogal h1').html()) {
        $('#photogal h1').each(function(){
            $(this).prepend('<span class="shadow">'+$(this).text()+'</span>');
        });
    }

    //subphotocat title - shadow
    if ($('.categorylist ul li a span.title h3').html()) {
        $('.categorylist ul li a span.title h3').each(function(){
            $(this).prepend('<span class="shadow">'+$(this).text()+'</span>');
        });
    }
    //small images
    $('.itemlist ul li a[class!=selected]').hover(function(){
        $(this).find('span.themesmall').animate({opacity: '1'}, 700);
    }, function(){
        $(this).find('span.themesmall').animate({opacity: '.3'}, 700);
    });

    if ($('#mainphoto .themesmallimg img').width() > 800 ){
        $('#mainphoto').css('marginLeft', '-'+(Math.round(($('#mainphoto .themesmallimg img').width() - 800)/2))+'px');
    }

    //hot menu
//    $('#menu .hot1').animate({
//        color: '#FF0000'
//    }, 1000).animate({
//        color: '#FFFFFF'
//    }, 1000).animate({
//        color: '#FF0000'
//    }, 1000).animate({
//        color: '#FFFFFF'
//    }, 1000).animate({
//        color: '#FF8040'
//    }, 1000);

    
    
    //string with *
    $('span.strong').append('<span class=\"strongstar\">*</span>');

    //footer 2 bottom;
    function fe_footer2bottom(){
        if ($('body').height() < $(window).height()) {
            $('#footer').css({'position': 'absolute', 'bottom': '0px'});
        } else {
            $('#footer').css({'position': 'relative', 'bottom': ''});
        }
    }

    fe_footer2bottom();
    $(window).resize(function(){
        fe_footer2bottom();
    });

    //ee_error
//    $('.ee_error').animate({
//        color: '#FF8040'
//    }, 1000).animate({
//        color: '#FF0000'
//    }, 1000);

    //submit button
    $('#fe_send_message input#ee_submit').hover(function(){
        $(this).animate({
        backgroundColor: '#222222',
        color: '#FF8040'
        }, 600);
    }, function(){
        $(this).animate({
        backgroundColor: '#181818',
        color: '#FFFFFF'
        }, 200);
    });

    //comments
    $('#comments_count').html('<span class="openhide">'+$('#comments_count').text()+'</span>');
    $('#fe_comment_form_addblock').html('<span class="openhide">'+$('#fe_comment_form_addblock').text()+'</span>');
    $('#comments_list > dl').hide();
    if ($('#fe_errorflag').text() != '1') {
        $('#fe_comment_form').hide();
    }

    $('#comments_count').click(function(){
        $('#comments_list > dl').toggle('fast');
    });

    $('#fe_comment_form_addblock').click(function(){
        $('#fe_comment_form').toggle('fast');
    });

    $('#comments_list a').click(function(){
        var retr_id = $(this).attr('rel');
        $('#ee_comments_parent_id').val(retr_id);
        $('#comments_list > dl').hide();
        $('#fe_comment_form').show();
        return false;
    });

    function open_hise_gg () {
        if ($.cookie('gogglead') == 'hide') {
            $('#ggblock').show();
            $('#gogglead div span').text('[close]');
            $.cookie('gogglead', null);
        } else {
            $('#ggblock').hide();
            $('#gogglead div span').text('[open]');
            $.cookie('gogglead', 'hide');
        }
    }

    open_hise_gg ();
    $('#gogglead div span').click(function(){
        open_hise_gg ();
    });

});
