############################################################## 
## MOD Title:          BBCodes & smilies enhancement
## MOD Author:         -=ET=- < N/A > (N/A) http://www.golfexpert.net/phpbb
## MOD Description:    This MOD lets you insert BBCodes & smilies
##                     where you want, select 2 times the same font
##                     size, it provides a useful interface for urls,
##                     keeps your animated smilies animated, and so on...
## MOD Version:        1.2.3
## 
## Installation Level: Intermediate
## Installation Time:  15 Minutes (1mn by EasyMOD)
## Files To Edit:
##      posting.php
##      privmsg.php
##      admin/admin_users.php
##      includes/bbcode.php
##      language/lang_english/lang_main.php
##      templates/subSilver/bbcode.tpl
##      templates/subSilver/posting_body.tpl
##      templates/subSilver/posting_smilies.tpl
## Included Files:     N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes: 
## 
## 1. Copyright and special thanks!
## -----------
## This MOD try to fully fix and enhance the BBCodes and smilies
## use. With this aim, I have included in the MOD 3 features
## and 2 improvements which are not from me:
## - Keep-Em-Moving 1.0.1
##   copyright (C) Bummer (http://forums.webxtractions.com)
##   Original MOD: http://forums.webxtractions.com/viewtopic.php?t=327
##
## - The instructions/code for the new [email] features
##   copyright (C) xanthor (http://www.druides.tk)
##   Original MOD: removed from www.phpbb-fr.com :-(
##
## - Caret Bug fix 1.0.1
##   copyright (C) TerraFrost (http://www.frostjedi.com)
##   Original MOD: http://www.phpbb.com/phpBB/viewtopic.php?t=221270
##
## - Fix "posting screen jumps up to the top" & initInsertions()
##   implementation improvement
##   copyright (C) markus_petrux (http://www.phpmix-portal.org)
##   Original code: http://www.phpbb.com/phpBB/viewtopic.php?p=1647998#1647998
##
## I would like to thank them for the agreement they give me
## to include their code in my MOD :-)
##
## 2. Feature list & browser compatibility
## -----------
## This MOD lets you: 
## - insert BBCodes where you want in the middle of your text
##   without selecting it, 
## - insert smilies where you want in the middle of your text
##   with Mozilla/Firefox (it's only possible with IE on phpBB 2.0.6),
## - select 2 times the same font size, 
## - it provides a useful interface for urls,
## - keeps your animated smilies animated after clicking on them,
## - switch the font color list background color to one of
##   the two of the posts background colors ({T_TD_COLOR1} to
##   {T_TR_COLOR1}) to show the future real colors.
## - add 4 new [email] BBCode possibilities...
##   [email=name@domain.tld]link_name[/email]
##   [email=name@domain.tld?subject]link_name[/email]
##   [email=name@domain.tld+cc@domain.tld]link_name[/email]
##   [email=name@domain.tld+cc@domain.tld?subject]link_name[/email]
## - fix a phpBB issue when signatures are viewed in the ACP >
##   User Admin > Management. The BBCodes [code] & [list] are
##   not displayed correctly and if you submit the profile you
##   will corrupt these BBCodes
## - fix a phpBB issue when in the ACP > User Admin > Management
##   the signature lenght size control failed. The BBcode are
##   displayed with there UID
## - and fix an issue on IE when you highlight some text, then clic
##   on the highlighted text and want to add a BBCode or smilie
##
## The whole features works with IE, Mozilla & Firefox.
##
## With Opera, only 8 features on 10 works: you still can't
## insert BBCodes or smilies where you want as Opera doesn't
## support any JS function which may allow this feature.
##
## Other browsers have not been tested.
##
## 3. EasyMOD
## -----------
## This MOD is compatible with EasyMOD and can be installed
## by it but is not yet certified EMC (EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## Warning 1! At the minimum, you need EasyMOD beta 1 (0.2.1a) or
## more recent to install this MOD by EM!
##
## Warning 2! At the present time, EM is not able to install
## automatically other languages than English.
## This gap will be solved in future releases but in the meantime,
## if you need to install any other language than English provides
## with this MOD, please proceed manually (cf. comments in
## the DIY action).
##
## 4. Compatibility
## -----------
## - This MOD is phpBB 2.0.18 compliant
## - This MOD is NOT compliant with these MODs as it includes them:
##     . Keep-Em-Moving from Bummer
##     . Caret Bug fix from TerraFrost
##
## 5. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://www.golfexpert.net/phpBB
##
############################################################## 
## MOD History: 
## 
##   2005-12-25 - Version 1.2.3
##      - Adapt a FIND instruction to the phpBB 2.0.18 code
##        No updgrade needed for the previous version!
##
##   2005-07-14 - Version 1.2.2
##      - Fix the posting screen jumps up to the top if you
##        insert a smilie in a long post. Thanks markus_petrux!
##      - Better implementation of initInsertions().
##        Thanks markus_petrux!
##
##   2005-06-04 - Version 1.2.1
##      - Fix a phpBB issue when in the ACP > User Admin >
##        Management the signature lenght size control failed.
##        The BBcode are displayed with there UID
##
##   2005-05-26 - Version 1.2.0
##      - Insert BBCodes and smilies at the right position
##        on IE even after having highlighted some text
##        This part of the instructions/code is NOT from me!
##        It's copyright TerraFrost (http://www.frostjedi.com)
##      - Fix an issue on Mozilla/Firefox when the insert point
##        is at the beguining of the textarea - thanks djfeat!
##      - Fix prompt box messages not displayed when using the
##        [url] wizard for PMs
##      - Make the Cancel buttons for the [url] wizard works
##      - Add the possibility not to type an url title
##
##   2004-03-09 - Version 1.1.0
##      - Add [email] enhancement
##        This part of the instructions/code is NOT from me!
##        It's copyright xanthor (http://www.druides.tk)
##      - Fix an issue with 'code' & 'list' in admin_users.php
##      - Fix font color list background color with Opera
##
##   2004-02-25 - Version 1.0.0
##      - Add support for inserting Smilies where you want
##        with Mozilla/Firefox in posting_smilies.tpl
##      - Include the Keep-Em-Moving 1.0.1 MOD from Bummer
##        which keeps your animated smilies animated after
##        clicking on them.
##        This part of the instructions/code is NOT from me!
##        It's copyright Bummer (http://forums.webxtractions.com)
##
##   2004-02-22 - Version 1.0.0 Release Candidate 2
##      - Change the MOD name from "BBCodes use enhancement"
##        to "BBCodes & smilies enhancement"
##      - Add Mozilla/Firefox support for inserting BBCodes where
##        you want without selecting some text
##      - Add Mozilla/Firefox support for inserting Smilies where you
##        want in the middle of your text
##      - Switch the font color list background color to one of
##        the 2 of the posts background colors ({T_TD_COLOR1}
##        to {T_TR_COLOR1}) to show the future real colors
##      - Minor language entries enhancement
##
##   2004-02-22 - Version 1.0.0 Release Candidate 1
##      - Initial release
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ OPEN ]------------------------------------------------ 
#
posting.php

