function reDirect(page){

	//check we got old date

	var dateField = document.getElementById('filterdate');
	myDate = new Date();
	myDate.setTime(Date.parse(dateField.value));
	var fullUrl="";
	//do valid date check here

	//var offset = buildOffSet(myDate);
	var offset = 0; //do i realy need this?
	//alert(offset);
	var splitArray = window.location.href.split('?'); //stop appending
	if(page==null){
		fullUrl = encodeURI(splitArray[0] +'?filter=' + offset +'&dateselected=' + dateField.value +'&utc=' + formatDate(myDate));
		window.location.href= fullUrl;
	}
	//the click is from page nav so add page var as well
	else{
		//alert("page");
		fullUrl = encodeURI(splitArray[0] +'?filter=' + offset +'&dateselected=' + dateField.value +'&utc=' + formatDate(myDate) + '&page=' + page);

		window.location.href= fullUrl;
	}

}

function buildOffSet(myDate){
var today = new Date(); 
var DI = new DateInfo(myDate,today);
var offset = DI.MonthsDiff*-1;
//offset = offset + '&day=' + DI.DaysDiff*-1;
return offset;	

}


function formatDate(myDate){
	var ret = myDate.getUTCFullYear() + '-' + (myDate.getMonth() + 1) + '-' + myDate.getDate();
	//alert("the new date is " + ret);
	return ret;
}