<script type="text/javascript">
<!--

// Insert RSS Feed
function ins_rssfeed_old(theform) {

  // inserts rss feeds - [rss=mylink num=2 desc=100]
  feed_url = prompt('rss source (URL)',"http://");
  if ( (feed_url != null) ) {
    str = '[html]<script language="JavaScript" src="';
    // str += 'http://jade.mcli.dist.maricopa.edu/feed/feed2js.php?';
    str += 'feed2js.php?';
    str += 'src='+feed_url;

    feed_num = prompt('number of news items','');
    if ((feed_num != null) && (feed_num != '')) {
	str += '&amp;num='+feed_num;
    }

    feed_desc = prompt('number of description characters','');
    if ((feed_desc != null) && (feed_desc != '')) {
	str += '&amp;desc='+feed_desc;
    }

    feed_chan = prompt('show channel name [y/n]','y');
    if ((feed_chan != null) && (feed_chan != '')) {
	str += '&amp;chan='+feed_chan;
    }

    feed_dates = prompt('show posting dates [y/n]','y');
    if ((feed_dates != null) && (feed_dates != '')) {
	str += '&amp;date='+feed_dates;
    }

    str += '" type="text/javascript"><';
    str += '/script>[/html]';
    
    theform.value += str;
    theform.focus();
  }
}

// Insert rss Tag
function ins_rssfeed(theform) {

  // inserts rss feeds - [rss=mylink num=2 desc=100]
  feed_url = prompt('rss source (URL)',"http://");
  if ( (feed_url != null) ) {
    str = '[rss=';
    // str += 'http://jade.mcli.dist.maricopa.edu/feed/feed2js.php?';
    str += feed_url;

    feed_num = prompt('number of news items','');
    if ((feed_num != null) && (feed_num != '')) {
	str += ' num='+feed_num;
    }

    feed_desc = prompt('number of description characters','');
    if ((feed_desc != null) && (feed_desc != '')) {
	str += ' desc='+feed_desc;
    }

    feed_chan = prompt('show channel name [y/n]','y');
    if ((feed_chan != null) && (feed_chan != '')) {
	str += ' chan='+feed_chan;
    }

    feed_dates = prompt('show posting dates [y/n]','y');
    if ((feed_dates != null) && (feed_dates != '')) {
	str += ' date='+feed_dates;
    }

    str += ']';
    
    theform.value += str;
    theform.focus();
  }
}



