
/**
*
* Function to convert RGB color to hexa color
*
*/
function rgb2hex(rgb) {
    rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
    function hex(x) {
        return ("0" + parseInt(x).toString(16)).slice(-2);
    }
    return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}

/*
* Stan custom jQuery functions
*/
jQuery.fn.extend({
GoTo: function () {
   var x = $(this).offset().top - 100;
   $('html, body').animate({scrollTop: x}, 500);
}});
 
 //----------------------------------------------------------------------------
 
 //TRUE if you want to enable click on pseudo
var enablePseudoClick = true;

$(document).ready(function() {

if (enablePseudoClick) {
/**
* Begin Implement click on a pseudo and append it to quick reply
*/
 $('.postauthor').css('cursor','pointer');
 var textbox = $('textarea[name="message"]');
 
 $('.postauthor').click(function() {
	var color = rgb2hex($(this).css('color'));	
	textbox.val(textbox.val()+'[color='+color+'][b]'+$(this).text()+'[/b][/color] ');
	textbox.GoTo();
   });
/**
* End Implement click on a pseudo and append it to quick reply
*/
}
	
});

