
bam.loadSync(bam.homePath + "bam.datagrid.js");

bam.milbhome = (function($){	

	var _log=function(msg){
		if (_self.debug && typeof console!=="undefined") {
			if (typeof msg === "string") console.log("bam.milbhome: "+msg);
			else console.log(msg);			
		}	
	},	
	
	
	_ielog=function(msg){
		if (_self.debug && document.location.search.indexOf("iedebug")!=-1 && typeof msg === "string") {
			alert(msg);			
		}
	},

	
	_createCarousel = function(props){		
		var _c = props.container,
			maxItems = props.maxItems,									
			listItems = _c.find(".carousel_container li");
		_c.find(".carousel_pag li:eq(0)").addClass("pagOn").end().find(".carousel_container").show();
	 	//Remove any extra li items 			
		if(listItems.length>maxItems){
	    	listItems.slice(maxItems).each(function(){$(this).remove();});
		}								
	  	//Init JCarousel Lite
	 	$(_c.find(".carousel_container")).jCarouselLite({
			btnPrev   : _c.find(".carousel_prev"),
			btnNext   : _c.find(".carousel_next"),
			scroll    : 1,
			visible   : 1,
			speed     : 350,
			btnGo: [
				_c.find(".carousel_pag li:eq(0)"), 
				_c.find(".carousel_pag li:eq(1)"), 
				_c.find(".carousel_pag li:eq(2)") 
			],
			beforeStart : function(item, isAutoScroll){
				_c.find(".carousel_pag li").removeClass("pagOn");
	    	},
			afterEnd : function(item, isAutoScroll){										
				var allItems = $(item).parent().children();
				var allNavItems = _c.find(".carousel_pag li");
				var itemNum = allItems.index(item);
				if(itemNum > allNavItems.length)itemNum=1;
				else if(itemNum===0)itemNum=allNavItems.length;											
				itemNum--;
				_c.find(".carousel_pag li:eq("+itemNum+")").addClass("pagOn");																									
			}
		});			
		/*
		_c.find(".carousel_prev").hover(
			function(){ $(this).css({ "background-position" :"0 -36px" }); },
			function(){ $(this).css({ "background-position" :"0 0" }); }
		);
		_c.find(".carousel_next").hover(
			function(){ $(this).css({ "background-position" :"-36px -36px" }); },
			function(){ $(this).css({ "background-position" :"-36px 0" }); }
		);
		*/	
	},
	
	

/* ************************************ TABS ********************************* */
	
	_tabs = {
		init: function(defaultTab){
			_log("_tabs.init");
			$("#tabNavigation").remove().prependTo("#tab1Content, #tab2Content").show();	
			var that=this, $doc=$(document);			
			if(defaultTab==="standings") that.set(1);
			else that.set(2);
			$doc.selector = "#mc_tabs .tab1Nav a";		
			$doc.live("click", function(e) {				
				that.set(1);					
				_standings.load({level: $(this).attr("code")});
        	});			
			$doc.selector = "#mc_tabs .tab2Nav a";		
			$doc.live("click", function(e) {		
				that.set(2);		
				_stats.load($(this).attr("code"));
        	});		
			delete that.init;			
		},			
		set: function(tab){	
			var that=this;
			if(tab===1){
				$("#tab2Content").hide();
				$("#tab1Content").show();				
				$("#mc_tabs .tab2Nav strong").unbind().click(function(){		
					that.set(2);			
				//	bam.milbStats.load("all");							
				}).addClass("activeCursor");				
				$("#mc_tabs .tab1Nav strong").unbind().removeClass("activeCursor");					
			}else if(tab===2){
				$("#tab1Content").hide();
				$("#tab2Content").show();
				$("#mc_tabs .tab1Nav strong").unbind().click(function(){		
					that.set(1);			
				//	bam.milbStandings.load("aaa");					
				}).addClass("activeCursor");	
				$("#mc_tabs .tab2Nav strong").unbind().removeClass("activeCursor");				
			}					
		}	
	},
	



/* ************************************ STANDINGS ********************************* */



_standings = {			
	
	/* TODO: create this from lookup source */
	levels: {
		"aaa"	: {
			117 : {
				name : "International",
				divisions : { 219:"North", 220:"South", 221:"West" }
			},
			112 : {
				name : "Pacific Coast",
				divisions : { 231:"Pacific Northern", 232:"American Northern", 233:"Pacific Southern", 234:"American Southern" }
			}		
		},
		"aax"	: {
			109 : {
				name : "Texas",
				divisions : { 241:"North", 242:"South"}	
			},			
			111 : {
				name : "Southern",
				divisions : { 239:"North", 240:"South"}	
			},		
			113 : {
				name : "Eastern",
				divisions : { 212:"Eastern", 213:"Western"}	
			}
		},
		"afa": {
			110 : {
				name : "California",
				divisions : { 208:"North", 209:"South" }
			},
			123 : {
				name : "Florida State",
				divisions : { 214:"North", 215:"South" }
			},	
			122 : {
				name : "Carolina",
				divisions : { 210:"Northern", 211:"Southern" }
			}
		},
		"afx"	: {
			116 : {
				name : "South Atlantic",
				divisions : { 237:"Northern", 238:"Southern" }
			},
			118 : {
				name : "Midwest",
				divisions : { 224:"Eastern", 225:"Western" }
			}		
		},
		"asx"	: {
			126 : {
				name : "Northwest",
				divisions : { 226:"East", 227:"West" }
			},
			127 : {
				name : "New York-Penn",
				divisions : { 228:"McNamara", 229:"Pinckney", 230:"Stedler" }
			}		
		},
		"rok"	: {
			120 : {
				name : "Appalachian",
				divisions : { 206:"East", 207:"West" }
			},
			121 : {
				name : "Arizona",
				divisions : { 560:"East", 561:"West" }
			},
			124 : {
				name : "Gulf Coast",
				divisions : { 216:"East", 217:"North", 218:"South" }
			},
			128 : {
				name : "Pioneer",
				divisions : { 235:"North", 236:"South" }
			},
			130 : {
				name : "Dominican Summer",
				divisions : { 246:"San Pedro de Macoris", 247:"Boca Chica North",249:"Santo Domingo North", 250:"Boca Chica Baseball City" }
			},
			134 : {
				name : "Venezuelan Summer",
				divisions : { }
			}	
		}
	}, //end levels
		
	grids: {},
	cache: {},
		
	
	serviceParams: {
		"sit_code" : ["'h0'","'h1'","'h2'"],
		"standings_all.col_ex" : "playoff_points_sw,points,streak,elim,last_ten,home,away,vs_division,is_wildcard_sw,gb_wildcard,elim_wildcard"		
	},	
		
		
	getData: function(leagueID) {
		$.extend(this.serviceParams,{league_id:leagueID, org_id:leagueID, season:_seasonYear-1});	//roll back year for preseason
		$.ajax({
        	async       : false,
         	dataType    : "json",
         	url       	: "/lookup/json/named.standings_display_flip.bam",			
			//url			: "/y2010/data/standings.js",
			//url			: "/y2010/data/standings_nodata.js",	
			//url			: "/y2010/data/standingstest.js",		
      		data        : this.serviceParams,
			traditional	: true,
			beforeSend	: function() {$("#stLoading").show();},
			error		: function(err) {
				_log(err);
				//$("#tab1Content #noData").show();
			},
        	success     : function(serviceData) {  							
				var rows = bam.util.ensureArray(bam.object.getDeepValue(serviceData, 'standings_display_flip.standings_all.queryResults.row'));
				if (typeof rows !== 'undefined') _standings.cache[leagueID] = rows;						
				var org =  bam.util.ensureArray(bam.object.getDeepValue(serviceData, 'standings_display_flip.org_history.queryResults.row'));
				if (typeof org !== 'undefined') _standings.cache[leagueID]["org"] = org[0];									
			}
  		});
	},
		
	
		
	// creates a datagrid
	initGrid: function(gridNum){
		var gObj = this.grids[gridNum];
		if(!gObj){		
			gObj = new bam.datagrid.DataGrid({
				tableClass:"standings_data",
				columns: [{title: "TEAM", sortable: false, width: "108px"},
						 {title: "W", 	sortable: false, width:"23px"},
						 {title: "L", 	sortable: false, width:"23px"},
						 {title: "PCT",	sortable: false, width:"23px"},
						 {title: "GB", 	sortable: false, width:"23px"}]	
			});
		}
		this.grids[gridNum]=gObj;
		return gObj;	
	},
		
	
	
	// this function does most of the work
	
	buildGrid: function(props){		

		var level = props.level.toLowerCase(),
			leagueID = props.leagueID,
			gridNum = props.gridNum,			
			division = props.division,
			league = this.levels[level][leagueID],
			seasonSplit = "h0",
			gridDiv = "gridDiv"+gridNum,
			$gridDiv = $("#"+gridDiv),
			gridObj = this.initGrid(gridNum),
			_cache = this.cache;	
			
		_log(_cache);	
		
		// make an ajax request if league data isn't already cached
		if(!_cache[leagueID]) this.getData(leagueID);			
		
		var dataObj = _cache[leagueID];
		var isValidData = (!!dataObj && !!dataObj["org"]);		
		if(!!gridObj)gridObj.clearData();	
		
		if(!!isValidData) {
			_log("Processing: " + level + ", League ID=" + leagueID + ", grid:"+gridNum+", division="+division);		
			
			var numRows = dataObj.length,				
				org = _cache[leagueID]["org"],				
				isSplitSeason = (!!org && org.split_season_sw==="Y")?true:false,		
				showClinchLegend = false,
				rLen = numRows>8?8:numRows-1, 
				row, count=0, clinchIcon="";		
		
			// if it's a split season determine whether it's the first or second half
			if(!!isSplitSeason) {								
				var firstHalfBegin = org.first_date_seas.replace(/-/g,"").substr(0,8);	
				var secondHalfBegin = org.first_date_2ndh.replace(/-/g,"").substr(0,8);	
				_log("_currentDate="+_currentDate+", firstHalfBegin="+firstHalfBegin+", secondHalfBegin="+secondHalfBegin)
				if (_currentDate < firstHalfBegin)seasonSplit = "h0"				
				else if (_currentDate >= firstHalfBegin && _currentDate < secondHalfBegin)seasonSplit = "h1"
				else if (_currentDate >= secondHalfBegin)seasonSplit = "h2";
			}
			
			
			_log("dataObj");
			_log(dataObj);
			
			_log("numRows is " + numRows);
		if (numRows > 0) {
			// if no division arg is specified get a random one			
			var divTest = division || dataObj[Math.floor(Math.random()*numRows)].division_id || Math.random();		
			_log("2: divTest="+divTest+", numRows="+numRows+", division="+division);
			// populate division subnav and add click behaviors	
			if(!division){
				// stupid hack to make PCL look different than every other league					
				if(leagueID==="112") {						
					var tempStr='Pacific: <span class="divLink" id="231" style="border:0">Northern</span>|<span class="divLink" id="233" style="border:none">Southern</span><br>American: <span class="divLink noBorder" id="232" style="border:0">Northern</span>|<span class="divLink noBorder" id="234" style="border:none">Southern</span>';
					$gridDiv.siblings(".stSubnav").html(tempStr)
					.find("span").click(function(){ 
						$(this).siblings().removeClass("divLinkActive");
						_standings.load({level:level, league:leagueID, grid:gridNum, division:$(this).attr("id")}); 
						$(this).addClass("divLinkActive");					
					});
				} else {
					for (var divisionID in league.divisions) {
						$("<span>" + league.divisions[divisionID] + "</span>").addClass("divLink").attr("id",divisionID)
						.click(function(){ 
							$(this).siblings().removeClass("divLinkActive");
							_standings.load({level:level, league:leagueID, grid:gridNum, division:$(this).attr("id")}); 
							$(this).addClass("divLinkActive");					
						}).appendTo($gridDiv.siblings(".stSubnav"));					
					}					
				}				
				$("#"+divTest).addClass("divLinkActive");
			}			
							
			// loop through cache, filter out divisions and split season, and populate datagrid
			for(i=0;i<numRows && count<rLen;i++) {
				row = dataObj[i];				
				//_log("2: row.division_id="+row.division_id+", divTest="+divTest+", row.sit_code="+row.sit_code+", seasonSplit="+seasonSplit);				
				if(row.division_id===divTest && row.sit_code===seasonSplit){									
					clinchIcon = row.playoffs_flag_milb;

					// populate grid						
					gridObj.insertRow([
						clinchIcon + row.team_short,
						row.w,
						row.l,
						row.pct,
						row.gb
					]);		
					count++;
				}										
			}									
			
		}
		gridObj.render(gridDiv);	
		
		// show parent container				
		if(gridNum<3)$gridDiv.parents(".stContainer").show();		
		// display league name	
		$gridDiv.siblings(".stLeague").text(league.name + "  League");	
		// show full standings link
		$gridDiv.siblings(".stFullLink").find("a").unbind().click(function(){
			document.location = prodCacheServerURLGlobal+"/standings/index.jsp?sid=milb&lid="+leagueID+"&period="+seasonSplit;
		});			
		// fix some styles	
		$(".standings_data td[index=0], .standings_data th[index=0]").addClass("alignLeft");
		$(".stSubnav").each(function(){
			$(this).find(".divLink:first").css({padding:"0 4px 0 0",border:"0"});
		});			
		
		$("#stLoading").hide();		
	}
		
},  // end buildGrid
		
		
	
	// need to fix this so that you don't have to click twice when returning 
	setXtraNav: function(gridNum){
		$("#stNext").unbind().toggle(
			function(){			
				$(".stContainer:lt(3)").hide();
				$(".stContainer:gt(2)").show();
				$(this).text("Previous 3 leagues >");					
			},
			function(){
				$(".stContainer:lt(3)").show();
				$(".stContainer:gt(2)").hide();
				$(this).text("Next " + (gridNum-3) + " leagues >");
			}
		).text("Next " + (gridNum-3) + " leagues >")
		.show();
		this.setClinchLegend();
	},
	
	
	
	
	setClinchLegend: function(){	
		$("#stClinchKey span").hide();		
		$(".gridDiv:visible").find("td[index=0]").each(function(){
			var glyph = $(this).text().substr(0,1);
			$("#stClinchKey span").filter(function(){
				return ($(this).text().substr(0,1) === glyph);
			}).show();			
		});
	},
	
	
	
	load: function(props){ //level,league,grid,division
		_log("_standings.load");
		$.extend(this.serviceParams,{season:this._seasonYear});	
		var level = props.level.toLowerCase(),
			league = props.league,
			grid = props.grid,
			division = props.division;		
		$("#tab1Content .noData").hide();			
		// set styles for the main nav		
		$("#mc_tabs .tab1Nav a").removeClass("divLinkActive").filter(function() {
			return $(this).attr("code") === level;				
		}).addClass("divLinkActive");						
		// if only level is passed, call buildGrid for each league in level			
		if(!league && !grid && !division){
			$(".stContainer, #stNext").hide();					 
			$(".stSubnav").empty();
			var gridNum=0;			
			for (var leagueID in this.levels[level]) {				
				this.buildGrid({level:level, leagueID:leagueID, gridNum:gridNum});
				gridNum++;
			}							
			if(gridNum>3) this.setXtraNav(gridNum);					
			// some dynamic styles			
			if(gridNum<3) $(".stContainer").width("305px")
			else $(".stContainer").width("216px");		
		} else {
			 this.buildGrid({level:level, leagueID:league, gridNum:grid, division:division});
		}		
		this.setClinchLegend();			
		//delete this.init;			
	}
	
},
	




// TODO tab1Nav and tab2Nav should be classes not ids





	

	
/* ************************************ STATS **********************************/



	_stats = {			
		
		hittingGrid: new bam.datagrid.DataGrid({
			tableClass:"stats_data",
			columns: [
				{title: "", sortable: false, width: "15px" },
				{title: "", sortable: false, width: "115px"},
				{title: "", sortable: false, width:"40px"},
				{title: "", sortable: false, width:"25px"}
			],
			showHeader: false		
		}),
		
		pitchingGrid: new bam.datagrid.DataGrid({
			tableClass:"stats_data",
			columns: [
				{title: "", sortable: false, width: "15px" },
				{title: "", sortable: false, width: "115px"},
				{title: "", sortable: false, width:"40px"},
				{title: "", sortable: false, width:"25px"}
			],	
			showHeader: false		
		}),
		
		serviceParams:{
			"pitching" : {
				"sort_column" : ["'era'","'whip'","'w'","'so'","'sv'","'avg'"],
				"results" : 5,
				"game_type" : "'R'",
				"milb_sport_leader_pitching_repeater.col_in" : ["player_id","era","w","sv","so","whip","avg","last_name","team_abbrev","team_id"]
			},
			"hitting" : {
				"sort_column" : ["'avg'","'rbi'","'obp'","'slg'","'h'","'hr'"],
				"results" : 5,
				"game_type" : "'R'",
				"milb_sport_leader_hitting_repeater.col_in" : ["player_id","obp","slg","rbi","h","avg","hr","last_name","team_abbrev","team_id"]
			}	
		},
		
		// mapping tab text to sport code
		sportCodes: {
			"all"		:	["'aaa'","'aax'","'afa'","'afx'"],
			"aaa"		:	"'aaa'",
			"aax"		:	"'aax'",
			"afa"		:	"'afa'",
			"afx"		:	"'afx'",
			"asx"		:	"'asx'",
			"rok"		:	"'rok'"	
		},		
		
		cache: {},
		currentLevel: "",	
		errorMsg: "<div style=\"margin:12px; font-weight:bold\">Data is unavailable at this time. </div>",			
		loadattempts: { hitting: 0, pitching: 0 },
		
		loadpreviousyear: function(side){
			var lastyear = _seasonYear-1;
			this.loadattempts[side]++;
			_log("loadpreviousyear: side="+side+", lastyear="+lastyear+", _stats.loadattempts[side]="+_stats.loadattempts[side]);
			if(this.loadattempts[side]<2) {
				this.getData(side,lastyear);
			} else {
				this.loadattempts[side] = 0;
			}			
		},
		
	
		getData: function(side,yyyy) {		
			var season = yyyy || _seasonYear,
				repeater = "milb_sport_leader_" + side + "_repeater",
				mux = "milb_sport_leader_"+side+"_mux",
				serviceURL = "/lookup/json/named." + repeater + ".bam",
				//serviceURL = "/y2010/data/" + side + "_stats.js";	
				cache = _stats.cache, 
				level = _stats.currentLevel;				
			_log("getData: side="+side +", season="+season);					
			$.extend(this.serviceParams[side],{ 
				sport_code: this.sportCodes[level], 
				season: season 
			});			
			if(!cache[level]) cache[level] = {};							
			if(!cache[level][side]) cache[level][side] = {};											
			$.ajax({
        		async       : false,
        	 	dataType    : "json",
        	 	url     	: serviceURL,			
				timeout		: 5000,
      			data        : this.serviceParams[side],
				traditional	: true,
				beforeSend	: function() {$("#statsLoading").show();},
				error		: function(err) { _log(err); },
        		success     : function(serviceData) {  		 
					var results = serviceData[repeater][mux];														
					// load data into cache object								
					for(i=0;i<results.length;i++){
						cache[level][side][results[i].sort_column] = results[i].queryResults.row;
					}					
					_log("Service data loaded into cache. Displaying cache below.");		
					_log(cache);		
				},
				complete	: function() {
					// if data does not exist, run previous year		
					var isData = false,
						labelStr = side + " leaders";					
					for(var stat in cache[level][side]) {
						if(!!cache[level][side][stat]) isData = true;							
					}
					if(!isData) _stats.loadpreviousyear(side); 											
					if(_stats.loadattempts[side] === 1) {
						labelStr = _seasonYear - 1 + "&nbsp;" + side + " leaders";
					}
					cache[level][side]["labelStr"] = labelStr;
					$("#"+side+"Leader").parents(".statsContainer").find(".statsLabel").html(labelStr);	
				}
  			});				
		},
	
	
		writeGrid: function(side, stat) {	
			_log("writeGrid: side=" + side + ", stat=" + stat );			
			// update tab nav
			var $curTab = $(".statsContainer ul li").filter(function(){
				var tabstat = $(this).text().replace(/^\s+|\s+$/g,"").toLowerCase();
				var tabside = $(this).attr("side").replace(/^\s+|\s+$/g,"").toLowerCase();
				var out = (tabstat === stat && tabside === side);
				return out;			
			});		
			$curTab.siblings().removeClass("statsTabOn").addClass("statsTabOff")
			.end().removeClass("statsTabOff").addClass("statsTabOn");			
			if(!!this.cache[this.currentLevel] && !!this.cache[this.currentLevel][side] && !!this.cache[this.currentLevel][side]["'"+stat+"'"]){	
				$("#"+side+"Leader").parents(".statsContainer").find(".statsLabel").html(this.cache[this.currentLevel][side]["labelStr"]);	
				var rows = this.cache[this.currentLevel][side]["'"+stat+"'"],
					row, gridObj = (side==="hitting") ? this.hittingGrid : this.pitchingGrid,
					playerURL = prodCacheServerURLGlobal+"/milb/stats/stats.jsp?sid=milb&t=p_pbp&pid=",
					playerID = rows[0].player_id,	
					playerIMG = (!!playerID) ? 					
						prodCacheServerURLGlobal+"/images/players/mugshot/ph_"+playerID+".jpg" : 
						prodCacheServerURLGlobal+"/y2010/images/anonymous.gif",								
					teamURL = prodCacheServerURLGlobal+"/index.jsp?sid=t";						
				// reset
				$("#"+side+"Leader").parent().find(".statsMessage").hide().siblings().show();	
				_stats.loadattempts[side] = 0;
				// update mugshot	
				$("#"+side+"Leader img").attr("src",playerIMG).unbind().click(function(){
					if(!!playerID){
						window.open(playerURL+playerID);
					}else{				
						window.open(prodCacheServerURLGlobal+"/milb/stats/");	
						// TODO:					
						//should launch this instead: /milb/stats/stats.jsp?sid=milb&t=l_pit&lid=117
						//...but we don't have a league ID hook		
						//var str = prodCacheServerURLGlobal+"/milb/stats/stats.jsp?sid=milb&t=l_" +
						//			((side==="hitting")?"bat":"pit") +
						//			"&lid=117";					
					}
				});											
				// update grid
				if(!!gridObj)gridObj.clearData();		
				for(i=0;i<5;i++){
					row = rows[i];			
					gridObj.insertRow([
						"@@index",
						"<a target='blank' href='"+playerURL+row.player_id+"'>"+row.last_name+"</a>",				
						"<a target='blank' href='"+teamURL+row.team_id+"'>"+row.team_abbrev+"</a>",
						row[stat]
					]);			
				}	
				gridObj.render(side+"Stats");	
				$(".stats_data tr[index=0] td").css("font-weight","bold");					
			} else {			
				// handle no data	
				$("#"+side+"Leader").siblings().andSelf().hide().parent().find(".statsMessage").html(this.errorMsg).show();
			}
		},
	
		load: function(level){		
			if(!!_stats.setupNav)_stats.setupNav();	
			$(".statsContainer").hide();						
			_log("Loading level: "+level);		
			$("#mc_tabs .tab2Nav a").removeClass("divLinkActive").filter(function() {
				return $(this).attr("code") === level;				
			}).addClass("divLinkActive");	
			this.currentLevel=level.toLowerCase();				
			if(!this.cache[this.currentLevel]) {
				this.getData("hitting");
				this.getData("pitching");
			}				
			this.writeGrid("hitting","avg");
			this.writeGrid("pitching","era");
			$(".statsContainer").show();
			$("#statsLoading").hide();			
		},			
	
		setupNav: function(){
			$(".statsContainer ul li").click(function(){	
				_log("target clicked");			
				var side = $(this).attr("side");
				var stat = $(this).text().toLowerCase().replace(/\s*$/, '');				
				_log("side="+side+", stat="+stat);				
				_stats.writeGrid(side,stat);
			});	
			delete this.setupNav;			
		}
	
	},
	
	
	// these are populated when init() is called
	_currentDate = null,
	_seasonYear = null,

	
	_self = {
		debug: (!!bam.env.host.isQA || !!bam.env.host.isDev),
		init: function(props) {							
			_seasonYear = props.seasonYear;
			_currentDate = props.currentDate;		
			_log("Loading with these vars:");
			_log("_seasonYear="+_seasonYear);
			_log("_currentDate="+_currentDate);						
			// build carousel
			_createCarousel({container: $("#mc_multimedia"), maxItems: 3});				
			_standings.load({level: "aaa"}); 
			_stats.load("all");
			// initializes the stats/standings module
			// the argument sets the default tab
			_tabs.init("stats"); // "stats" or "standings"			
			delete _self.init;	
		}
	};
	
	
	$(function() {
		bam.milbhome.init({
			seasonYear		:	season_year,
			// seasonYear		:	"2010",
			currentDate		:	sysdate.substring(0,8)
		});	
	});
	
	return _self;			

})(jQuery);






