function getcolorpicker(for_col){
var Event = YAHOO.util.Event;
var colorpicker  = for_col;
YAHOO.namespace("colorpicker");
var thisDialog = YAHOO.namespace("colorpicker");
thisDialog = function(){
	var Event=YAHOO.util.Event,
		Dom=YAHOO.util.Dom,
		lang=YAHOO.lang;
	
	var forcolor = 'color_prim';

	function makefor(for_col){
		forcolor = for_col;
		
	}
	
	return {
        init: function(what) {
        	var what = what;
            this.dialog = new YAHOO.widget.Dialog('yui-picker-panel', { 
				width : "500px",
				close: true,
				fixedcenter :true,
				visible : false,
				constraintoviewport : true,
				buttons : [ { text:"Choose", handler:this.handleSubmit, isDefault:true },
							{ text:"Cancel", handler:this.handleCancel } ]
             });
            this.dialog.renderEvent.subscribe(function() {
				if (!this.picker) { //make sure that we haven't already created our Color Picker
					this.picker = new YAHOO.widget.ColorPicker("colourselector", {
						container: this.dialog,
						ids: {
							R: 				"picker-r",
							R_HEX: 			"rhexval",
							G: 				"picker-g",
							G_HEX: 			"ghexval",
							B: 				"picker-b",
							B_HEX: 			"bhexval", 
							H: 				"picker-h",
							S: 				"picker-s", 
							V: 				"picker-v",
							PICKER_BG: 		"picker-bg",
							PICKER_THUMB:	"yui-pickerThumb",
							HUE_BG: 		"picker-hue-bg",
							HUE_THUMB: 		"picker-hue-thumb", 
							HEX: 			"hexvals",
							SWATCH: 		"picker-swatch",
							WEBSAFE_SWATCH: "picker-websafe-swatch",
							CONTROLS: 		"pickerControls",
							RGB_CONTROLS: 	"picker-rgb-controls",
							HSV_CONTROLS: 	"picker-hsv-controls",
							HEX_CONTROLS: 	"picker-hex-controls",
							HEX_SUMMARY: 	"picker-hex-summary",
							CONTROLS_LABEL: "picker-controls-label"	
						},
						images: {
							PICKER_THUMB: "/javascript/yui/colorpicker/assets/picker_thumb.png",
							HUE_THUMB: "/javascript/yui/colorpicker/assets/hue_thumb.png"
						}
					});
					this.picker.on("rgbChange", function(o) {
						return;
					});
  

				}
			});	
			
            this.dialog.validate = function() {
				return true;
            };
            
           this.dialog.callback = { success: this.handleSuccess, thisfailure: this.handleFailure }; 

            this.dialog.render();
            this.dialog.show();
            makefor(what);
		},
		
		//We'll wire this to our Dialog's submit button:
		handleSubmit: function() {
			var hexval = document.getElementById('hexvals').value;
       		//document.getElementById('yui-picker-panel').style.position='relative';
        	if(document.getElementById(forcolor + '_display').style && hexval)
	     	 	document.getElementById(forcolor + '_display').style.backgroundColor = '#' + hexval;
	        if(document.getElementById(forcolor) && hexval)
	        	document.getElementById(forcolor).value='#' + hexval;
	    	submit_contact();
		},
 			
		handleCancel: function() {
			submit_contact();
		},
		
		handleSuccess: function(o) {
			return true;
		},
		
		handleFailure: function(o) {
			return true;
		}
	};
}();
thisDialog.init(for_col);
}

showBtns = function() {
	YAHOO.util.Dom.setStyle("one", "visibility", "");
	YAHOO.util.Dom.setStyle("two", "visibility", "");
	YAHOO.util.Dom.setStyle("three", "visibility", "");
}
