var eg = "00000000-0000-0000-0000-000000000000";
var timer;
var cst = "CONDITIONS SYMPTOMS TREATMENTS";
var hotcontenteditTimer;

$.ajaxSetup({
    type: 'POST',
    contentType: "application/json;",
    dataType: "json"
});

function ShowLogin() {
    $.fancybox.showActivity();
    $.ajax({ async: false, url: "/services/profileservice.asmx/GetLoginBox", data: '{ }' })
        .success(function (data) {
            $.fancybox.hideActivity();
            $.fancybox(data.d.MessageBody);
            $("#Email").focus();
        });
}
function ValidateLoginPop() {
    var userName = $('#Email').val();
    var password = $('#Password').val();
    var message = '';

    if (userName == '' && password == '') {
        message = AddLineBreak(message);
        message += "Please enter your email and password";
    }
    else if (userName == '') {
        message = AddLineBreak(message);
        message += "Please enter your email";
    }
    else if (password == '') {
        message = AddLineBreak(message);
        message += "Please enter your password";
    }
    if (message != '') {
        humanMsg.displayMsg(message);
        return false;
    }

    $.ajax({ async: false, url: "/services/profileservice.asmx/Login", data: '{ un: "' + userName + '", pwd: "' + password + '"}' })
    .success(function (result) {
        if (result.d != "") {

            $.fancybox.showActivity();

            $("#loggedin").val("1");

            $.ajax({
                url: "/services/profileservice.asmx/GetLogin",
                data: '{ loggedIn: 1, fbid: "' + window.fbid + '", accessToken: "' + window.accessToken + '" }'
            })
        	.success(function (data) {

        	    $("#login").html(data.d);

        	    if (data.d.indexOf("Logout") > 0) {
        	        $("#loggedin").val("1");
        	    }
        	    else {
        	        $("#loggedin").val("0");
        	    }

        	    $.fancybox.hideActivity();
        	    $.fancybox.close();

        	    top.location.href = top.location.href;
        	});
        }
    });

    return true;
}

function InitLogin(fbid, accessToken) {

    var isLoggedIn = $("#loggedin").val();

    $.ajax({
        url: "/services/profileservice.asmx/GetLogin",
        data: '{ loggedIn: ' + isLoggedIn + ', fbid: "' + fbid + '", accessToken: "' + accessToken + '" }'
    })
				.success(function (data) {
				    $("#login").html(data.d);

				    if (data.d.indexOf("Logout") > 0) {
				        $("#loggedin").val("1");
				    }
				    else {
				        $("#loggedin").val("0");
				    }
				});
};

function LoginToFacebook() {
    window.FB.login(function (response) {
        if (response.session) {
            if (response.scope) {
                // user is logged in and granted some permissions.
                // perms is a comma separated list of granted permissions
            } else {
                // user is logged in, but did not grant any permissions
            }
        } else {
            // user is not logged in
        }
    }, { scope: 'read_stream,publish_stream,offline_access' });
};

function ShowMore(o, oo) {
    // show the rest
    var bl = $("#" + o);
    bl.toggle('fast', function () {
        // Animation complete
        // change the link
        var o2 = $("#" + oo);

        if (bl.css("display") == "none") {
            o2.html(window.showMore);
        }
        else {
            o2.html(window.showLess);
        }

    });
};

function scp(o) {
    o.style.cursor = 'pointer';
}

function ResetLookup() {
    $("div#suggestions").hide();
    $("div#topsuggestions").hide();
}

function AddGhost(id) {
    var st = $("input#" + id);    
    if (st.val() == "") {
        st.val(cst);
        st.css("color","gray");
    }    
}

function ClearGhost(o)
{
    var obj = $("input#" + o.id);
    var txt = obj.val();

    if (txt == cst || txt == "") {
        obj.val(" ");
        obj.css("color","#000");        
        obj.select();
    }
    else {
        obj.select();
    }
}

function AddLineBreak(message) {
    if (message != "")
        message += "<br \>";
    return message;
}

function OpenLogin() {
    $("#poplogin").click();
}

function OpenSurvey() {
    top.location.href = "/survey/";
}



function ValidateLogin() {
  
    var userName = $('#ctl00_Login_EmailAddress').val();
    var password = $('#ctl00_Login_Password').val();
    var message = '';

    if (userName == '' && password == '') {
        message = AddLineBreak(message);
        message += "Please enter your email and password";
    }
    else if (userName == '') {
        message = AddLineBreak(message);
        message += "Please enter your email";
    }
    else if (password == '') {
        message = AddLineBreak(message);
        message += "Please enter your password";
    }
    if (message != '') {
        jAlert(message, "Healthetreatment Login");
        return false;
    }
    return true;
}


