var commentToggleRate = 'slow',
    actionCollapse = 'actCollapse',
    actionExpand = 'actExpand'
    iconCollapsed = 'collapsed',
    iconExpanded = 'expanded';

function showCommentReplyControl(e) {
    if(e[0]){
        e.stop(true,true).fadeIn(commentToggleRate);
    }
    return false;
}
function CancelCommentReplyControl(e) {
    if(e[0]){
        e.stop(true,true).fadeOut(commentToggleRate);
    }
    setLoginMode();

    if (emmisRecaptchaHelper) {
        emmisRecaptchaHelper.displayID = "";
    }
    return false;
}
function CancelLoginOverlay(mpeBehaviorID) {
    setLoginMode();
    $find(mpeBehaviorID).hide();
    return false;
}
function CommentingShowHide(divID, hideLink, hideText,showText,hideThisToo) {
    if (divID.is(':visible')) { // collapse it
        divID.slideUp(commentToggleRate, function() {
            if(hideLink) {
                if(hideText)
                    hideLink.text(showText);
                hideLink
                    .addClass(actionExpand).removeClass(actionCollapse)
                    .removeClass(iconExpanded).addClass(iconCollapsed);
            }
        });
    } else { // show it
        if(hideThisToo&&hideThisToo[0])
            hideThisToo.hide();
        divID.slideDown(commentToggleRate, function() {
            if(hideLink) {
                if(hideText)
                    hideLink.text(hideText);
                hideLink
                    .addClass(actionCollapse).removeClass(actionExpand)
                    .addClass(iconExpanded).removeClass(iconCollapsed);
            }
        });
    }
    return false;
}
function DisplayControlAfterObject(placeAfterThisID, replyDivID) {
    var placeAfter = jQuery(placeAfterThisID),
        placeThis = jQuery(replyDivID);
    
    if(placeAfter[0]&&placeThis[0]){
        placeAfter.after(placeThis);
        placeThis.stop(true,true).fadeIn(commentToggleRate);
    }

//    if (jQuery('div.replyForm userform anonymousReply').is(':visible')) {
//        jQuery('a.actCancel cclSubmit').show();
//    }
//    else {
//        jQuery('a.actCancel cclSubmit').hide();
//    }
    
    return false;
}
function ShowAnonymousReplyRecaptcha(containerID) {
    var recaptchaControl = containerID + "_ucAnonymousReply_ucAnonymousReplyRecaptcha_RecaptchaControl_captcha";
    //eval('ctl00_MainTop_GenericControl6_ucda87e5c02dcd4c7fad8f424c527b7526_ucComments_ucReply_ucAnonymousReply_ucAnonymousReplyRecaptcha_RecaptchaControl_captcha').show();
    recaptchaControl.show();
}
function ShowRecaptcha(recaptchaControl) {
    var recaptcha = recaptchaControl + "_RecaptchaControl_captcha";
    eval(recaptcha).show();
}

