function attachDatePicker(txt, changeMonth, changeYear, numberOfMonths, minDate, showDirection, showButtonPanel, minYear, maxYear)
{
     
           var year = new Date().getFullYear();    
           $$(txt).datepicker({dateFormat: dateFormat, //dayNames: dayArray, 
                        dayNamesMin: dayArrayMin,
	                    dayNamesShort: dayArrayShort, monthNames: monthArray, monthNamesShort: monthArrayShort, 
	                    duration: 'fast', firstDay: 1});	                
	        $$(txt).datepicker('option', 'changeMonth', changeMonth);
	        $$(txt).datepicker('option', 'changeYear', changeYear);
	        $$(txt).datepicker('option', 'yearRange', (year-minYear) + ':' + (year+maxYear));
	        $$(txt).datepicker('option', 'showButtonPanel', showButtonPanel);	    
	        if (closeText != '')
	            $$(txt).datepicker('option', 'closeText', closeText);	        
	        if (currentText != '')
	            $$(txt).datepicker('option', 'currentText', currentText);  	        
	        if (numberOfMonths > 1)
	            $$(txt).datepicker('option', 'numberOfMonths', numberOfMonths); 	    
	        if (minDate != '')
                $$(txt).datepicker('option', 'minDate', minDate);
        
    return $$(txt);
}

function showAttachedDatePicker(txt)
{
    $('#'+txt).datepicker('show');
}

function $$(id)
{
    return $('#' + id);
}