﻿function LeaderBoard(){}
function getByGameID(gameid, leaderboardcount, objectid, frequency,friendsonlycontent,playerid,language,iswidget){
   if(friendsonlycontent=="True" || friendsonlycontent=="true" ){      
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language +'&playerid=' + playerid + '&objectid=' + objectid + '&gameid=' + gameid + '&iswidget=' + iswidget+ '&action=getfriendscoresbygameid&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency + '&random=' + Math.random(), 
        onSuccess:function(t){
            var obj = document.getElementById(objectid);
            
            imgDiv_ajax_onSuccess(objectid + "_" + gameid + "_" + frequency);
       
            obj.innerHTML =  t.responseText;     
                      
            }, 
            
            onLoading:function(t)
            {
                imgDiv_ajax_onLoading((objectid + "_" + gameid + "_" + frequency), (objectid + "_topDiv"));
            },
            
            onFailure:function(t){
            
            imgDiv_ajax_onFailure(objectid + "_" + gameid + "_" + frequency);
            
            alert(t.responseText);
        }});
   }else{
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&objectid=' + objectid + '&gameid=' + gameid + '&iswidget=' + iswidget+ '&action=getbygameid&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency, 
            onSuccess:function(t){
               
                var obj = document.getElementById(objectid);
               // imgDiv_ajax_onSuccess(objectid + "_" + gameid + "_" + frequency);      
                obj.innerHTML =  t.responseText;         
            },          
            onLoading:function(t)
            {
                //imgDiv_ajax_onLoading((objectid + "_" + gameid + "_" + frequency), (objectid + "_topDiv"));
            },            
            onFailure:function(t){            
          // imgDiv_ajax_onFailure(objectid + "_" + gameid + "_" + frequency);            
            alert(t.responseText);
        }});
   }
}

function getOverallByStatName(statname, leaderboardcount, objectid,frequency,friendsonlycontent,playerid,ranktype,language,iswidget){
    if(friendsonlycontent=="True" || friendsonlycontent=="true" ){
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&ranktype=' + ranktype + '&playerid=' + playerid + '&iswidget=' + iswidget+ '&objectid=' + objectid + '&action=getfriendsoverall&statname=' + statname + '&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency + '&random=' + Math.random(), onSuccess:function(t){
            var obj = document.getElementById(objectid);
                       
            //add by andrew 2008-5-23 start
            //imgDiv_ajax_onSuccess(objectid + "_" + frequency);
            //add by andrew 2008-5-23 end
            
            //translate response......
            obj.innerHTML =  t.responseText; 
                        
            },
            
            //add by andrew 2008-5-23 start
            onLoading:function(t)
            {
                //alert(t.responseText);
                //alert(objectid);
                //imgDiv_ajax_onLoading((objectid + "_" + frequency), (objectid + "_topDiv"));
                //alert(jQuery("#" + objectid + "_topDiv").html())
            },
            //add by andrew 2008-5-23 end  
             
             
             onFailure:function(t){
            
            //add by andrew 2008-5-23 start
            ///imgDiv_ajax_onFailure(objectid + "_" + frequency);
            //add by andrew 2008-5-23 end
            
            alert(t.responseText);
        }});
    }else{
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&ranktype=' + ranktype + '&objectid=' + objectid + '&iswidget=' + iswidget+ '&action=getoverall&statname=' + statname + '&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency + '&random=' + Math.random(), 
            onSuccess:function(t){
                 
                var obj = document.getElementById(objectid);
                imgDiv_ajax_onSuccess(objectid + "_" + frequency);            
                obj.innerHTML =  t.responseText;           
            },             
            onLoading:function(t)
            {
                imgDiv_ajax_onLoading((objectid + "_" + frequency), (objectid + "_topDiv"));
                //setTimeOut("imgDiv_ajax_onSuccess('" + objectid + "_" + frequency + "')",2000);
            },            
            onFailure:function(t){                        
           //     imgDiv_ajax_onFailure(objectid + "_" + frequency);
            alert(t.responseText);
        }});
            
    }
}
 

