var dateSelector={ySlct:"",mSlct:"", dHdn:"", date:new Date()};
dateSelector.selectorChange = function(evt){
	var simple = this.mSlct.value==-2;
	dojo.attr(this.ySlct,'disabled',simple);

	if (!simple) {
		if(this.ySlct.value==-1 && this.mSlct.value==-1)
			this.dHdn.value = -1
		else{
			
			this.date.setFullYear(this.ySlct.value==-1 ? this.date.getFullYear() :  this.ySlct.value );
			this.date.setMonth(this.mSlct.value==-1 ? this.date.getMonth() : this.mSlct.value);
			
			this.date.setDate(1);
			this.n30Hdn.value=0
			this.dHdn.value = Math.round(this.date.getTime()/1000);
		}
	}else {
		this.date = new Date();
		this.n30Hdn.value=1
		this.dHdn.value=-1
	}

	
	

	
}
dateSelector.init=function(){
	this.ySlct = dojo.byId("year-select");
	this.mSlct = dojo.byId("month-select");
	this.dHdn = dojo.byId("date-hidden");	
	this.n30Hdn = dojo.byId("next-hidden");	
	
	dojo.connect(this.ySlct,"change", this,"selectorChange");
	dojo.connect(this.mSlct,"change", this,"selectorChange");
	
	dateSelector.selectorChange();
	
}

dojo.addOnLoad(function(){
	dateSelector.init();
});
