		<!--
		// Insert Style Tags
		function ins_styles(theform,sb_code,prompt_text,tag_prompt) {
			// Insert [x]yyy[/x] style markup
			
			// Get selected text
			var selected_text = getSelectedText(theform);
			
			if (selected_text == '') {
				// Display prompt if no text is selected
				var inserttext = prompt( 'Enter the text to be formatted:'+"\n["+sb_code+"]xxx[/"+sb_code+"]", '' );
				if ( (inserttext != null) ) {
					insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");
					theform.focus();
				}
			} else {
				// Insert text automatically around selection
				insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");
				theform.focus();
			}
		}
		
		// Insert Style Tags
		function ins_style_dropdown(theform, sb_code) {
			// Insert [sb_code]xxx[/sb_code] style markup
			
			if ( sb_code != '--' ) {
				// Get selected text
				var selected_text = getSelectedText(theform);
			
				if (selected_text == '') {
					prompt_text = '[' + sb_code + ']xxx[/' + sb_code + ']';
					user_input = prompt( prompt_text, '' );
					if ( (user_input != null) ) {
						insertAtCaret(theform, '['+sb_code+']'+user_input+'[/'+sb_code+']');
						theform.focus();
					}
				} else {
					// Insert text automatically around selection
					insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");
					theform.focus();
				}				
			}
		}
		
		// Insert Image Tag
		function ins_image(theform,prompt_text) {
			// Insert [x]yyy[/x] style markup
			inserttext = prompt('Enter the URL for the image:'+"\n[img="+prompt_text+"xxx]",prompt_text);
			if ((inserttext != null) && (inserttext != "")) {
				insertAtCaret(theform, "[img="+inserttext+"]");
			}
			theform.focus();
		}
		
		// Insert Image Tag
		function ins_image_v2(theform) {
			image_url = prompt('Enter the URL for the image:'+'\n[img=http://xxx] or [img=xxx]\n\nOptional:\nwidth=xxx height=xxx popup=true/false float=left/right','http://');
			if ((image_url != null) && (image_url != '')) {
				// Optional
				image_width = prompt('Width (Optional):'+'\n[img=xxx width=xxx]','');
				image_height = prompt('Height (Optional):'+'\n[img=xxx height=xxx]','');
				image_popup = prompt('View full-size in pop-up when clicked (Optional):'+'\n[img=xxx popup=true/false]', '');
				image_float = prompt('Float (Optional):'+'\n[img=xxx float=left/right]','');
				
				str = '[img='+image_url;
				if ((image_width != null) && (image_width != '')) {
					str += ' width='+image_width;
				}
				if ((image_height != null) && (image_height != '')) {
					str += ' height='+image_height;
				}
				if ((image_popup != null) && (image_popup != '')) {
					image_popup.toLowerCase;
					if ( image_popup == 'true' || image_popup == 'false' ) {
						str += ' popup='+image_popup;
					}
				}
				if ((image_float != null) && (image_float != '')) {
					image_float.toLowerCase;
					if ( image_float == 'left' || image_float == 'right' ) {
						str += ' float='+image_float;
					}
				}
				str += ']';
				
				insertAtCaret(theform, str);
				theform.focus();
			
			}
		}
		
		// Insert Image Dropdown Menu
		function ins_image_dropdown(theform,theImage) {
			if (theImage.value != "--") {
				insertAtCaret(theform, theImage.value);
				theform.focus();
			}
		}
		
		// Insert Style Tags
		function ins_styles(theform,sb_code,prompt_text,tag_prompt) {
			// Insert [x]yyy[/x] style markup
			
			// Get selected text
			var selected_text = getSelectedText(theform);
			
			if (selected_text == '') {
				// Display prompt if no text is selected
				var inserttext = prompt( 'Enter the text to be formatted:'+"\n["+sb_code+"]xxx[/"+sb_code+"]", '' );
				if ( (inserttext != null) ) {
					insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");
					theform.focus();
				}
			} else {
				// Insert text automatically around selection
				insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");
				theform.focus();
			}
		}
		
		// Insert URL Tag
		function ins_url(theform) {
		
			// inserts named url link - [url=mylink new=true]text[/url]
			link_url = prompt('Enter the full URL for the link:'+'\n[url=xxx][/url]',"http://");
			if ( (link_url != null) ) {
			
				// Get selected text
				var link_text = getSelectedText(theform);
				if (link_text == '') {
					// Display prompt if no text is selected
					link_text = prompt('Enter the text to be displayed for the link (Optional):'+'\n[url=]xxx[/url]',"");
				}
				if ( (link_text == null) || (link_text == '') ) {
					link_text = link_url;
				}
				link_target = prompt('Open URL in new window (Optional):'+'\n[url= new=true/false][/url]','');
				str = '[url='+link_url;
				if ((link_target != null) && (link_target != '')) {
					link_target.toLowerCase;
					if ( link_target == 'true' || link_target == 'false' ) {
						str += ' new='+link_target;
						
					}
				}
				str += ']'+link_text+'[/url]';
				
				insertAtCaret(theform, str);
				theform.focus();
			}
		}
		
		// Insert URL Tag
		function ins_url_no_options(theform) {
			// inserts named url link - [url=mylink new=true]text[/url]
			link_url = prompt('Enter the full URL for the link:'+'\n[url=xxx][/url]',"http://");
			if ( (link_url != null) ) {
				// Get selected text
				var link_text = getSelectedText(theform);
				if (link_text == '') {
					// Display prompt if no text is selected
					link_text = prompt('Enter the text to be displayed for the link (Optional):'+'\n[url=]xxx[/url]',"");
				}
				if ( (link_text == null) || (link_text == '') ) {
					link_text = link_url;
				}
				str = '[url='+link_url+']'+link_text+'[/url]';
				
				insertAtCaret(theform, str);
				theform.focus();
			}
		}
		
		//Insert Emoticon
		function ins_emoticon(theform, emoticon) {
			insertAtCaret(theform, emoticon);
			theform.focus();
		}
		
		// Validate the Form
		function validate(theform) {
			if (theform.blog_text.value=="" || theform.blog_subject.value=="") {
				alert("Please complete the Name, Comment and Anti-Spam fields.");
				return false;
			} else {
				return true;
			}
		}
		
		// Validate the Form
		function validate_static(theform) {
			if (theform.blog_text.value=="" || theform.blog_subject.value=="" || theform.file_name.value=="" ) {
				alert("Please complete the Name, Comment and Anti-Spam fields.");
				return false;
			} else {
				return true;
			}
		}

	// From:
	// http://parentnode.org/javascript/working-with-the-cursor-position/
	function insertAtCaret(obj, text) {
		if (document.selection && document.selection.createRange) {
			// Internet Explorer 4.0x
			
			obj.focus();
			var orig = obj.value.replace(/\r\n/g, "\n"); // IE Bug
			var range = document.selection.createRange();

			if(range.parentElement() != obj) {
				return false;
			}

			range.text = text;
			
			var actual = tmp = obj.value.replace(/\r\n/g, "\n");

			for(var diff = 0; diff < orig.length; diff++) {
				if(orig.charAt(diff) != actual.charAt(diff)) break;
			}

			for(var index = 0, start = 0; 
				tmp.match(text) 
					&& (tmp = tmp.replace(text, "")) 
					&& index <= diff; 
				index = start + text.length
			) {
				start = actual.indexOf(text, index);
			}
		} else if (obj.selectionStart >= 0) {
			// FireFox & Safari
			var start = obj.selectionStart;
			var end   = obj.selectionEnd;

			obj.value = obj.value.substr(0, start) 
				+ text 
				+ obj.value.substr(end, obj.value.length);
		}
		
		if (start != null) {
			setCaretTo(obj, start + text.length);
		} else {
			obj.value += text;
		}
	}
	
	function getSelectedText(obj) {
		if (document.selection && document.selection.createRange) {
			// Internet Explorer 4.0x
			
			obj.focus();
			var orig = obj.value.replace(/\r\n/g, "\n"); // IE Bug
			var range = document.selection.createRange();
			
			if (range.parentElement() != obj) {
				return '';
			}
			
			txt = range.text;
			
			return txt;
		} else if (obj.selectionStart >= 0) {
			// FireFox & Safari
			var start = obj.selectionStart;
			var end    = obj.selectionEnd;
			var txt    = obj.value.substr(start, end-start);
			
			return txt;
		} else {
			return '';
		}
	}
	
	function setCaretTo(obj, pos) {
		if(obj.createTextRange) {
			var range = obj.createTextRange();
			range.move('character', pos);
			range.select();
		} else if(obj.selectionStart) {
			obj.focus();
			obj.setSelectionRange(pos, pos);
		}
	}
	
	function getSel() {
		var txt = '';
		var foundIn = '';
		if (window.getSelection) {
			// the alternative code
			txt = window.getSelection();
			foundIn = 'window.getSelection()';
		} else if (document.getSelection) {
			// Navigator 4.0x
			txt = document.getSelection();
			foundIn = 'document.getSelection()';
		} else if (document.selection) {
			// Internet Explorer 4.0x
			txt = document.selection.createRange().text;
			foundIn = 'document.selection.createRange()';
		} else {
			return;
		}
		return txt;
	}

		// Validate the Form
		function validate_comment(theform) {
			if ( theform.comment_text.value=="" || theform.comment_name.value=="" || theform.comment_capcha.value=="" ) {
				alert("Please complete the Name, Comment and Anti-Spam fields.");
				return false;
			} else {
				return true;
			}
		}
		-->
