function addSmile(txt) {
e = document.getElementById("message");
if (e.value == '<Type your message here>') e.value='';
insertText(e," "+txt+" ");
}


function insertText(e,inp) {
e = document.getElementById("message");
	
if (document.selection) {
e.focus();
sel = document.selection.createRange();
e.focus();
sel.text = inp;

sel.moveStart('character',0);
sel.moveEnd('character',0);

sel.select();

}
else {
var startPos = e.selectionStart;
var endPos = e.selectionEnd;
e.value = e.value.substring(0,startPos) + inp + e.value.substring(endPos,e.value.length);
e.selectionStart = startPos + inp.length;
e.selectionEnd = startPos + inp.length;
e.focus();
}
}

function wipeTextArea(e) {
if (e.value == '<Type your message here>') e.value='';
if (e.value == '<Write a little about yourself>') e.value='';
}

function liteon(e) {
e.className = e.className + ' hilite';
}

function liteoff(e) {
e.className = e.className.substring(0,e.className.length-7);
}

function outputImage(w,h,x) {
document.write('<embed src="imgviewer_rq.swf" scale="noscale" salign="tl" quality="high" bgcolor="#000000" width="'+w+'" height="'+h+'" FlashVars="picID='+x+'" name="imgview" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
}

function outputVideo(x,size) {

if ( (size < 1) || (size > 3) ) size = 2;

if (size == 1) document.write('<embed src="movieplayer_ri.swf" width="320" height="280" FlashVars="movie='+x+'&moviewidth=320" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent">');

if (size == 2) document.write('<embed src="movieplayer_ri.swf" width="480" height="416" FlashVars="movie='+x+'&moviewidth=480" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent">');

if (size == 3) document.write('<embed src="movieplayer_ri.swf" width="640" height="560" FlashVars="movie='+x+'&moviewidth=640" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent">');

}

function outputAdvert() {
document.write('<embed src="ad.swf" width="210" height="350" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
}

function outputFreeVideo(x) {
document.write('<embed src="freemovie'+x+'_r2.swf" width="400" height="350" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent">');
}

function updateCharCounter(src,maxlen) {

e = src;
f = document.getElementById(src.id + "_cc");

if ((!e) || (!f)) return;

if (e.value.length >= maxlen) {
e.value = e.value.substring(0,maxlen);
}

f.innerHTML = '<span class="t2">' + src.value.length + '</span> of <span class="t2">' + maxlen + '</span> chars max';

}
