(function () {
	$.suning || ($.suning = {});
	//类式继承
	$.suning.extend = function(c, s) {
		var f = function() {};
		f.prototype = s.prototype;
		c.superClass = s;
		c.prototype = new f();
	}
})();
//import namespace

//以旧换新Tab

$.suning.exchangeTab = (function (){
		return function (tabs,datas){
			this.tabs = tabs;
			this.datas = datas;
		}
	})();
$.suning.exchangeTab.prototype = {
	init: function (){
		this.loc = 0;
		var that = this;
		this.tabs.each(function(i){
			$(this).click(function (e){
				if(i == that.loc){return;}
				that.change(i);
				e.preventDefault();
			});
		});
	},
	change: function (i){
		var data= this.datas.eq(i);
		data.show();
		this.datas.eq(this.loc).hide();
		this.tabs[i].className = 'on';
		this.tabs[this.loc].className = '';
		this.loc = i;
	}
}


//回收查询
$.suning.recycle = (function (){
	return function (trs){
		this.trs = trs;
	}
})();
$.suning.recycle.prototype = {
	init: function(){
		var that = this;
		this.trs.each(function (i){
			$(this).mouseover(function(){
				if(i > 0){that.trs.eq(i).find('td').css('background','#E8F4FC');}

			}).mouseout(function(){
				if(i > 0){that.trs.eq(i).find('td').css('background','#fff');}
			});
		});
	}
}


$(document).ready(function(){
	//以旧换新TAB
	new $.suning.exchangeTab($("#exchange_tab li a"),$("#datas > div")).init();

	//日历
	$('#starttime').datePicker({clickInput:true,displayClose:true,createButton:false});
	$('#endtime').datePicker({clickInput:true,displayClose:true,createButton:false});

	//回收查询
	new $.suning.recycle($('#tables tr')).init();
});