// Insert table start tag
function ins_table(theform) {

  str = '[table';
  val = prompt('Table width','100%');
  if ((val != null) && (val != '')) {
    str += ' width='+val;
  }
  val = prompt('Table border','0');
  if ((val != null) && (val != '')) {
    str += ' border='+val;
  }
  val = prompt('Table cell padding','3');
  if ((val != null) && (val != '')) {
    str += ' padding='+val;
  }
  str += ']';
    
  theform.value += str;
  theform.focus();
}



	// Insert LaTeX equation
	// thanks to ozroc:
	// http://pablogc.freeprohost.com/static.php?page=static050909-214505
	function ins_latex(theform,prompt_text) {
            // insert [x]yyy[/x] style markup
	    inserttext = prompt('<?php echo( LaTeX ); ?>'+"\n",prompt_text);
	    if ((inserttext != null) && (inserttext != "")) {
		theform.value += "[html]<img src=\"<?php global $blog_config;echo $blog_config['blog_mimetex']; ?>?"+inserttext+"\" alt=\""+inserttext+"\"/>[/html] ";
	    }
	    theform.focus();
	}

		// Insert Style Tags
		function ins_styles(theform,sb_code,prompt_text,tag_prompt) {
			// insert [x]yyy[/x] style markup
			inserttext = prompt( '<?php echo( $lang_string[ 'insert_styles' ] ); ?>'+"\n["+sb_code+"]xxx[/"+sb_code+"]", prompt_text);
			if ( (inserttext != null) ) {
				theform.value += " ["+sb_code+"]"+inserttext+"[/"+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 != "--" ) {
				prompt_text = '[' + sb_code + ']xxx[/' + sb_code + ']';
				user_input = prompt( prompt_text, '' );
				if ( (user_input != null) ) {
					theform.value += '['+sb_code+']'+user_input+'[/'+sb_code+']';
					theform.focus();
				}
			}
		}
		
		// Insert Image Tag
		function ins_image(theform,prompt_text) {
			// insert [x]yyy[/x] style markup
			inserttext = prompt('<?php echo( $lang_string[ 'insert_image' ] ); ?>'+"\n[img="+prompt_text+"xxx]",prompt_text);
			if ((inserttext != null) && (inserttext != "")) {
				theform.value += "[img="+inserttext+"] ";
			}
			theform.focus();
		}
		
		// Insert Image Tag
		function ins_image_v2(theform) {
			image_url = prompt('<?php echo( $lang_string[ 'insert_image' ] ); ?>'+'\n[img=http://xxx] or [img=xxx]\n\n<?php echo( $lang_string[ 'insert_image_optional' ] ); ?>\nwidth=xxx height=xxx popup=true/false float=left/right','http://');
			if ((image_url != null) && (image_url != '')) {
				// Optional
				image_width = prompt('<?php echo( $lang_string[ 'insert_image_width' ] ); ?>'+'\n[img=xxx width=xxx]','');
				image_height = prompt('<?php echo( $lang_string[ 'insert_image_height' ] ); ?>'+'\n[img=xxx height=xxx]','');
				image_popup = prompt('<?php echo( $lang_string[ 'insert_image_popup' ] ); ?>'+'\n[img=xxx popup=true/false]', '');
				image_float = prompt('<?php echo( $lang_string[ 'insert_image_float' ] ); ?>'+'\n[img=xxx float=left/right]','');
				image_align = prompt('<?php echo( $lang_string[ 'insert_image_align' ] ); ?>'+'\n[img=xxx align=left/right/center]','');
				image_valign = prompt('<?php echo( $lang_string[ 'insert_image_valign' ] ); ?>'+'\n[img=xxx valign=top/bottom/middle]','');
				image_alt = prompt('<?php echo( $lang_string[ 'insert_image_alt' ] ); ?>'+'\n[img=xxx alt=xxx]','');
				
				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;
					}
				}
				if ((image_align != null) && (image_align != '')) {
					image_align.toLowerCase;
					if ( image_align == 'left' || image_align == 'right' || image_align == 'center' ) {
						str += ' align='+image_align;
					}
				}
				if ((image_valign != null) && (image_valign != '')) {
					image_valign.toLowerCase;
					if ( image_valign == 'top' || image_valign == 'bottom' || image_valign == 'middle' ) {
						str += ' valign='+image_valign;
					}
				}
				if ((image_alt != null) && (image_alt != '')) {
					str += ' alt='+escape(image_alt);
				}

				str += ']';
				
				theform.value += str;
				theform.focus();
			
			}
		}
		
		// Insert Image Dropdown Menu
		function ins_image_dropdown(theform,theImage) {
			if (theImage.value != "--") {
				theform.value += theImage.value;
				theform.focus();
			}
		}
		
		// Insert URL Tag
		function ins_url(theform) {
			// inserts named url link - [url=mylink new=true]text[/url]
			link_url = prompt('<?php echo( $lang_string[ 'insert_url2' ] ); ?>'+'\n[url=xxx][/url]',"http://");
			if ( (link_url != null) ) {
				link_text = prompt('<?php echo( $lang_string[ 'insert_url1' ] ); ?>'+'\n[url=]xxx[/url]',"");
				if ( (link_text == null) || (link_text == '') ) {
					link_text = link_url;
				}
				link_target = prompt('<?php echo( $lang_string[ 'insert_url3' ] ); ?>'+'\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] ';
				
				theform.value += 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('<?php echo( $lang_string[ 'insert_url2' ] ); ?>'+'\n[url=xxx][/url]',"http://");
			if ( (link_url != null) ) {
				link_text = prompt('<?php echo( $lang_string[ 'insert_url1' ] ); ?>'+'\n[url=]xxx[/url]',"");
				if ( (link_text == null) || (link_text == '') ) {
					link_text = link_url;
				}
				str = '[url='+link_url+']'+link_text+'[/url] ';
				
				theform.value += str;
				theform.focus();
			}
		}

		//Insert Emoticon
		function ins_emoticon(theform, emoticon) {
			theform.value += ' ' + emoticon;
			theform.focus();
		}

		//Insert String
		function ins_string(theform, string) {
			theform.value += string;
			theform.focus();
		}
		
		// Validate the Form
		function validate(theform) {
		  //if (theform.blog_text.value=="" || theform.blog_subject.value=="") {
			if (theform.blog_subject.value=="") {
				alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");
				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=="" ) {
			if (theform.blog_subject.value=="" || theform.file_name.value=="" ) {
				alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");
				return false;
			} else {
				return true;
			}
		}
		-->
	</script>
