    YAHOO.util.Event.onContentReady("button-container", function () {

        function onButtonOption() {

            /*
                Create an empty body element for the Menu instance in order to 
                reserve space to render the ColorPicker instance into.
            */

            oColorPickerMenu.setBody("&#32;");

            oColorPickerMenu.body.id = "color-picker-container";


            // Render the Menu into the Button instance's parent element

            oColorPickerMenu.render(this.get("container"));


            /*
                 Create a new ColorPicker instance, placing it inside the body 
                 element of the Menu instance.
            */

            var oColorPicker = new YAHOO.widget.ColorPicker(oColorPickerMenu.body.id, {
                                    showcontrols: false,
                                    images: {
                                        PICKER_THUMB: "/yui/build/colorpicker/assets/picker_thumb.png",
                                        HUE_THUMB: "/yui/build/colorpicker/assets/hue_thumb.png"
                                    }
                                });


            // Align the Menu to its Button

            oColorPickerMenu.align();


            /*
                Add a listener for the ColorPicker instance's "rgbChange" event
                to update the background color and text of the Button's 
                label to reflect the change in the value of the ColorPicker.
            */

            oColorPicker.on("rgbChange", function (p_oEvent) {

                var sColor = "#" + this.get("hex");     
       			YAHOO.util.Dom.setStyle("current-color", "backgroundColor", sColor);
                YAHOO.util.Dom.setStyle("titletext", "color", sColor);
                YAHOO.util.Dom.get("current-color").innerHTML = "Current color is " + sColor;
				document.getElementById('titlecolor').value=sColor;                
            });
            

            // Remove this event listener so that this code runs only once

            this.unsubscribe("option", onButtonOption);
        
        }


        // Create a Menu instance to house the ColorPicker instance

        var oColorPickerMenu = new YAHOO.widget.Menu("color-picker-menu");


        // Create a Button instance of type "split"

        var oButton = new YAHOO.widget.Button({ 
                                            type: "split", 
                                            id: "color-picker-button", 
                                            label: "<em id=\"current-color\">Current color is #FFFFFF.</em>", 
                                            menu: oColorPickerMenu, 
                                            container: this });
        
        
        /*
            Add a listener for the "option" event.  This listener will be
            used to defer the creation the ColorPicker instance until the 
            first time the Button's Menu instance is requested to be displayed
            by the user.
        */
        
        oButton.on("option", onButtonOption);
    
    });
    
    <!-- ------------------------------------------------------------------------------------------>
    <!-- ------------------------------------------------------------------------------------------>
    <!-- ------------------------------------------------------------------------------------------>
    <!-- ------------------------------------------------------------------------------------------>

    YAHOO.util.Event.onContentReady("button-container2", function () {

        function onButtonOption2() {

            /*
                Create an empty body element for the Menu instance in order to 
                reserve space to render the ColorPicker instance into.
            */

            oColorPickerMenu2.setBody("&#32;");
            oColorPickerMenu2.body.id = "color-picker-container2";


            // Render the Menu into the Button instance's parent element

            oColorPickerMenu2.render(this.get("container"));


            /*
                 Create a new ColorPicker instance, placing it inside the body 
                 element of the Menu instance.
            */

            var oColorPicker2 = new YAHOO.widget.ColorPicker(oColorPickerMenu2.body.id, {
                                    showcontrols: false,
                                    images: {
                                        PICKER_THUMB: "/yui/build/colorpicker/assets/picker_thumb.png",
                                        HUE_THUMB: "/yui/build/colorpicker/assets/hue_thumb.png"
                                    }
                                });


            // Align the Menu to its Button

            oColorPickerMenu2.align();


            /*
                Add a listener for the ColorPicker instance's "rgbChange" event
                to update the background color and text of the Button's 
                label to reflect the change in the value of the ColorPicker.
            */

            oColorPicker2.on("rgbChange", function (p_oEvent) {

                var sColor = "#" + this.get("hex");     
                YAHOO.util.Dom.setStyle("current-color2", "backgroundColor", sColor);
       			YAHOO.util.Dom.setStyle("lines", "color", sColor);
       			YAHOO.util.Dom.get("current-color2").innerHTML = "Current color is " + sColor;
				document.getElementById('motitextcolor').value=sColor;
				      
            });
            

            // Remove this event listener so that this code runs only once

            this.unsubscribe("option", onButtonOption2);
        
        }
<!-- ----------------------------------------------- -->

        // Create a Menu instance to house the ColorPicker instance

        var oColorPickerMenu2 = new YAHOO.widget.Menu("color-picker-menu2");


        // Create a Button instance of type "split"

        var oButton2 = new YAHOO.widget.Button({ 
                                            type: "split", 
                                            id: "color-picker-button2", 
                                            label: "<em id=\"current-color2\">Current color is #FFFFFF.</em>", 
                                            menu: oColorPickerMenu2, 
                                            container: this });
        
        
        /*
            Add a listener for the "option" event.  This listener will be
            used to defer the creation the ColorPicker instance until the 
            first time the Button's Menu instance is requested to be displayed
            by the user.
        */
        
        oButton2.on("option", onButtonOption2);
    
    });
