
jQuery.noConflict();
jQuery.extend(DateInput.DEFAULT_OPTS, {
	dateToString: function(date) {
		var month = (date.getMonth() + 1).toString();
		var dom = date.getDate().toString();
		if (month.length == 1) month = "0" + month;
		if (dom.length == 1) dom = "0" + dom;
		return dom + '/' + month + '/' + date.getFullYear();
	}
});

Behaviour.register({
".jq_calendardate input.date":{
	initialize:function(){
		jQuery('#' + this.id).date_input();
		var parentelement = jQuery(".field.calendardate:has(#" + this.id + ")").attr('id');
		var parentelement_popup = jQuery(".field.popupdatetime:has(#" + this.id + ")").attr('id');
		if(parentelement != null){
			jQuery('#' + parentelement + ' .jq_calendardate img').click(function(){
				jQuery('#' + parentelement + ' input.date').focus();
			});
		}else{
			if(parentelement_popup != null){
				jQuery('#' + parentelement_popup + ' .jq_calendardate img').click(function(){
					jQuery('#' + parentelement_popup + ' input.date').focus();
				});
			}
		}
	}
}
});

