<script type="text/javascript">

    jQuery = !jQuery ? $ : jQuery;

    jQuery('#colorSelector_{{id}}').ColorPicker({
        onShow: function (colpkr) {
            jQuery(colpkr).fadeIn(500);
            return false;
        },
        onHide: function (colpkr) {
            jQuery(colpkr).fadeOut(500);
            return false;
        },
        onChange: function (hsb, hex, rgb) {
            jQuery('#colorSelector_{{id}} span').css('backgroundColor', '#' + hex);
            jQuery('#colorpicker_{{id}}').val('#' + hex);
        }
    });
</script>                        
