





//
//
// This file has been moved to /webdev/www/pgatour/.element/ssi/js/1.0/leaderboard
//
//





























/* Contains the request functions that load data files from the server */


function PGAreq() {} 

PGAreq.getLeaderBoard=function( callback, year, tid, rnd){
//	var path="/ddr?data=pgatour/scoring/"+year+"/"+tid+"_r"+rnd;
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/leaderboard-1.dat";
	TBLRequestor.execute( callback, 1, path);
}

PGAreq.getLeaderBoardAdd=function( callback, year, tid, rnd, eid ){
//	var path="/ddr?data=pgatour/scoring/"+year+"/"+tid+"_r"+rnd;
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/leaderboard-" + eid + ".dat";
	TBLRequestor.execute( callback, 1, path);
}

// PENDING: what's that?
/*PGAreq.getPlayoff=function( callback, year, tid ){
	var path="/ddr?data=pgatour/scorecards/"+year+"/"+tid+"/playoff";
	TBLRequestor.execute( callback, 1, path );
}*/

PGAreq.getFedexCupPoints=function( callback, pid ,year, tid){
	var id=tid.substr(0,4);
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/" + getPlayerUrl(pid) + "/fedexCup.html";
	var param=pid;
	TBLRequestor.execute( callback, 1, path, param );
}

PGAreq.getScorecard=function( callback, pid, year, tid, rnd ){
	var id=tid.substr(0,4);
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/" + getPlayerUrl(pid) + "/sc/rnd" + rnd + ".html";
	var param=pid;
	TBLRequestor.execute( callback, 1, path, param );
}

PGAreq.getPlaybyPlay=function( callback, pid, year, tid ,rnd){
	var id=tid.substr(0,4);
	//var path="/scoring/leaderboard/"+year+"/"+id+"/data/"+getPlayerUrl(pid)+"/pbp/rnd"+rnd+"/lastHole.html";
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/" + getPlayerUrl(pid) + "/pbp.html";
	var param=pid;
	TBLRequestor.execute( callback, 1, path, param );
}

PGAreq.getHoleData=function( callback, pid, year, tid, rnd, hole, course ){
	var hole_round="round"+rnd;
	var param=pid+"~"+hole;
    var course_hole;
    if(typeof(course)!="undefined"){
        course_hole=course+"_hole"+hole;
    }
    else{
        course_hole="hole"+hole;
    }
	//var path="/.element/ssi/sect/1.0/leaderboard/" + year + "/" + tid + "/data/hole-stats/" + course_hole+".html";
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/hole-stats/" + course_hole + ".html";
	TBLRequestor.execute( callback, 0, path, param );
}

PGAreq.getKeyStats=function( callback, pid, year, tid ){
	var id=tid.substr(0,4);
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/" + getPlayerUrl(pid) + "/ks.html";
	var param=pid;
	TBLRequestor.execute( callback, 1, path, param );
}

PGAreq.getLBState=function( callback, year, tid ){
	var path = "/.element/ssi/auto/3.0/sdms/leaderboards/" + tid + "/data/" + year + "/state.dat";
	TBLRequestor.execute( callback, 0, path);
}


PGAreq.getData=function(callback, convertresults, p ){
	var path='/ddr?data='+p;
	TBLRequestor.execute( callback, convertresults, path );
}

PGAreq.getHtml=function( callback, p ){
//	var path='/ddr?html='+p;
//	var path="/scoring/leaderboard/"+tid+"/data/lastUpdated.html";
	var path = p;
	TBLRequestor.execute( callback, 0, path );
}

PGAreq.getUrl=function( callback, p ){
	var path=p;
	TBLRequestor.execute( callback, 0, path );
}

PGAreq.getXmlDOM=function( callback, p){
	var path=p;
	TBLRequestor.execute( callback, 'xml', path );
}

PGAreq.getJson=function( callback, p ){
	var path='/ddr?json='+p;
	TBLRequestor.execute( callback, 'json', path );
}
