I have a form to add some information . this form is inside PHP for lope so the textbox and textarea takes an array naming .. what I need is a BBcode style button and color contral .. I did it but I have some problems :

1- I can't change the highlighted text color .. also I can't use any button to do this with highlighted text .. I have to pick a color this it will appers in the textarea like this [*color=FFFFFF]text[/color*] (without * ) .. but what I need is the 2 ways:
- change highlighted text color ..... etc .
- put the color tag when I picked it without any text highlighted..

so any one can help me ..

2- I couldn't pass the array varibale to a JS function so I stop using the functions to call ( Bold , I , Image .. etc ) and I use the direct words ( document.form[0].element[0].value= ..... ) somthing like that .. so I need help to pass array varibale between PHP and JS function ..