function getOverallByStatNameAndCategory(statname, category, leaderboardcount, objectid,frequency,friendsonlycontent,playerid,language,iswidget){
    if(friendsonlycontent=="True" || friendsonlycontent=="true" ){
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&playerid=' + playerid + '&objectid=' + objectid + '&iswidget=' + iswidget+ '&action=getfriendsoverallbycategory&category=' + category + '&statname=' + statname + '&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency + '&random=' + Math.random(), 
        onSuccess:function(t){
            var obj = document.getElementById(objectid);
            
            //add by luke 2008-5-16 start
            imgDiv_ajax_onSuccess(objectid + "_" + frequency);
            //add by luke 2008-5-16 end
            
            //translate response......
            obj.innerHTML =  t.responseText;   
              
            }, 
            
             //add by luke 2008-5-16 start
            onLoading:function(t)
            {
                imgDiv_ajax_onLoading((objectid + "_" + frequency), (objectid + "_topDiv"));
            },
            //add by luke 2008-5-16 end
            
            onFailure:function(t){
            
            //add by luke 2008-5-19 start
            imgDiv_ajax_onFailure(objectid + "_" + frequency);
            //add by luke 2008-5-19 end
            
            alert(t.responseText);
        }});         
    }else{
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&objectid=' + objectid + '&iswidget=' + iswidget+ '&action=getoverallbycategory&category=' + category + '&statname=' + statname + '&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency + '&random=' + Math.random(), 
            onSuccess:function(t){
            var obj = document.getElementById(objectid);
            //translate response......
            
            //add by luke 2008-5-16 start
            imgDiv_ajax_onSuccess(objectid + "_" + frequency);
            //add by luke 2008-5-16 end
            
            obj.innerHTML =  t.responseText;         
        
            }, 
            
            //add by luke 2008-5-16 start
            onLoading:function(t)
            {
                imgDiv_ajax_onLoading((objectid + "_" + frequency), (objectid + "_topDiv"));
            },
            //add by luke 2008-5-16 end
            
            onFailure:function(t){
            
            //add by luke 2008-5-19 start
            imgDiv_ajax_onFailure(objectid + "_" + frequency);
            //add by luke 2008-5-19 end
            
            alert(t.responseText);
        }});
    }
}

//Add By Viva 2008/06/11 Start
function getOverallBySpecificAchieved(statname, leaderboardcount, objectid,frequency,friendsonlycontent,playerid,ranktype,language,iswidget)
{
    if(friendsonlycontent=="True" || friendsonlycontent=="true" ){
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&ranktype=' + ranktype + '&playerid=' + playerid + '&iswidget=' + iswidget+ '&objectid=' + objectid + '&action=getoverallbyspecificachieved&statname=' + statname + '&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency + '&random=' + Math.random(), onSuccess:function(t){
            var obj = document.getElementById(objectid);
                       
            //add by andrew 2008-5-23 start
            imgDiv_ajax_onSuccess(objectid + "_" + frequency);
            //add by andrew 2008-5-23 end
            
            //translate response......
            obj.innerHTML =  t.responseText; 
                        
            },
            
            //add by andrew 2008-5-23 start
            onLoading:function(t)
            {
                //alert(t.responseText);
                //alert(objectid);
                
                imgDiv_ajax_onLoading((objectid + "_" + frequency), (objectid + "_topDiv"));
                //alert(jQuery("#" + objectid + "_topDiv").html())
            },
            //add by andrew 2008-5-23 end  
             
             
             onFailure:function(t){
            
            //add by andrew 2008-5-23 start
            imgDiv_ajax_onFailure(objectid + "_" + frequency);
            //add by andrew 2008-5-23 end
            
            alert(t.responseText);
        }});
    }else{
        new Ajax.Request("/ajaxservices/leaderboards/leaderboards.aspx", {method:'get',parameters:'language=' + language + '&ranktype=' + ranktype  + '&playerid=' + playerid + '&objectid=' + objectid + '&iswidget=' + iswidget+ '&action=getoverallbyspecificachieved&statname=' + statname + '&leaderboardcount=' + leaderboardcount + '&frequency=' + frequency, 
            onSuccess:function(t){
            var obj = document.getElementById(objectid);
            //translate response......
            
            //add by luke 2008-5-16 start
            //imgDiv_ajax_onSuccess(objectid + "_" + frequency);
            //add by luke 2008-5-16 end
            
            obj.innerHTML =  t.responseText;
            
            }, 
            
            //add by luke 2008-5-16 start
            onLoading:function(t)
            {
               // imgDiv_ajax_onLoading((objectid + "_" + frequency), (objectid + "_topDiv"));
            },
            //add by luke 2008-5-16 end
            
            onFailure:function(t){
            
            //add by luke 2008-5-19 start
            //imgDiv_ajax_onFailure(objectid + "_" + frequency);
            //add by luke 2008-5-19 end
            
            alert(t.responseText);
        }});
            
    }
}

LeaderBoard.prototype.getoverallbyspecificachieved = getOverallBySpecificAchieved
LeaderBoard.prototype.getbygameid = getByGameID;
LeaderBoard.prototype.getbystatnameandcategory = getOverallByStatNameAndCategory;
LeaderBoard.prototype.getoverall = getOverallByStatName;
