﻿// JavaScript Document copyright 2008 by Joeri, no copy allowed.

function replaceAll( str, searchvalue, replacevalue ){
//	while (str.indexOf(searchvalue) > 0)
//	{
//		str = str.replace( searchvalue, replacevalue );
//	}
//	return str;
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	str = str.replace( searchvalue, replacevalue );
	return str;
}

var smiletries=0;

function showmethatsmile(){
	smiletries++; if ( smiletries > 10 ) { return; }
	
	try {
   			msgs = document.getElementById("messages_panel_body").innerHTML;
			msgs = replaceAll( msgs , ":)", " <img alt=':-)' src='http://imvu.com/groups/mods/smileys/images/smilie1.gif'>"  );
			msgs = replaceAll( msgs , ";)", " <img alt=';-)' src='http://imvu.com/groups/mods/smileys/images/smilie3.gif'>"  );
			msgs = replaceAll( msgs , ":P", " <img alt=':-P' src='http://imvu.com/groups/mods/smileys/images/smilie5.gif'>"  );
			msgs = replaceAll( msgs , ":D", " <img alt=':-D' src='http://imvu.com/groups/mods/smileys/images/smilie6.gif'>"  );
	
			// Bling
			msgs = replaceAll( msgs , "[con]", " <img alt='CountessOfNaughtyham' src='http://www.joeri67.nl/imvu/smiley/con.gif'>" );
			msgs = replaceAll( msgs , "[k]", " <img alt='Kimi' src='http://userimages05.imvu.com/userdata/18797070/badge_edda29c37da3ed37c6f69a8f99c5883d.gif'>" );
			
			// NameExtra
			msgs = replaceAll( msgs , "Kimi</span><br>", "<img align='absmiddle' alt='Kimi' src='http://userimages05.imvu.com/userdata/18797070/badge_edda29c37da3ed37c6f69a8f99c5883d.gif'> Kimi </span><br>" );
			msgs = replaceAll( msgs , "CountessOfNaughtyham&nbsp;", "<img alt='CountessOfNaughtyham' src='http://www.joeri67.nl/imvu/smiley/con.gif'> CountessOfNaughtyham " );
	
			document.getElementById("messages_panel_body").innerHTML = msgs;
    }
    catch(e) {
        // wait some more
         setTimeout ( "showmethatsmile();", 1000 );
    }
}

setTimeout ( "showmethatsmile();", 3500 ); 