# 
#-----[ FIND ]------------------------------------------------ 
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],
#
'L_BBCODE_W_HELP' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - BBCodes & smilies enhancement MOD
'L_BBCODE_URL' => $lang['bbcode_url'],
'L_BBCODE_URL_TITLE' => $lang['bbcode_url_title'],
'L_BBCODE_URL_EMPTY' => $lang['bbcode_url_empty'],
'L_BBCODE_URL_ERRORS' => $lang['bbcode_url_errors'],
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ OPEN ]------------------------------------------------ 
#
privmsg.php

# 
#-----[ FIND ]------------------------------------------------ 
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],
#
'L_BBCODE_W_HELP' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - BBCodes & smilies enhancement MOD
'L_BBCODE_URL' => $lang['bbcode_url'],
'L_BBCODE_URL_TITLE' => $lang['bbcode_url_title'],
'L_BBCODE_URL_EMPTY' => $lang['bbcode_url_empty'],
'L_BBCODE_URL_ERRORS' => $lang['bbcode_url_errors'],
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ OPEN ]------------------------------------------------ 
#
admin/admin_users.php

# 
#-----[ FIND ]------------------------------------------------ 
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
// Only create a new bbcode_uid when there was no uid yet.
if ( $signature_bbcode_uid == '' )
{
	$signature_bbcode_uid =
}
$signature = prepare_message(

if ( strlen($sig_length_check) >
{
	$error = TRUE;
	$error_msg .=  (
}

# 
#-----[ REPLACE WITH ]----------------------------------------
#

// Start replacement - BBCodes & smilies enhancement MOD
			if ( strlen($sig_length_check) > $board_config['max_sig_chars'] )
			{ 
				$error = TRUE;
				$error_msg .=  ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
			} else
			{
				// Only create a new bbcode_uid when there was no uid yet.
				if ( $signature_bbcode_uid == '' )
				{
					$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
				}

				$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
			}
// End replacement - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# $signature = ($this_userdata['user_sig_bbcode_uid'] != '') ? preg_replace('#:' . $this_userdata['user_sig_bbcode_uid'] . '#si', '', $this_userdata['user_sig']) : $this_userdata['user_sig'];
#
$signature = ($this_userdata['user_sig_bbcode_uid'] != '')

# 
#-----[ REPLACE WITH ]----------------------------------------
#

// Start replacement - BBCodes & smilies enhancement MOD
$signature_bbcode_uid = $this_userdata['user_sig_bbcode_uid'];
$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $this_userdata['user_sig']) : $this_userdata['user_sig'];
// End replacement - BBCodes & smilies enhancement MOD

# 
#-----[ OPEN ]------------------------------------------------ 
#
includes/bbcode.php

# 
#-----[ FIND ]------------------------------------------------ 
#
$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# This instruction and this code is copyright (C) xanthor
#

// Start add - BBCodes & smilies enhancement MOD
	$bbcode_tpl['email4'] = str_replace('{CC}', '\\2', $bbcode_tpl['email']); 
	$bbcode_tpl['email4'] = str_replace('{SUJET}', '\\3', $bbcode_tpl['email4']); 
	$bbcode_tpl['email4'] = str_replace('{DESCRIPTION}', '\\4', $bbcode_tpl['email4']); 
	$bbcode_tpl['email3'] = str_replace('{CC}', '\\2', $bbcode_tpl['email']); 
	$bbcode_tpl['email'] = str_replace('{CC}', '', $bbcode_tpl['email']); 
	$bbcode_tpl['email2'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['email']); 
	$bbcode_tpl['email3'] = str_replace('{SUJET}', '', $bbcode_tpl['email3']); 
	$bbcode_tpl['email3'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['email3']); 
	$bbcode_tpl['email2'] = str_replace('{SUJET}', '\\2', $bbcode_tpl['email2']); 
	$bbcode_tpl['email'] = str_replace('{SUJET}', '', $bbcode_tpl['email']); 
	$bbcode_tpl['email1'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['email']); 
	$bbcode_tpl['email'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['email']);
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
$replacements[] = $bbcode_tpl['email'];

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# This instruction and this code is copyright (C) xanthor
#

// Start add - BBCodes & smilies enhancement MOD
	// [email=nom@domain.tld]desc[/email] code.. 
	$patterns[] = "#\[email=([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)\](.*?)\[/email\]#si"; 
	$replacements[] = $bbcode_tpl['email1']; 

	// [email=nom@domain.tld?subject]desc[/email] code.. 
	$patterns[] = "#\[email=([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)\?(.[^/]+)\](.*?)\[/email\]#si"; 
	$replacements[] = $bbcode_tpl['email2']; 

	// [email=nom@domain.tld+cc@domain.tld]desc[/email] code.. 
	$patterns[] = "#\[email=([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)\+([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)\](.*?)\[/email\]#si"; 
	$replacements[] = $bbcode_tpl['email3']; 

	// [email=nom@domain.tld+cc@domain.tld?subject]desc[/email] code.. 
	$patterns[] = "#\[email=([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)\+([a-z0-9&\-_.]+?@[\w\-]+\.(?:[\w\-\.]+\.)?[\w]+)\?(.[^/]+)\](.*?)\[/email\]#si"; 
	$replacements[] = $bbcode_tpl['email4'];
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ OPEN ]------------------------------------------------ 
#
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------------ 
#
?>

# 
#-----[ BEFORE, ADD ]-----------------------------------------
#

// Start add - BBCodes & smilies enhancement MOD
$lang['bbcode_url'] = 'Enter the URL (eg. http://www.phpbb.com)';
$lang['bbcode_url_title'] = 'Enter the title of the link';
$lang['bbcode_url_empty'] = 'You didn\'t enter any url';
$lang['bbcode_url_errors'] = 'Error!';
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ OPEN ]------------------------------------------------ 
#
templates/subSilver/bbcode.tpl

