function addimage(){ 
	var str = prompt("image url, e.g., http://www.retebe.com/images/logo.jpg:","http:\/\/");
	if ((str != null) && (str != "http://")){
		str = trim(str);
		document.form1.content.value+="\n[url="+str+"][img]"+str+"[/img][/url]\n\n";  
	}	
	form1.content.focus();
}
function addimage1(cid){ 
	var str = prompt("Exmample,http://www.ratebe.com/images/logo.jpg:","http:\/\/");
	var content = document.getElementById(cid);
	if ((str != null) && (str != "http://")){
		str = trim(str);
		content.value+="\n[url="+str+"][img]"+str+"[/img][/url]\n\n";  
	}	
	content.focus();
}
function addMedia(){  
	var str = prompt("Exmample: avi, wmv, asf, or mov:","http:\/\/");
	var id = "MediaPlayer"+Math.random()*10;
	if ((str != null) && (str != "http://")){
		str = trim(str);
		form1.content.value+="\n<EMBED id="+id+" style='WIDTH: 350px; HEIGHT: 280px;filter:alpha(opacity=50, finishopacity=80, style=1)gray()' src="+str+" loop=true autostart=true></EMBED>";
	    form1.htmlEnable.value="true";
	}	
	form1.content.focus();
}
function addMedia1(cid){  
	var str = prompt("Exmamples: avi, wmv, asf, or mov:","http:\/\/");
	var content = document.getElementById(cid);
	var id = "MediaPlayer"+Math.random()*10;
	if ((str != null) && (str != "http://")){
		str = trim(str);
		content.value+="\n<EMBED id="+id+" style='WIDTH: 350px; HEIGHT: 280px;filter:alpha(opacity=50, finishopacity=80, style=1)gray()' src="+str+" loop=true autostart=true></EMBED>";
	    document.getElementById("htmlEnable").value="true";
	}	
	content.focus();
}
function addMedia_audio(){  
	var str = prompt("Exmamples: mp3,wma,wmv,avi,asf:","http:\/\/");
	var id = "MediaPlayer"+Math.random()*10;
	if ((str != null) && (str != "http://")){
		str = trim(str);
		form1.content.value+="\n<EMBED id="+id+" style='WIDTH: 350px; HEIGHT: 40px;filter:alpha(opacity=50, finishopacity=80, style=1)gray()' src="+str+" loop=true autostart=true></EMBED>";
	    form1.htmlEnable.value="true";
	}	
	form1.content.focus();
}
function addMedia_audio1(cid){  
	var str = prompt("Exmamples: mp3,wma,wmv,avi,asf","http:\/\/");
	var content = document.getElementById(cid);
	var id = "MediaPlayer"+Math.random()*10;
	if ((str != null) && (str != "http://")){
		str = trim(str);
		content.value+="\n<EMBED id="+id+" style='WIDTH: 350px; HEIGHT: 40px;filter:alpha(opacity=50, finishopacity=80, style=1)gray()' src="+str+" loop=true autostart=true></EMBED>";
	    document.getElementById("htmlEnable").value="true";
	}	
	content.focus();
}
function addFlash(){  
	var str = prompt("Exmamples: Flash swf ","http:\/\/");
	if ((str != null) && (str != "http://")){
		str = trim(str);		
		var width = 480;
		var height = 360;
		form1.content.value+="\n<embed src="+str+" pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width="+width+" height="+height+"></embed>";
	    form1.htmlEnable.value="true";
	}	
	form1.content.focus();
}
function addFlash1(cid){  
	var str = prompt("Flash£¨swf) full url:","http:\/\/");
	var content = document.getElementById(cid);
	if ((str != null) && (str != "http://")){
		str = trim(str);		
		var width = 480;
		var height = 360;
		content.value+="\n<embed src="+str+" pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width="+width+" height="+height+"></embed>";
	    document.getElementById("htmlEnable").value="true";
	}	
	content.focus();
}

function addReal(){  
	var str = prompt("Realplay£¨rm, ra, or ram£©full url:","http:\/\/");
	if ((str != null) && (str != "http://")){
		str = trim(str);
		document.form1.content.value+="\n<OBJECT width=480 height=360 classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA><PARAM NAME='CONTROLS' VALUE='ImageWindow'><PARAM NAME='CONSOLE' VALUE='Clip'><PARAM NAME='AUTOSTART' VALUE='true'><PARAM NAME='src' VALUE='"+str+"'></OBJECT><BR><OBJECT width=480 height=360 classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA><PARAM NAME='CONTROLS' VALUE='ControlPanel,StatusBar'><PARAM NAME='CONSOLE' VALUE='Clip'></OBJECT>";
	    document.form1.htmlEnable.value="true";
	}	
	form1.content.focus();
}
function addReal1(cid){  
	var str = prompt("Realplay£¨rm, ra, or ram£©full url:","http:\/\/");
	var content = document.getElementById(cid);
	if ((str != null) && (str != "http://")){
		str = trim(str);
		content.value+="\n<OBJECT width=480 height=360 classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA><PARAM NAME='CONTROLS' VALUE='ImageWindow'><PARAM NAME='CONSOLE' VALUE='Clip'><PARAM NAME='AUTOSTART' VALUE='true'><PARAM NAME='src' VALUE='"+str+"'></OBJECT><BR><OBJECT width=480 height=360 classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA><PARAM NAME='CONTROLS' VALUE='ControlPanel,StatusBar'><PARAM NAME='CONSOLE' VALUE='Clip'></OBJECT>";
	    document.getElementById("htmlEnable").value="true";
	}	
	content.focus();
}

function addURL(){  
	var str = prompt("url, e.g., http://www.ratebe.com):","http:\/\/");
	if ((str != null) && (str != "http://")){
		var str1 = prompt("text displayed:","");
		if(str1 == "") str1 = "click here";
		form1.content.value+="\n[url="+trim(str)+"]"+trim(str1)+"[/url]\n";  		
	}	
	form1.content.focus();
}
function addURL1(cid){  
	var str = prompt("url, e.g.,http://www.retebe.com:","http:\/\/");
	var content = document.getElementById(cid);
	if ((str != null) && (str != "http://")){
		var str1 = prompt("text displayed:","");
		if(str1 == "") str1 = "click here";
		content.value+="\n[url="+trim(str)+"]"+trim(str1)+"[/url]\n";  		
	}	
	content.focus();
}
function addCoder(){  
	var str = prompt("Enter your source code:","");
	if (str != null){
		str = trim(str);				
		document.form1.content.value+="\n[code]"+str+"[/code]";
	    document.form1.htmlEnable.value="true";
	}	
	document.form1.content.focus();
}
function trim(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
function leftTrim(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	return sString;
}
function rightTrim(sString){
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}