function addimage(){ 
	var str = prompt("For example, http://www.ozstock.com.au/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("For example, http://www.ozstock.com.au):","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("For example: 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("For example: 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("For example: 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("For example: 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("For example: 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("For example: swf:","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("For example: rm, ra, or ram","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("For example: rm, ra, or ram","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("For example, http://www.ozstock.com.au):","http:\/\/");
	if ((str != null) && (str != "http://")){
		var str1 = prompt("Display text:","");
		if(str1 == "") str1 = "Display text";
		form1.des.innerText+="\n[url="+trim(str)+"]"+trim(str1)+"[/url]";  		
	}	
	else 
		form1.des.focus();
}
function addURL1(cid){  
	var str = prompt("For example, http://www.ozstock.com.au):","http:\/\/");
	var content = document.getElementById(cid);
	if ((str != null) && (str != "http://")){
		var str1 = prompt("Display text:","");
		if(str1 == "") str1 = "Display text";
		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;
}