
function js_addBBCode(id,startTag,endTag) {
	var obj=document.getElementById(id);
	
	obj.value += startTag + endTag;
	
	return false;
	
}


function js_showhide_id(obj){
	obj = document.getElementById(obj);
	
	if (obj.style.display == "block") {
		obj.style.display="none";
	} else {
		obj.style.display="block";
	}
} // end

function js_showhide_class(theClass) {

	var allPageTags = new Array(); 

	//Populate the array with all the page tags
	var allPageTags=document.getElementsByTagName("*");

	//Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++) {

		//Pick out the tags with our class name
		if (allPageTags[i].className==theClass) {
			if (allPageTags[i].style.display == 'none') {
				allPageTags[i].style.display='block';
			} else {
				allPageTags[i].style.display='none';
			} // end else/if
		} // end if
	} // end for
} // end fun
 

/*
// Surrounds the selected text with text1 and text2.
function js_surroundtext(obj_id, text1, text2)
{
	textarea = document.getElementById(obj_id);

	// Can a text range be created?
	if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
	{
		var caretPos = textarea.caretPos;
		var temp_length = caretPos.text.length;

		if (caretPos.text.charAt(caretPos.text.length - 1) == ' ') { 
			caretPos.text = text1 + caretPos.text + text2 + ' ';
		} else {
			caretPos.text = text1 + caretPos.text + text2;
		} // end

		if (temp_length == 0)
		{
			caretPos.moveStart("character", -text2.length);
			caretPos.moveEnd("character", -text2.length);
			caretPos.select();
		}
		else
			textarea.focus(caretPos);
	}
	// Mozilla text range wrap.
	else if (typeof(textarea.selectionStart) != "undefined")
	{
		var begin = textarea.value.substr(0, textarea.selectionStart);
		var selection = textarea.value.substr(textarea.selectionStart, textarea.selectionEnd - textarea.selectionStart);
		var end = textarea.value.substr(textarea.selectionEnd);
		var newCursorPos = textarea.selectionStart;
		var scrollPos = textarea.scrollTop;

		textarea.value = begin + text1 + selection + text2 + end;

		if (textarea.setSelectionRange)
		{
			if (selection.length == 0)
				textarea.setSelectionRange(newCursorPos + text1.length, newCursorPos + text1.length);
			else
				textarea.setSelectionRange(newCursorPos, newCursorPos + text1.length + selection.length + text2.length);
			textarea.focus();
		}
		textarea.scrollTop = scrollPos;
	}
	// Just put them on the end, then.
	else
	{
		textarea.value += text1 + text2;
		textarea.focus(textarea.value.length - 1);
	}
} // end fun

*/