function ShowTreatSuggestions(o) {
    var searchText = o.value;
    if (searchText.length > 1) {

        $.ajax({
            url: "/services/search.asmx/GetConfSuggestions",
            data: '{ category: "Treatment", searchText: "' + searchText + '", functionName : "SugTreat" }'
        })
        .success(function (data) {
            var ss = $("#treatsuggestions");
            if (data.d != "") {
                ss.html(data.d);
                ss.css("display", "block");
            }
            else {
                ss.html("");
                ss.css("display", "none");
            }
        });
    }
    else {
        $("#treathid").val("");
    }
}

function SugTreat(guid) {
    $("#treathid").val(guid);

    $.ajax({ url: "/services/search.asmx/GetName", data: '{ category: "treat", guid : "' + guid + '"}' })
    .success(function (result) {
        if (result.d != "") {
            $("#NewTreatment").val(result.d);
        }
    });
    $("#treatsuggestions").hide();

    AddNewTreatment();
}

function ShowSympSuggestions(o) {
    var searchText = o.value;
    if (searchText.length > 1) {

        $.ajax({
            url: "/services/search.asmx/GetConfSuggestions",
            data: '{ category: "Symptom", searchText: "' + searchText + '", functionName : "SugSymp" }'
        })
        .success(function (data) {
            var ss = $("#sympsuggestions");
            if (data.d != "") {
                ss.html(data.d);
                ss.css("display", "block");
            }
            else {
                ss.html("");
                ss.css("display", "none");
            }
        });
    }
    else {
        $("#symphid").val("");
    }
}

function SugSymp(guid) {
    $("#symphid").val(guid);

    $.ajax({ url: "/services/search.asmx/GetName", data: '{ category: "symp", guid : "' + guid + '"}' })
    .success(function (result) {
        if (result.d != "") {
            $("#NewSymptom").val(result.d);
        }
    });
    $("#sympsuggestions").hide();

    AddNewSymptom();
}


function AddNewTreatment() {
    $('#treatsuggestions').html("");
    $('#treatsuggestions').hide();
    var id = $("#treathid").val();
    var text = $("#NewTreatment").val();

    if (text == "" || text == "Add a new treatment") {
        jAlert("Please enter a treatment", "Healthetreatment");
        return;
    }

    $.ajax({ url: "/services/profileservice.asmx/AddNew", data: '{ category: "Treatment", id: "' + id + '", text: "' + text + '"}' })
    .success(function (result) {
        if (result.d != "") {
            $("#NewTreatment").val("");
            $("#treathid").val("");
            $("#Treatments").append(result.d);
        }
    });
}


function AddNewSymptom() {
    $('#sympsuggestions').html("");
    $('#sympsuggestions').hide();
    var id = $("#symphid").val();
    var text = $("#NewSymptom").val();

    if (text == "" || text == "Add a new symptom") {
        jAlert("Please enter a symptom", "Healthetreatment");
        return;
    }

    $.ajax({ url: "/services/profileservice.asmx/AddNew", data: '{ category: "Symptom", id: "' + id + '", text: "' + text + '"}' })
    .success(function (result) {
        if (result.d != "") {
            $("#NewSymptom").val("");
            $("#symphid").val("");
            $("#Symptoms").append(result.d);
        }
    });
}

function ShowLargeMap() {
    $("div#largemap").show();
}

/* Hot Edit section */

var hidhotedit = "#hidhotedit";
var hoteditTimer;
function lr(guid, key) {
    if (key == "Content") {
        $.ajax({ url: "/services/contentdata.asmx/ShowContentItem", data: '{ guid : "' + guid + '", key: "' + key + '" }' })
        .success(function (result) {
            if (result.d != "") {
                $(hidhotedit).html(result.d);
                $(hidhotedit).show();
            }
        });
    }
    else {
        $.ajax({ url: "/services/contentdata.asmx/ShowResourceItem", data: '{ guid : "' + guid + '", key: "' + key + '" }' })
        .success(function (result) {
            if (result.d != "") {
                $(hidhotedit).html(result.d);
                $(hidhotedit).show();
            }
        });
    }
}

function CloseResourceItem() {
    $(hidhotedit).hide();
}

