WGT.Awards={currentCategory:"GameMastery",pristineAwardNode:null,AwardCategory:{None:0,GameMastery:1,Courses:2,MatchPlay:3,FunStuff:4,Missions:5,Trophies:6,parse:WGT.Util.parseEnum,each:WGT.Util.eachEnum},AwardType:{None:0,Tiered:1,Single:2,Trophy:3,parse:WGT.Util.parseEnum,each:WGT.Util.eachEnum},TieredAwardLevel:{None:0,Tin:1,Bronze:2,Silver:3,Gold:4,Platinum:5,Crystal:6,Diamond:7,parse:WGT.Util.parseEnum,each:WGT.Util.eachEnum,getLevelValue:function(c,b){for(var d in c){var a=c[d];if(a.Level==b){return a.Value}}}},ValueType:{Float:0,Integer:1,Percentage:2,Foot:3,Yard:4,Bool:5,Dollar:6,Record:7,TieLessRecord:8,parse:WGT.Util.parseEnum,each:WGT.Util.eachEnum},loadTopProfileAwards:function(a,d,b){var c=function(e){for(var g in e){var f=e[g];var h='<div class="topAward"><div class="topAwardImage"><img src="'+getBadgeAsset(f)+'" title="'+getAwardName(f)+'" alt="'+getAwardName(f)+'" /></div> '+getAwardName(f)+"</div>";b.append(h)}};$.ajax({type:"POST",url:callrouterURL+"GetTopPlayerAwards",data:"{CSUserID:"+a+", NumberOfItems: "+d+"}",dataType:"json",contentType:"application/json; charset=utf-8",beforeSend:function(e){e.setRequestHeader("Content-type","application/json")},success:function(e){var f=(e.d)?e.d:e;c(f)}})},getAwardCategories:function(){$.ajax({type:"POST",url:callrouterURL+"GetAwardCategories",data:"{}",dataType:"json",contentType:"application/json; charset=utf-8",beforeSend:function(a){a.setRequestHeader("Content-type","application/json")},success:function(a){var b=(a.d)?a.d:a;WGT.Awards.processPlayerCategory(b)}})},getAwardCourses:function(){$.ajax({type:"POST",url:callrouterURL+"GetAwardCourses",data:"{}",dataType:"json",contentType:"application/json; charset=utf-8",beforeSend:function(a){a.setRequestHeader("Content-type","application/json")},success:function(a){var b=(a.d)?a.d:a}})},getPlayerCategoryAwards:function(a,b){$.ajax({type:"POST",url:callrouterURL+"GetPlayerCategoryAwards",data:"{CSUserID:"+a+", Category: "+b+"}",dataType:"json",contentType:"application/json; charset=utf-8",beforeSend:function(c){c.setRequestHeader("Content-type","application/json")},success:function(k){var m=(k.d)?k.d:k;var q=0;var d=0;if(m.length){$(WGT.Awards.pristineAwardNode).clone(true).appendTo($("#awards"))}for(var c=0;c<m.length;c++){var f=m[c];var n;var p;var o=(f.Progress>0)?false:true;if(f.AwardType==WGT.Awards.AwardType.Tiered){n=7;p=true}else{if(f.AwardType==WGT.Awards.AwardType.Single){n=1;p=true}else{if(f.AwardType==WGT.Awards.AwardType.Trophy){n=0;p=false}else{n=0;p=true}}}q+=f.Progress;d+=n;if(f.Progress==n){$("#award_info").addClass("completed_award").removeAttr("id")}else{if(f.Progress<n){$("#award_info").addClass("incomplete_award").removeAttr("id")}else{$("#award_info").addClass("incomplete_award").removeAttr("id")}}$("#award_title").html(getAwardName(f.Award,p,o)).removeAttr("id");if(b==WGT.Awards.AwardCategory.Trophies){$("#award_description").empty().removeAttr("id")}else{$("#award_description").html(getAwardDescription(f.Award)).removeAttr("id");$("#award_progress_text").html(f.Progress+" of "+n).removeAttr("id");var l=WGT.Awards.getProgressBarWidth(f.Progress,n,108);WGT.Awards.renderGradient($("#award_progress_meter"),l)}$("#award_progress_meter").removeAttr("id");$("#main_award_label").html(formatStatValue(f.Award.Value,f.Award.ValueType)).removeAttr("id");if(f.AwardType==WGT.Awards.AwardType.Tiered){if(f.Progress==0){$("#main_award_graphic").addClass("unattained")}$("#main_award_graphic").attr("src",getAwardAsset(f.Award,true,o)).attr("alt",getAwardName(f.Award,p,o)).attr("title",getAwardName(f.Award,p,o)).removeAttr("id");for(var h=0;h<f.LevelValues.length;h++){var e=f.LevelValues[h];var g=WGT.Awards.TieredAwardLevel.parse(e.Level);f.Award.Level=g;if(f.Progress<=h){$("#"+g.toLowerCase()+"_award_graphic").addClass("unattained")}$("#"+g.toLowerCase()+"_award_graphic").attr("src",getAwardAsset(f.Award,true,o)).attr("alt",getAwardName(f.Award,p,false)).attr("title",getAwardName(f.Award,p,false)).removeAttr("id");$("#"+g.toLowerCase()+"_award_label").html(formatStatValue(e.Value,f.Award.ValueType)).removeAttr("id")}$("#tiered_awards_wrapper > .tiered_awards_toggle").click(function(){$(this).toggleClass("up").next().toggle("slide",{direction:"up"},250)});$("#tiered_awards_wrapper").removeAttr("id")}else{if(f.AwardType==WGT.Awards.AwardType.Single){f.Award.Level="Diamond";$("#main_award_graphic").attr("src",getAwardAsset(f.Award,true,o)).attr("alt",getAwardName(f.Award,p,o)).attr("title",getAwardName(f.Award,p,o)).removeAttr("id");$("#tiered_awards_wrapper").remove()}else{if(f.AwardType==WGT.Awards.AwardType.Trophy){$("#main_award_graphic").attr("src",getAwardAsset(f.Award,true,o)).attr("alt",getAwardName(f.Award,p,o)).attr("title",getAwardName(f.Award,p,o)).removeAttr("id");$("#tiered_awards_wrapper").remove()}}}if(c<m.length-1){$(WGT.Awards.pristineAwardNode).clone(true).appendTo($("#awards"))}}if(d==0){WGT.Awards.hideProgressIndicators()}else{WGT.Awards.showProgressIndicators();$("#total_awards_count").html(q+" of "+d);var r=WGT.Awards.getProgressBarWidth(q,d,108);WGT.Awards.renderGradient($("#total_progress_meter"),r)}}})},processPlayerCategory:function(b){for(var a=0;a<b.length;a++){if(WGT.Awards.AwardCategory.parse(b[a])==WGT.Awards.currentCategory){$("#award_categories .category_link").removeClass("current_category");if(WGT.Awards.currentCategory=="GameMastery"){$("#awards_header_title").html("Master Your Game");$("#master_your_game_link").addClass("current_category")}else{if(WGT.Awards.currentCategory=="Trophies"){$("#awards_header_title").html("Tournament Trophies");$("#tournament_trophies_link").addClass("current_category")}}WGT.Awards.getPlayerCategoryAwards(profileUserID,b[a])}}},renderGradient:function(a,b){b=(b==0)?1:b;$(a).gradient({from:"f9f9f9",to:"7db72d",direction:"vertical",length:b,position:"left"})},getProgressBarWidth:function(a,b,c){return((a*c)/b)},hideProgressIndicators:function(){$("#total_progress_meter, #total_awards_count, .award_progress_text, .award_progress_meter").hide()},showProgressIndicators:function(){$("#total_progress_meter, #total_awards_count, .award_progress_text, .award_progress_meter").show()}};