var newtmps = "1";
var tmps = "0";
var nb_id=1;
var iscnn = false;
function scroll(id)
{
    var elmt = document.getElementById(id);
    i=-1;
    while(elmt.scrollTop>i)
    {
        i=elmt.scrollTop;
        elmt.scrollTop+=1000;
    }
    return true;
}
function remplace(data, search, replace)
{
	var temp = data;
	var longueur = search.length;
	while(temp.indexOf(search) > -1)
	{
		pos = temp.indexOf(search);
		temp = (temp.substring(0, pos) + replace + temp.substring((pos + longueur), temp.length));
	}
	return temp;
}
function send_msg(id)
{
	if(!iscnn)
    {
        if(document.getElementById('tchat_'+id+'_pseudo').value != "")
        {
            document.getElementById('formu_233').style.display='block';
            document.getElementById('pseudo_233').style.display='none';
            document.getElementById('pseudo_ifs_233').innerHTML = document.getElementById('tchat_233_pseudo').value;
            iscnn = true;
        }
        else
        {
                alert('Veuillez indiquer votre pseudonyme.');
        }
        return false;
    }
    else
    {
        var pseudo="";var message="";
        if(document.getElementById('tchat_'+id+'_pseudo').value != "")
        {
        	pseudo = escape(document.getElementById('tchat_'+id+'_pseudo').value);
	        pseudo = remplace(pseudo,'+','%2B');
        }
        else
        {
                alert('Veuillez indiquer votre pseudonyme.');
        }
        if(document.getElementById('tchat_'+id+'_message').value != "")
        {
        	message = escape(document.getElementById('tchat_'+id+'_message').value);
	        message = remplace(message,'+','%2B');
        }
        else
        {
                alert('Votre message est vide.');
        }
        var js_effets=document.createElement("script");
        js_effets.setAttribute("type", "text/javascript");
        js_effets.setAttribute("src", "http://services.supportduweb.com/tchat/sendmsg-"+id+".js?pseudo="+pseudo+"&message="+message+"");
        document.getElementsByTagName("script")[0].parentNode.insertBefore(js_effets,document.getElementsByTagName("script")[0]);
        document.getElementById('tchat_'+id+'_message').value="";
		return null;
	}
}
function charge_msg(id,id2)
{
	if(id2==nb_id)
    {
        anc_scl = document.getElementById("tchat_p_aff_233").scrollTop;
        var js_effets=document.createElement("script");
        js_effets.setAttribute("type", "text/javascript");
        js_effets.setAttribute("src", "http://services.supportduweb.com/tchat/msg-"+id+".js?"+(new Date()));
        document.getElementsByTagName("script")[0].parentNode.insertBefore(js_effets,document.getElementsByTagName("script")[0]);
        setTimeout('charge_msg(233,'+id2+');',6000);
	}
}
function insert(d,f,textarea,n)
{
	var input = document.getElementById(textarea);
	var scroll = input.scrollTop;
	input.focus();
	if(n)
	{
		if(typeof document.selection != 'undefined')
		{
			var range = document.selection.createRange();
			range.text = d + f;
			range = document.selection.createRange();
			range.select();
		}
		else if(typeof input.selectionStart != 'undefined')
		{
			var deb = input.selectionStart;
			var fin = input.selectionEnd;
			input.value = input.value.substr(0, deb) + d + f + input.value.substr(fin);
		}
		else
		{
			var pos;
			var re = new RegExp('^[0-9]{0,3}$');
			while(!re.test(pos))
			{
				pos = prompt("insertion (0.." + input.value.length + "):", "0");
			}
			if(pos > input.value.length)
			{
				pos = input.value.length;
			}
			input.value = input.value.substr(0, pos) + d + f + input.value.substr(pos);
		}
	}
	else
	{
		if(typeof document.selection != 'undefined')
		{
			var range = document.selection.createRange();
			var text_sel = range.text;
			range.text = d + text_sel + f;
			range = document.selection.createRange();
			if (text_sel.length == 0)
			{
				range.move('character', -f.length);
			}
			else
			{
				range.moveStart('character', d.length + text_sel.length + f.length);
			}
			range.select();
		}
		else if(typeof input.selectionStart != 'undefined')
		{
			var deb = input.selectionStart;
			var fin = input.selectionEnd;
			var text_sel = input.value.substring(deb,fin);
			input.value = input.value.substr(0, deb) + d + text_sel + f + input.value.substr(fin);
			var pos;
			if (text_sel.length == 0)
			{
				pos = deb + d.length;
			}
			else
			{
				pos = deb + d.length + text_sel.length + f.length;
			}
			input.selectionStart = pos;
			input.selectionEnd = pos;
		}
		else
		{
			var pos;
			var re = new RegExp('^[0-9]{0,3}$');
			while(!re.test(pos))
			{
				pos = prompt("insertion (0.." + input.value.length + "):", "0");
			}
			if(pos > input.value.length)
			{
				pos = input.value.length;
			}
			var insText = prompt("Veuillez taper le texte");
			input.value = input.value.substr(0, pos) + d + text_sel + f + input.value.substr(pos);
		}
	}
	input.scrollTop = scroll;
}
var tchat_index = "<style type=\"text/css\">"
+".contenu_233{"
+"	width:650px;"
+"	height:450px;"
+"	padding:0px;"
+"	margin:auto;"
+"	background:url('http://services.supportduweb.com/tchat/images/bg_1.png');"
+"}"
+".ctn2_233{"
+"	width:610px;"
+"	height:410px;"
+"	padding:20px;"
+"	margin:0px;"
+"	background:url('http://services.supportduweb.com/tchat/images/mot_1.png');"
+"}"
+".send_msg_233{"
+"	padding:0px;"
+"	margin:0px;"
+"}"
+".head_msg_gauche_233{"
+"	float:left;"
+"}"
+".head_msg_droite_233{"
+"	float:right;"
+"}"
+".clean_233{"
+"	clear:both;"
+"}"
+".input_msg_233, .input_msg_233:hover, .input_msg_233:focus"
+"{"
+"	background:white;"
+"	margin:0px;"
+"	border:0px;"
+"	padding:0px;"
+"	width:485px;"
+"	height:30px;"
+"	font-size:16px;"
+"	padding-left:5px;"
+"	border-radius:0px;"
+"	-moz-border-radius:0px;"
+"	-webkit-border-radius:0px;"
+"	border-bottom-left-radius:5px;"
+"	-moz-border-radius-bottomleft:5px;"
+"	-webkit-border-bottom-left-radius:5px;"
+"}"
+".input_pseu_233, .input_pseu_233:hover, .input_pseu_233:focus"
+"{"
+"	background:white;"
+"	margin:0px;"
+"	border:1px solid #dddddd;"
+"	border-radius:3px;"
+"	-moz-border-radius:3px;"
+"	-webkit-border-radius:3px;"
+"}"
+".img_233{"
+"	border:0px;"
+"}"
+".message_ls_233{"
+"	height:330px;"
+"	overflow:auto;"
+"	background:url('http://services.supportduweb.com/tchat/images/ctn.png');"
+"	padding:5px;"
+"	border-radius:10px;"
+"	-moz-border-radius:10px;"
+"	-webkit-border-radius:10px;"
+"	margin-bottom:20px;"
+"}"
+".date_233{"
+"	color:#626262;"
+"	font-size:0.9em;"
+"}"
+".champs_233{"
+"	width:490px;"
+"	float:left;"
+"}"
+".btn_233{"
+"	width:120px;"
+"	height:30px;"
+"	margin-left:490px;"
+"}"
+".emoti_233{"
+"	width:480px;"
+"	height:20px;"
+"	background:url('http://services.supportduweb.com/tchat/images/bg_smileys.png');"
+"	padding:5px;"
+"	border-top-left-radius:5px;"
+"	border-top-right-radius:5px;"
+"	-moz-border-radius-topleft:5px;"
+"	-moz-border-radius-topright:5px;"
+"	-webkit-border-top-left-radius:5px;"
+"	-webkit-border-top-right-radius:5px;"
+"}"
+".emoti_233 img"
+"{"
+"	cursor:pointer;"
+"}"
+".pseudo_233{"
+"	width:610px;"
+"	height:22px;"
+"	text-align:center;"
+"	background:#ffffff;"
+"	border-radius:10px;"
+"	-moz-border-radius:10px;"
+"	-webkit-border-radius:10px;"
+"	padding-top:19px;"
+"	padding-bottom:19px;"
+"}"
+".formu_233{"
+"	display:none;"
+"}"
+".pseudo_ifs_233{"
+"	height:30px;"
+"	overflow:hidden;"
+"	font-weight:bold;"
+"	text-align:center;"
+"}"
+".pseudo_ifs_233 span"
+"{"
+"	background:url('http://services.supportduweb.com/tchat/images/pseudo.png');"
+"}"
+"</style>"
+"	<div class=\"contenu_233\"><div class=\"ctn2_233\">"
+"		<div class=\"message_ls_233\" id=\"tchat_p_aff_233\"></div>"
+"		<script type=\"text/javascript\">"
+"			charge_msg(233,1);"
+"		</script>"
+"			<form onsubmit=\"send_msg(233); return false;\" action=\"index.html\" method=\"post\">"
+"<div class=\"send_msg_233\">"
+"     <div class=\"pseudo_233\" id=\"pseudo_233\">"
+"        <strong><label class=\"label\" for=\"tchat_233_pseudo\">Pseudo</label></strong>: <input class=\"input_pseu_233\" type=\"text\" name=\"pseudo\" id=\"tchat_233_pseudo\" value=\"\" width=\"20\" /> <input type=\"submit\" value=\"Connection\" />"
+"    </div>"
+"	<div class=\"formu_233\" id=\"formu_233\">"
+"        <div class=\"champs_233\">"
+"            <div class=\"emoti_233\">"
+"                <img src=\"http://services.supportduweb.com/images/bbcode/gras.gif\" onclick=\"javascript:insert('[b]','[/b]','tchat_233_message');\" alt=\"Gras\" /> <img src=\"http://services.supportduweb.com/images/bbcode/italique.gif\" alt=\"Italique\" onclick=\"javascript:insert('[i]','[/i]','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-sourire.gif\" alt=\" :D \" onclick=\"javascript:insert(' :D ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-sourire02.gif\" alt=\" :) \" onclick=\"javascript:insert(' :) ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-triste.gif\" alt=\" :( \" onclick=\"javascript:insert(' :( ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-langue.gif\" alt=\" :p \" onclick=\"javascript:insert(' :p ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-ebloui.gif\" alt=\" 8) \" onclick=\"javascript:insert(' 8) ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-un-oeil.gif\" alt=\" o) \" onclick=\"javascript:insert('o)','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-colere.gif\" alt=\" :colere: \" onclick=\"javascript:insert(' :colere: ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-content.gif\" alt=\" :content: \" onclick=\"javascript:insert(' :content: ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-malade.gif\" alt=\" :malade: \" onclick=\"javascript:insert(' :malade: ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-clin.gif\" alt=\" ;) \" onclick=\"javascript:insert(' ;) ','','tchat_233_message');\" /> <img src=\"http://services.supportduweb.com/images/bbcode/emoticone-lunette.gif\" alt=\" :lunette: \" onclick=\"javascript:insert(' :lunette: ','','tchat_233_message');\" /></div>"
+"                <input class=\"input_msg_233\" type=\"text\" name=\"message\" id=\"tchat_233_message\" autocomplete=\"off\" value=\"\" />"
+"        </div>"
+"        <div class=\"btn_233\"><div class=\"pseudo_ifs_233\"><span id=\"pseudo_ifs_233\"></span></div><input type=\"image\" style=\"margin:0px;padding:0px;border:0px;background:none;\" src=\"http://services.supportduweb.com/tchat/images/btn.png\" value=\"Envoyer\" /></div><div class=\"clean_233\"></div>"
+"    </div>"
+"</div>"
+"			</form>"
+"           	</div></div>"
+"";
document.write(tchat_index);