function SaveResource(guid) {
    var rk = $("#rk-" + guid).val();
    var tb = $("#t-" + guid).val();
    var s = $("#s-" + guid).val();

    $.ajax({ url: "/services/contentdata.asmx/SaveResource", data: '{ resKey : "' + rk + '", culture: "' + s + '", resString: "' + tb + '" }' })
    .success(function (result) {
        if (result.d != "") {

            jConfirm(result.d, 'Healthetreatment Resources', function (r) {
                CloseResourceItem();
                if (r) {
                    document.location.href = document.location.href;
                }
            });

        }
    });
}

function SaveContent(guid) {
    var rk = $("#rk-" + guid).val();
    var tb = $("#t-" + guid).val();
    var s = $("#s-" + guid).val();

    $.ajax({ url: "/services/contentdata.asmx/SaveContent", data: '{ resKey : "' + rk + '", culture: "' + s + '", resString: "' + tb + '" }' })
    .success(function (result) {
        if (result.d != "") {

            jConfirm(result.d, 'Healthetreatment Content', function (r) {
                CloseResourceItem();
                if (r) {
                    document.location.href = document.location.href;
                }
            });

        }
    });
}

function cr() {
    clearTimeout(hoteditTimer);
}

/* Hot Edit section - end */

/* Dynamic section */

function UpdateSymptom(obj) {
    $.ajax({ url: "/services/profileservice.asmx/UpdateLineItem", data: '{ itemType: "s", guid: "' + obj.id + '", val: "' + obj.checked + '"}' });
    if (obj.checked == false) {
        RatingReset(obj.id);
    }
    else {
        romc(obj.id, 0);
    }
}

function UpdateTreatment(obj) {
    $.ajax({ url: "/services/profileservice.asmx/UpdateLineItem", data: '{ itemType: "t", guid: "' + obj.id + '", val: "' + obj.checked + '"}' });
    if (obj.checked == false) {
        StarRatingReset(obj.id);
    }
    else {
        omc(obj.id, 0);
    }
}

function UpdateNoTreat() {
    var ckd = $("#ChkNotYetDecided").attr("checked");
    $.ajax({ url: "/services/profileservice.asmx/UpdateLineItem", data: '{ itemType: "notreat", guid: "", val: "' + ckd + '"}' });
}

function UpdateNoSymp() {
    var ckd = $("#ChkNoSymptoms").attr("checked");
    $.ajax({ url: "/services/profileservice.asmx/UpdateLineItem", data: '{ itemType: "nosymp", guid: "", val: "' + ckd + '"}' });
}

function UpdateSeverity(guid, val) {
    $.ajax({ url: "/services/profileservice.asmx/UpdateLineItem", data: '{ itemType: "sev", guid: "' + guid + '", val: "' + val + '"}' });
}

function UpdateRating(guid, val) {
    $.ajax({ url: "/services/profileservice.asmx/UpdateLineItem", data: '{ itemType: "rat", guid: "' + guid + '", val: "' + val + '"}' });
}

function scb(id, typ) {
    var tb = $("#" + id + "-ta").val();   // get the text from the textarea
    var cId = $("#WhatIsYourConditionGuid").val();    // get the condId

    if (tb == '') return false; // nothing 

    $.ajax({
        url: "/services/ProfileService.asmx/SendComment",
        data: '{ type: "' + typ + '", cId: "' + cId + '", id: "' + id + '",commentBody: "' + tb + '" }'
    });

    var cb = $("#" + id + "-cb");
    cb.html("<span>Saved: </span>" + tb);
    cb.removeClass("cbcomment");
    cb.addClass("savedcomment");
    return false;
}

function ijs(o, rating, typ) {
    var obj = $("#" + o)[0];

    var existingObj = $("#" + o + "-cbout");
    if (existingObj.length > 0) {
        // comment box already exists
        return;
    }

    // get the condId 
    var condId = $("#WhatIsYourConditionGuid").val();
    $.ajax({ url: "/services/profileservice.asmx/GetRating", data: '{ ratingtype: "' + typ + '", condId : "' + condId + '", id: "' + obj.id + '", userRating: "' + rating + '"}' })
    .success(function (result) {
        if (result.d.Success) {
            $("#" + o + "-sym").append(result.d.MessageBody);
            $("#" + o + "-cb").slideDown(500);
        }
    });
}

function CloseComment(obj) {
    $("#" + obj + "out").remove();
}

function ebd(id) {
    $("#" + id).show();
}