# 
#-----[ FIND ]------------------------------------------------
#
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</a><!-- END email -->

# 
#-----[ REPLACE WITH ]----------------------------------------
#
# This instruction and this code is copyright (C) xanthor
#
<!-- BEGIN email --><a href="mailto:{EMAIL}?subject={SUJET}&cc={CC}">{DESCRIPTION}</a><!-- END email -->

# 
#-----[ OPEN ]------------------------------------------------ 
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
// Shows the help messages in the helpline window

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
# This instruction and this code is copyright (C) TerraFrost
# & and markus_petrux
#

// Start add - BBCodes & smilies enhancement MOD
var baseHeight;
function initInsertions() {
	if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
#
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == 
txtarea.focus();

# 
#-----[ BEFORE, ADD ]------------------------------------------
#
# The baseHeight test is copyright (C) TerraFrost
# http://www.frostjedi.com
#

// Start add - BBCodes & smilies enhancement MOD
		if (baseHeight != txtarea.caretPos.boundingHeight) {
			txtarea.focus();
			storeCaret(txtarea);
		}
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ AFTER, ADD ]------------------------------------------
#

// Start add - BBCodes & smilies enhancement MOD
	} else
	if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
	{ 
		mozInsert(txtarea, text, "");
		return;
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
if (!theSelection) {

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# The baseHeight test is copyright (C) TerraFrost
# http://www.frostjedi.com
#

// Start add - BBCodes & smilies enhancement MOD
			if (txtarea.createTextRange && txtarea.caretPos) {
				if (baseHeight != txtarea.caretPos.boundingHeight) {
					txtarea.focus();
					storeCaret(txtarea);
				}
				var caretPos = txtarea.caretPos;
				var text = bbopen + bbclose;
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
			} else
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbopen, bbclose);

# 
#-----[ REPLACE WITH ]----------------------------------------
#

// Start replacement - BBCodes & smilies enhancement MOD
	else if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
	{
		mozInsert(txtarea, bbopen, bbclose);
// End replacement - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# The baseHeight test is copyright (C) TerraFrost
# http://www.frostjedi.com
#

// Start add - BBCodes & smilies enhancement MOD
			if (txtarea.createTextRange && txtarea.caretPos) {
				if (baseHeight != txtarea.caretPos.boundingHeight) {
					txtarea.focus();
					storeCaret(txtarea);
				}
				var caretPos = txtarea.caretPos;
				var text = bbtags[butnumber + 1];
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
			} else
			if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
			{ 
				mozInsert(txtarea, bbtags[butnumber + 1], "");
			} else
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);

# 
#-----[ IN-LINE FIND ]----------------------------------------
#
mozWrap

# 
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
mozInsert

# 
#-----[ FIND ]------------------------------------------------ 
#
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# The baseHeight test is copyright (C) TerraFrost
# http://www.frostjedi.com
#

// Start add - BBCodes & smilies enhancement MOD
				if (txtarea.createTextRange && txtarea.caretPos) {
					if (baseHeight != txtarea.caretPos.boundingHeight) {
						txtarea.focus();
						storeCaret(txtarea);
					}
					var caretPos = txtarea.caretPos;
					var text = bbtags[butnumber + 1];
					caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
				} else
				if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
				{ 
					mozInsert(txtarea, bbtags[butnumber + 1], "");
				} else
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# The baseHeight test is copyright (C) TerraFrost
# http://www.frostjedi.com
#

// Start add - BBCodes & smilies enhancement MOD
			if (txtarea.createTextRange && txtarea.caretPos) {
				if (baseHeight != txtarea.caretPos.boundingHeight) {
					txtarea.focus();
					storeCaret(txtarea);
				}
				var caretPos = txtarea.caretPos;
				var text = bbtags[15];
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
			} else
			if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
			{ 
				mozInsert(txtarea, bbtags[15], "");
			} else
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
}
		
