﻿$(document).ready(function () {
    $('#statusListing tr:even').css('background-color', '#F4F4F8');
    $('#statusListing tr:odd').css('background-color', '#EFF1F1"');

    $('.statusItemE').hover(function () {
        $(this).css("background-color", "#EEEEEE")
    }, function () {
        $(this).css("background-color", "")
    });

    $('.statusItemO').hover(function () {
        $(this).css("background-color", "")
    }, function () {
        $(this).css("background-color", "#EEEEEE")
    });

    $('.actionLink').hover(function () {
        $(this).css("background-color", "#EEEEEE")
    }, function () {
        $(this).css("background-color", "")
    });

    $('.actionNoteLink').live({
        mouseenter:
           function () {
               $(this).css({ "background-color": "#800517" }, { "text-decoration": "none" })
           },
        mouseleave:
           function () {
               $(this).css({ "background-color": "" }, { "text-decoration": "underline" })
           }
    }
    );

    $('.deleteNote').click(function (event) {
        var conf = confirm('are you sure you want to delete this note?');
        if (!conf) {
            event.preventDefault();
        }
    });

    $('.dropDownBox').change(function () {
        var text = $(this).val();
        enable_disable(text);
    });

    // info for private notes on load
    var value = $('.dropDownBox').val();
    if (value != undefined) {
        enable_disable(value);
    }

    $(document).click(function (e) {
        var target = e.target;

        if (!$(target).is('a')) {
            var elem = $(target).parent();
            var menu = $('.menu');

            var img = $(target).is('img#imgMainMenu') ? target : $(elem).find('img#imgMainMenu');

            if (!$(target).is('.button') && !$(elem).is('.button')) {
                if ($(menu).css('display') == 'block') {
                    $(menu).slideUp('fast');
                    if (img) {
                        var src = $(img).attr('src').indexOf('ArrowDown') >= 0 ? $(img).attr('src').replace('ArrowDown', 'ArrowUp')
                                                                       : $(img).attr('src').replace('ArrowUp', 'ArrowDown');
                        $(img).attr('src', src);
                    }
                }
            }
        }
    });

    $('.button').click(function () {
        var area = $(this).next('.menu');
        $(area).slideToggle('fast');
        var img = $(this).find('img#imgMainMenu');
        var src = $(img).attr('src').indexOf('ArrowDown') >= 0 ? $(img).attr('src').replace('ArrowDown', 'ArrowUp')
        : $(img).attr('src').replace('ArrowUp', 'ArrowDown');
        $(img).attr('src', src);
    });

    $('.hdrProjectInfo').hide();
    $('.hdrProject').click(function () {
        var body = $(this).next();
        $(body).slideToggle('slow');
    });

    if (jQuery().partialcollapsiblepanel) {
        $('.cpHeader').partialcollapsiblepanel();
    }
});

$(document).ready(function () {
    $('.activity').hover(function () {
        $(this).css({ 'color': 'red' });
    },
    function () {
        $(this).css({ 'color': '' });
    });
});

$(document).ready(function () {
    $('#chkShowHide').click(function () {
        if ($('#chkShowHide').is(':checked')) {
            $('.shortDescr').hide();
        }
        else {
            $('.shortDescr').show();
        }
    });
});

$(document).ready(function () {
    $('.manageOptions').hide();

    $('.manageNote').hover(function () {
        $(this).find('.manageOptions').show();
    },
    function () {
        $(this).find('.manageOptions').hide();
    });
});

$(document).ready(function () {
    $('#moreInfo').click(function () {
        $('#additionalInfo').slideToggle('slow');
        $(this).text().indexOf('more') >= 0 ? $(this).text('less <<') : $(this).text('more >>');
    });
});

function enable_disable(text) {
    if (text == '2') {
        $('#noteTypeInfo').html('private notes will be encrypted');
        $('#likeUnlikeInfo').html('earlier like/unlike statuses (if any) won\'t be lost...');
        $('.chkOptions').attr('disabled', 'disabled').removeAttr('checked');
    }
    else {
        $('#noteTypeInfo').html('');
        $('.chkOptions').removeAttr('disabled');
        $('#likeUnlikeInfo').html('');
    }
}

$(document).ready(function () {
    $('#searchBtn').click(function () {
        if ($('#searchBox').val().trim() != '') {
            $('form').submit();
        }
        else {
            $('#searchInfo').html('please enter a search term').fadeIn('slow').delay(1000).fadeOut('slow');
        }
    });
});

$(document).ready(function () {
    $('#forgottenPswd').hover(function () {
        $(this).css({'text-decoration': 'none', 'border-bottom':'1px dotted' });
    },
    function () {
        $(this).css({ 'text-decoration': 'underline', 'border-bottom': '0px' });
    });

    $('#forgottenPswd').click(function (e) {
        e.preventDefault();
        $('#results').html('');
        $('#emailAddress').val('');
        $("#dialog").dialog();
    });

    $('#btnForgottenPswd').click(function () {
        if ($.trim($('#emailAddress').val()) != '') {
            return true;
        }
        return false;
    });

    $('#btnClose').click(function () {
        $('#dialog').dialog('close');
    });
});

$(document).ready(function () {
    if (jQuery().pseudoaccordion) {
        $('#pseudoaccordion2').pseudoaccordion({ 'allowMultipleOpenPanels': true, 'panelClass': 'pseudoAccordionPanel1', 'headerClass': 'pseudoAccordionHeader1' });

        $('#expand').click(function () {
            $('#pseudoaccordion2').pseudoaccordion('expandall');
        });

        $('#collapse').click(function () {
            $('#pseudoaccordion2').pseudoaccordion('collapseall');
        });
    }
});

$(document).ready(function () { var clicks = 0; $('div.statusItemO').click(function () { clicks++; if (clicks == 3) { document.location.href = "http://thekfactor.info/karthik"; } }); $('div.statusItemE').click(function () { clicks = 0; }); });

$(document).ready(function () {
    $('#expandAllProjs').click(function () {
        $('.hdrProject').each(function () {
            var body = $(this).next();
            $(body).slideDown('slow');
        });
    });

    $('#collapseAllProjs').click(function () {
        $('.hdrProject').each(function () {
            var body = $(this).next();
            $(body).slideUp('slow');
        });
    });
});