function so(id) {
    $("#" + id).hide();
}

function BlankAllTreatments() {
    var objCheckBoxes = $("#Treatments input");
    for (var i = 0; i < objCheckBoxes.length; i++) {
        if (objCheckBoxes[i].id != 'ChkNotYetDecided') {
            if (objCheckBoxes[i].checked == true) {
                objCheckBoxes[i].checked = false;
                omo(objCheckBoxes[i].id, 0);
                var comment = $("#" + objCheckBoxes[i].id + "-sr");
                if (comment) {
                    comment.html("");
                    comment.hide();
                }
            } 
        }
    }

    var treats = $("#Treatments");
    if (treats.css("display") == "none") {
        treats.slideDown(500);
        $("#addnewtb").show();
    }
    else {
        $("#addnewtb").hide();
        treats.hide();
    }
}

function BlankAllSymptoms() {
    var objCheckBoxes = $("#Symptoms input");
    for (var i = 0; i < objCheckBoxes.length; i++) {
        if (objCheckBoxes[i].id != 'ChkNoSymptoms') {
            if (objCheckBoxes[i].checked == true) {
                objCheckBoxes[i].checked = false;
                romo(objCheckBoxes[i].id, 0);
                var comment = $("#" + objCheckBoxes[i].id + "-sr");
                if (comment) {
                    comment.html("");
                    comment.hide();
                }
            } 
        }
    }

    var symps = $("#Symptoms");
    if (symps.css("display") == "none") {
        symps.slideDown(500);
        $("#addnewsb").show();
    }
    else {
        $("#addnewsb").hide();
        symps.hide();
    }
    
}

/* Dynamic section - end */
function SendEmail()
{
    var email = $("#EmailAddress").val();

    if (email != "e-mail address") {
        $.ajax({
            url: "/services/EmailService.asmx/RecordEmail",
            data: '{ email: "' + email + '" }'
        });
    }
}

function CheckSymptoms() {

    var cn = $("#ChkNoSymptoms").attr("checked");

    if (cn) {
        return 1;
    }

    var objCheckBoxes = $("#Symptoms input");
    var chkCount = 0;

    for (var i = 0; i < objCheckBoxes.length; i++) {
        if (objCheckBoxes[i].id != 'ChkNoSymptoms') {
            if (objCheckBoxes[i].checked == true) {
                chkCount++;
            }
        }
    }
    
    objCheckBoxes = $("#restofsymptoms input");
    for (var i2 = 0; i2 < objCheckBoxes.length; i2++) {
        if (objCheckBoxes[i2].id != 'ChkNoSymptoms') {
            if (objCheckBoxes[i2].checked == true) {
                chkCount++;
            }
        }
    }

    return chkCount;
}

function CheckTreatments() {

    var cn = $("#ChkNotYetDecided").attr("checked");
    if (cn) {
        return 1;
    }

    var objCheckBoxes = $("#Treatments input");
    var chkCount = 0;

    for (var i = 0; i < objCheckBoxes.length; i++) {
        if (objCheckBoxes[i].id != 'ChkNotYetDecided') {
            if (objCheckBoxes[i].checked == true) {
                chkCount++;
            }
        }
    }
    
    objCheckBoxes = $("#restoftreatments input");
    for (var i2 = 0; i2 < objCheckBoxes.length; i2++) {
        if (objCheckBoxes[i2].id != 'ChkNotYetDecided') {
            if (objCheckBoxes[i2].checked == true) {
                chkCount++;
            }
        }
    }

    return chkCount;
}

function ButtonOn(o) {
    o.style.backgroundColor = "#1950A2";
    o.style.cursor = "pointer";
}

function ButtonOff(o) {
    o.style.backgroundColor = "#6EAB24";
    o.style.cursor = "normal";
}

function ButtonOnBlue(o) {
    o.style.backgroundColor = "#6EAB24";
    o.style.cursor = "pointer";
}

function ButtonOffBlue(o) {
    o.style.backgroundColor = "#1950A2";
    o.style.cursor = "normal";
}

function SetDefaultButton(event, mode) {
    if (event.keyCode == 13) {
        if (mode == 'search') {
            __doPostBack('LearnBtn', 'OnClick');
        }
        else if (mode == 'profile') {
            __doPostBack('btnGo', 'OnClick');
        }
    }
}