// Open tag

# 
#-----[ AFTER, ADD ]------------------------------------------
#
# The baseHeight test is copyright (C) TerraFrost
# http://www.frostjedi.com
#

// Start add - BBCodes & smilies enhancement MOD
		if (bbnumber == 16) {
			var url = prompt("{L_BBCODE_URL}", "http://");

			if (url == null) {
				return;
			} else if (!url) {
				alert("{L_BBCODE_URL_ERRORS}" + "\n" + "\n" + "{L_BBCODE_URL_EMPTY}");
				return;
			} else {
				var title = prompt("{L_BBCODE_URL_TITLE}", "");

				if (title == null) {
					return;
				} else if (!title) {
					var text = "[url]" + url + "[/url]";
				} else {
					var text = "[url=" + url + "]" + title + "[/url]";
				}
			}

			if (txtarea.createTextRange && txtarea.caretPos) {
				if (baseHeight != txtarea.caretPos.boundingHeight) {
					txtarea.focus();
					storeCaret(txtarea);
				}
				var caretPos = txtarea.caretPos;
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
			} else
			if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
			{ 
				mozInsert(txtarea, text, "");
			} else txtarea.value += text;
		} else {
			var text = bbtags[bbnumber];
			if (txtarea.createTextRange && txtarea.caretPos) {
				if (baseHeight != txtarea.caretPos.boundingHeight) {
					txtarea.focus();
					storeCaret(txtarea);
				}
				var caretPos = txtarea.caretPos;
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
			} else
			if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
			{ 
				mozInsert(txtarea, bbtags[bbnumber], "");
			} else
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
eval('document.post.addbbcode'+bbnumber+'.value += "*"');

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - BBCodes & smilies enhancement MOD
		}
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
//-->
</script>

