can someone plz code me this, i cant get it work..

i want to my whois to look like this:

| ale  (
| name: real name
| chan: @#1. @#opped @#channels +#2. +#voiceand #norma
|away: only is he is away
|idle: shows idle time
|stat: only if the targot of whois is ircop
1. If i whois on channel, i want whois to come to the channel
even if im having a query with that who i am whoissing.
2. if someone queries me, i waht whois to come query window
3. whois on double click in query