﻿var vwcWebService = null;
var timerHnd;

function SucceededCallback(result, userContext, methodName)
{   
    if (methodName.toLowerCase() == "updaterank")
    {   
        if (!result)
        {
            alert("An error occur while trying to update rank.");
        }
        else
        {   
            if (userContext)
            {
                userContext.manageAnimation(false);
                userContext.displayRank(result);                
            }
        }
    }
    
    if (methodName.toLowerCase() == "updaterating")
    {
        if (!result)
        {
            alert("An error occur while trying to update rating.");
        }
        else
        {   
            if (userContext)
            {
                userContext.manageAnimation(false);
                userContext.displayRating(result);                
            }
        }
    }
}
	
function FailedCallback(error, userContext, methodName, obj)
{
    if (methodName.toLowerCase() == "updaterank")
    { 
        if (confirm("An error occur while trying to update rank. \n\n Click OK to reload page and try again."))
        {
            window.location.reload();
        }
        if (userContext) userContext.manageAnimation(false);
    }
    
    if (methodName.toLowerCase() == "updaterating")
    {
        if (confirm("An error occur while trying to update item rating. \n\n Click OK to reload page and try again."))
        {
            window.location.reload();
        }
        if (userContext) userContext.manageAnimation(false);
    }    
}

function HideElement(eId)
{
    $get(eId).style.display = "none";
    clearTimeout(timerHnd);
}

if (typeof(Sys) != "undefined") Sys.Application.notifyScriptLoaded();