# 
#-----[ BEFORE, ADD ]-----------------------------------------
#

// Start add - BBCodes & smilies enhancement MOD
function mozInsert(txtarea, openTag, closeTag)
{
        var scrollTop = ( typeof(txtarea.scrollTop) == 'number' ? txtarea.scrollTop : -1 );

        if (txtarea.selectionEnd > txtarea.value.length) { txtarea.selectionEnd = txtarea.value.length; }

        var startPos = txtarea.selectionStart; 
        var endPos = txtarea.selectionEnd+openTag.length; 

        txtarea.value=txtarea.value.slice(0,startPos)+openTag+txtarea.value.slice(startPos); 
        txtarea.value=txtarea.value.slice(0,endPos)+closeTag+txtarea.value.slice(endPos); 

        txtarea.selectionStart = startPos+openTag.length; 
        txtarea.selectionEnd = endPos; 
        txtarea.focus();

        if( scrollTop >= 0 ) { txtarea.scrollTop = scrollTop; }
}
// End add - BBCodes & smilies enhancement MOD

# 
#-----[ FIND ]------------------------------------------------
# 
<td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td> 

# 
#-----[ REPLACE WITH ]----------------------------------------
#
# This instruction and this code is copyright (C) Bummer
#

<!-- Start replacement - BBCodes & smilies enhancement MOD -->
				  <td><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('{smilies_row.smilies_col.SMILEY_CODE}');" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></td> 