function Logout() {
    if (window.FB != undefined) {
        if (window.FB._userStatus != "unknown") {
            window.FB.logout(function (response) {
                top.location.href = "/account/logout.aspx";
            });
        }
        else {
            top.location.href = "/account/logout.aspx";
        }        
    }
    else {
        top.location.href = "/account/logout.aspx";
    }
}

function GetSuggestions(sugtype) {
    var c = $("#ctl00_WhatIsYourCondition");
    if (c.length == 0) {
        c = $("#ctl00_MainContent_WhatIsYourCondition");
    }

    var cond = c.val();
    if (cond.length < 2) {
        $("#suggestions").css.display = "none";
        return;
    }

    $.ajax({
        url: "/services/search.asmx/GetAllSuggestions",
        data: '{ searchText: "' + cond + '", conditionsOnly : ' + sugtype + ' }'
    })
    .success(function (data) {
        if (data.d != "") {
            $("#suggestions").html(data.d);
            $("#suggestions").css("display", "block");
        }
        else {
            $("#suggestions").html("");
            $("#suggestions").css("display", "none");
        }
    });
}

function ShowSuggestions() {

    var c = $("#ctl00_WhatIsYourCondition");
    if (c.length == 0) {
        c = $("#ctl00_MainContent_WhatIsYourCondition");    
    }

    var cond = c.val();
    if (cond.length < 2) {
        $("#suggestions").css.display = "none";
        return;
    }

    $.ajax({
        url: "/services/search.asmx/GetAllSuggestions",
        data: '{ searchText: "' + cond + '", conditionsOnly : 0 }'
    })
    .success(function (data) { 
        if (data.d != "") {
            $("#suggestions").html(data.d).show();
        }
        else {
            $("#suggestions").html("").hide();
        }
    });
}

function SugThis(guid) {

    var c = $("#ctl00_WhatIsYourConditionGuid");
    if (c.length == 0) {
        c = $("#ctl00_MainContent_WhatIsYourConditionGuid");
    }

    c.val(guid);
    $("#suggestions").css("display","none");

    $.ajax({ url: "/services/search.asmx/GetName", data: '{ category: "cond", guid : "' + guid + '"}' })
    .success(function (result) {
        if (result.d != "") {
            var c1 = $("#ctl00_WhatIsYourCondition");
            if (c1.length == 0) {
                c1 = $("#ctl00_MainContent_WhatIsYourCondition");
                c1.val(result.d);
            }
            else {
                c1.val(result.d);
                __doPostBack('btnGo', '');
            }
        }
    });
}

function ShowTopSuggestions() {

    var cond = $("#ctl00_SearchText").val();

    if (cond.length < 2) {
        $("#topsuggestions").css("display","none");
        return;
    }

    $.ajax({
        url: "/services/search.asmx/GetAllSuggestions",
        data: '{ searchText: "' + cond + '", conditionsOnly : 0 }'
    })
    .success(function (data) { 
        if (data.d != "") {
            $("#topsuggestions").html(data.d).show();
        }
        else {
            $("#topsuggestions").html("").hide();
        }
    });
}

function SugTopThis(guid, cat) {

    var ste = $("#ctl00_SearchTextGuid");
    var stc = $("#ctl00_SearchTextCategory");

    if (cat == "t") {
        ste.val(guid);
        stc.val("treat");
        GetTopName("treat", guid);
    }
    else if (cat == "c") {
        ste.val(guid);
        stc.val("cond");
        GetTopName("cond", guid);
    }
    else if (cat == "s") {
        ste.val(guid);
        stc.val("symp");
        GetTopName("symp", guid);
    }
    else if (cat == "ca") {
        ste.val(guid);
        stc.val("cause");
        GetTopName("cause", guid);
    }

    $("#topsuggestions").css("display","none");
}

function SugThisNoRedirect(guid) {

    var stc = $("#ctl00_MainContent_WhatIsYourConditionGuid");

    stc.val(guid);
    GetTopNameNoRedirect("cond", guid);

    $("#suggestions").css("display","none");
}

function GetTopNameNoRedirect(cat, guid) {
    $.ajax({ url: "/services/search.asmx/GetName", data: '{ category: "' + cat + '", guid : "' + guid + '"}' })
    .success(function (result) {
        if (result.d != "") {
            $("#ctl00_MainContent_WhatIsYourCondition").val(result.d);
        }
    });
}

function GetTopName(cat, guid) {
    $.ajax({ url: "/services/search.asmx/GetName", data: '{ category: "' + cat + '", guid : "' + guid + '"}' })
    .success(function (result) { 
        if (result.d != "") {
            $("#ctl00_SearchText").val(result.d);
            Redirect(cat, guid);
        }
    });
}

