how to open jquery calender in dialog box on input click with class name


 jQuery(‘#cp_contact_form fieldset .datepicker’).each(function(index) {
                        jQuery(this).bind(‘click’, function(e) {
                            var IdInput = jQuery(this);
                            var dialogId = ‘uniqueName-‘ + Math.floor(Math.random() * 1000);
                            var dialogDiv = “<div id=” + dialogId + “></div>”;
                                jQuery(dialogDiv).dialog({
                                    modal: true,
                                    resizable: false,
                                    title: “Compliance Calender”,
//                                    buttons: {
//                                        “Save”: function () {
//                                            
//                                        },
//                                        “Cancel”: function () { jQuery(this).dialog(‘close’); }
//                                    },
                                    open: function (event, ui) {
                                            jQuery(this).datepicker({
                                                format: ‘mm/dd/yyyy’,
                                                beforeShow: customRange,
                                                firstDay: 1,
                                                changeFirstDay: false,
                                                beforeShowDay: function(dt) {
                                                    return [dt.getDay() == 0 ? false : true];
                                                },
                                                onSelect: function(dateText, inst) {
//                                                    var theDate = new Date(Date.parse(jQuery(this).datepicker(‘getDate’)));
//                                                    var dateFormatted = jQuery.datepicker.formatDate(‘mm/dd/yyyy’, dateText);
                                                    jQuery(IdInput).val(dateText);
                                                }
                                            });
                                    },
                                    close: function (event, ui) {
                                        jQuery(this).datepicker(“destroy”);
                                        jQuery(this).dialog(“destroy”);
                                        jQuery(this).remove();
                                    }
                                });
                            

                        });
                    });