<!-- End replacement - BBCodes & smilies enhancement MOD -->

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# <td><span class="genmed"> &nbsp;{L_FONT_COLOR}:
# 	<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">
#
{L_FONT_COLOR}
<select

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
<select

# 
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
 style="background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# <option style="color:black; background-color: {T_TD_COLOR1}" value="{T_FONTCOLOR1}" class="genmed">{L_COLOR_DEFAULT}</option>
#
"color:black; background-color: {T_TD_COLOR1}" value="{T_FONTCOLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:black; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:{T_FONTCOLOR1}; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:darkred; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:darkred; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:darkred; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:red; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:red; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:red; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:orange; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:orange; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:orange; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:brown; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:brown; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:brown; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:yellow; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:yellow; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:yellow; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:green; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:green; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:green; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:olive; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:olive; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:olive; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:cyan; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:cyan; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:cyan; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:blue; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:blue; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:blue; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:darkblue; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:darkblue; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:darkblue; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:indigo; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:indigo; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:indigo; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:violet; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:violet; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:violet; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:white; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:white; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:white; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
# 
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer
#
"color:black; background-color: {T_TD_COLOR1}" value="black"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
"color:black; background-color: {T_TD_COLOR1}"

# 
#-----[ IN-LINE REPLACE WITH ]-------------------------------- 
#
"color:black; background-color: {T_TR_COLOR1}"

# 
#-----[ FIND ]------------------------------------------------ 
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# </select> &nbsp;{L_FONT_SIZE}:<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
#
{L_FONT_SIZE}

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
'[/size]')

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
;this.selectedIndex=2;

# 
#-----[ FIND ]------------------------------------------------ 
#
# This instruction and this code is copyright (C) markus_petrux
#
# NOTE: this is a search by part(s) of code line(s)!
# The original line(s) to find is(are) longer and must look like this (if no MOD has already modify them):
#
# <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>
#
<textarea name="message"

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
onkeyup="storeCaret(this);"

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
 onfocus="initInsertions();"

# 
#-----[ OPEN ]------------------------------------------------ 
#
templates/subSilver/posting_smilies.tpl

# 
#-----[ FIND ]------------------------------------------------ 
#
function emoticon(text) {
	text = ' ' + text + ' ';
	if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
		var caretPos = opener.document.forms['post'].message.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		opener.document.forms['post'].message.focus();
	} else {
	opener.document.forms['post'].message.value  += text;
	opener.document.forms['post'].message.focus();
	}
}

# 
#-----[ REPLACE WITH ]----------------------------------------
#
#
// emoticon() function removed - BBCodes & smilies enhancement MOD
# 
#-----[ FIND ]------------------------------------------------
# 
<td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>

# 
#-----[ REPLACE WITH ]----------------------------------------
# 
# This instruction and this code is copyright (C) Bummer
# & markus_petrux
#

<!-- Start replacement - BBCodes & smilies enhancement MOD -->
<td><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" style="cursor:pointer;" onclick="opener.emoticon('{smilies_row.smilies_col.SMILEY_CODE}');" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></td>
<!-- End replacement - BBCodes & smilies enhancement MOD -->

# 
#-----[ DIY INSTRUCTIONS ]------------------------------------
#
Regardless how you've installed this MOD (by EasyMOD or manually), if you want to install other languages than English please use the sub MODs in the /translations/ directory (as for the moment EasyMOD is not able to carry on automatically).

# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM