//=====================================================//
var LoadReadyLocal = {

    homePageSlideShow: function(){
        $(function() {
            $('.anythingSlider').anythingSlider({
                 autoPlay: true
                ,easing: 'jswing'
                ,delay: 6000
                ,startStopped: false
                ,animationTime: 900
                ,hashTags: true
                ,buildNavigation: true
                ,pauseOnHover: true
                ,startText: 'etet'
                ,stopText: 'sdsd'
            });

            var mainHt = $('.homeTop').height();
            //$('.homeTop .c40r .subcr').css('height', mainHt -50 + 'px');
            $('#ourClients .float_left:nth-child(5n)').css('margin-right', '0');

        });
    }

};

LoadReady = $.extend(LoadReady, LoadReadyLocal);


$(function() {
    $('.showComments').livequery('click', function(e){
        e.preventDefault();
        Util.showProgressInd();
        var rec_id = $(this).attr('id');
        var url    = '/index.php?_room=comment&_spAction=list&record_id=' + rec_id + '&showHTML=0';
        var link   = $(this);

        $.get(url, function(data){
            var parent = $(link).closest('.commentHltBox');
            var commentsBox = $('.commentsList', parent);
            $(commentsBox).html(data);
            $(commentsBox).slideToggle();
            Util.hideProgressInd();
        });
    });
    
    $('.addComment').livequery('click', function(e){
        e.preventDefault();
        link = $(this);
       
        Util.showProgressInd();
        var parent = $(link).closest('.commentHltBox');
        var commentsBox = $('.commentsList', parent);
        if($(commentsBox).css('display') == 'none'){
            $('a.showComments', parent).click();
        }
        Comments.showCommentsForm.call(link);
    });

    //Add comment
    /*$('.addComment').livequery('click', function(e){
        e.preventDefault();
        link = $(this);

		Util.showProgressInd();
		Comments.showCommentsForm.call(link);
    });*/


    //section image hover
    $('.hlist ul li:not(.active)').hover(function () {
        var imgHover = $('img', $(this)).attr('imghov');
        activSrc = $('img', $(this)).attr('src');
        $('img', $(this)).attr('src', '/media/section/active/'+ imgHover)
        $(this).addClass('active');
    },function () {
        $('img', $(this)).attr('src', activSrc);
        $(this).removeClass('active');

    });


    // set the border right of last item to 0 //
    $('#list li:nth-child(even)').css({'background-color': '#eff3ef'});
    $('table.generic tr:nth-child(even)').css({'background-color': '#f3f3f3'});
    $('#keyword').focus(function(){
        var value = $(this).val();
        if ($(this).val() == 'keyword search'){
            $(this).val("");
        }
    });

    $('.portfolio .c50l:nth-child(2n)').after("<div style='clear:both'></div><br />");
    
    $(window).load(function(){ 
        $('.portfolio .nyroModal').addClass('centered');
        $('.centered').cp_center();
        var mainHt = $('#main').height();
        $('.hidecol1 #col3_content').css('height', mainHt + 'px');
    });

    Cufon.replace('h1') ('h2') ('h3') ('h4') ('h5') ('h6')
    
});