function Redirect(cat, guid) {
    $.ajax({ async: false, url: "/services/search.asmx/Redirect", data: '{ category: "' + cat + '", guid : "' + guid + '"}' })
    .success(function (result) { 
        if (result.d != "") {
            location.replace(result.d);
        }
    });
}

function vff() {
    var fm = $("#feedbackmessage").val();
    var fe = $("#feedbackemail").val();

    if (fm == '') {
        jAlert("Please enter your message", "Healthetreatment Feedback");
        return false;
    }

    if (fe == '') {
        jAlert("Please enter your email address", "Healthetreatment Feedback");
        return false;
    }

    $.ajax({ url: "/services/profileservice.asmx/SendFeedback", data: '{ feedback: "' + fm + '", email: "' + fe + '"}' })
            .success(function (result) {
                var m;
                if (result.d == "") {
                    m = "Send failed. Please retry";
                }
                else {
                    m = result.d;
                }

                $("#osx-feedback").html(m);
            });
    return false;
}


function bnc() {
    window.piwikTracker.trackGoal(10);
    top.location.href = "/interview/";
}

function CloseContentItem() {
    $("#hidhotedit").hide();
}

function SaveContentItem(guid, key) {
    var cb = $("#t-" + guid);
    if (cb == null) {
        jAlert("No content available", "Healthetreatment Resources");
        return;
    }

    if (guid == '') {
        jAlert("No content id available", "Healthetreatment Resources");
        return;
    }

    // clear any quotes from the text
    var ct = cb.val().replace(/"/g, '##');

    $.ajax({ url: "/services/contentdata.asmx/SaveContentItem", data: '{ guid : "' + guid + '", key: "' + key + '", contentBody: "' + ct + '" }' })
    .success(function (result) {
        if (result.d != "") {
            jConfirm(result.d, 'Healthetreatment Content', function (r) {
                CloseResourceItem();
                if (r) {
                    document.location.href = document.location.href;
                }
            });

        }
    });
}

function clearTimer() {
    clearTimeout(hotcontenteditTimer);
}

function ClickToast() {
    window.piwikTracker.trackGoal(24);
    // put a second delay in for the redirect otherwise the tracking will never make it
    var intval = setInterval(function () {
        window.location.href = "/survey/";
    }, 1000);

}

function PleaseWait(i) {
}

function SignUp() {
    var usersId = $("#UsersId").val();
    var conditionId = $("#ConditionId").val();
    var email = $("#email").val();
    var password = $("#password").val();
    var chkTerms = $("#chkTerms").attr("checked");
    var chkClin = $("#chkClin").attr("checked");

    $.ajax({
        async: false,
        url: "/services/ProfileService.asmx/CreateAccount",
        data: '{ uid: "' + usersId + '", cid: "' + conditionId + '", email: "' + email + '", password: "' + password + '" }'
    })
	.success(function (data) {
	    if (data.d.Success) {
	        top.location.href = data.d.MessageBody;
	    } else {
	        humanMsg.displayMsg(data.d.MessageBody);
	    }
	});


}

// Is the review helpful link?
function rh(ucId) {

    $.fancybox.showActivity();

    $.ajax({
        async: false,
        url: "/services/ProfileService.asmx/IsLoggedIn",
        data: '{}'
    })
	.success(function (data) {
	    if (data.d.Success) {
	        $.ajax({
	            async: false,
	            url: "/services/ReviewService.asmx/UpdateReviewHelpful",
	            data: '{ ucid: "' + ucId + '" }'
	        })
	        .success(function (data2) {
	            if (data2.d.Success) {
	                $("#rhd-" + ucId).html("<span>You like this review!</span>");
	                $.fancybox(data2.d.MessageBody);
	            } else {
	                humanMsg.displayMsg(data2.d.MessageBody);
	            }
	        });

	    } else {
	        // are we logged in
	        $.ajax({
	            async: false,
	            url: "/services/ProfileService.asmx/GetSignupBoxNoFacebook",
	            data: '{}'
	        })
	        .success(function (data3) {
	            if (data3.d.Success) {
	                $.fancybox(data3.d.MessageBody);
	            } else {
	                humanMsg.displayMsg(data3.d.MessageBody);
	            }
	        });
	    }
	});

	$.fancybox.hideActivity();
    
}
