  <script type="text/javascript" src="calendar1.js"></script>
  <script type="text/javascript" src="scripts/tiny_mce/tiny_mce.js">
  </script>
  <script type="text/javascript">
  tinyMCE.init({
	mode : "exact",
	elements: "news_summary, news_text",
	theme: "advanced",    
	plugins : "style,insertdatetime,preview,searchreplace,contextmenu,paste,nonbreaking",
	theme_advanced_buttons1_add : "fontselect,fontsizeselect",
	theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
	theme_advanced_buttons3_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
	theme_advanced_buttons3_add : "styleprops,nonbreaking",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	theme_advanced_disable : "image",
	content_css : "example_full.css",
	plugin_insertdate_dateFormat : "%Y-%m-%d",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	external_link_list_url : "example_link_list.js",
	external_image_list_url : "example_image_list.js",
	file_browser_callback : "fileBrowserCallBack",
	theme_advanced_resize_horizontal : false,
	theme_advanced_resizing : true,
	nonbreaking_force_tab : true,
	apply_source_formatting : true,
	relat2ive_urls : false,
	rem2ove_script_host : false

  });
  function fileBrowserCallBack(field_name, url, type, win) {
	// This is where you insert your custom filebrowser logic
	alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type);
	// Insert new URL, this would normaly be done in a popup
	win.document.forms[0].elements[field_name].value = "someurl.htm";
  }
  </script>

  <br>
  <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
  <form action="controllers/inputController.php" method="post" name="newsform" id="newsform" enctype="multipart/form-data">
  <input name="news_pkey" id="news_pkey" type="hidden" value="<?=$news_data['news_pkey'];?>">
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Date / Time *</td>
  <td valign=top width=610 class=formvalue>
  <input name="news_date" id="news_date" type="text" value="<?=unconverttounixslash($news_data['news_date']);?>" size=12 maxlength=10 onkeypress="dateOnly();">
  <a href="javascript:cal1.popup();"><img src="images/icon/cal.gif" width="16" height="16" border="0" alt="Click to select date"></a>
  &nbsp;&nbsp;<input name="news_time" id="news_time" type="text" value="<?=unconverttounixhhmm($news_data['news_date']);?>" size=8 maxlength=5 onkeypress="timeOnly();">&nbsp;&nbsp;<i>(e.g. 23:00)</i>
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Expiry Date</td>
  <td valign=top width=610 class=formvalue>
  <input name="news_expirydate" id="news_expirydate" type="text" value="<?=unconverttounixslash($news_data['news_expirydate']);?>" size=12 maxlength=10 onkeypress="dateOnly();">
  <a href="javascript:cal2.popup();"><img src="images/icon/cal.gif" width="16" height="16" border="0" alt="Click to select date"></a>
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Title *</td>
  <td valign=top width=610 class=formvalue>
  <input name="news_title" id="news_title" type="text" value="<?=$news_data['news_title'];?>" style="width: 580px;">&nbsp;
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Full Bulletin *</td>
  <td valign=top width=610 class=formvalue>
  <? //$any = editor_printbar("news_text"); ?>
  <!--textarea name="news_text" id="news_text" cols=93 rows=25 onSelect="return storeCaret(this);" onClick="return storeCaret(this);" onKeyup="return storeCaret(this);"><?=$news_data['news_text'];?></textarea-->
  <textarea name="news_text" id="news_text" cols=93 rows=25><?=unescape($news_data['news_text']);?></textarea>
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Related Link</td>
  <td valign=top width=610 class=formvalue>
  <input name="news_relatedurl" type="text" id="news_relatedurl" value="<?=$news_data['news_relatedurl'];?>" style="width: 580px;">
  </td>
  </tr>
  <input name="job" id="job" type="hidden" value="">
  </form>
  </table>

  <script language="javascript">
    var cal1 = new calendar1(document.forms['newsform'].elements['news_date']);
    cal1.year_scroll = true;
    cal1.time_comp = false;
    var cal2 = new calendar1(document.forms['newsform'].elements['news_expirydate']);
    cal2.year_scroll = true;
    cal2.time_comp = false;
  </script>

  <script type="text/javascript">

  function validateForm() {

    var isvalid=true;
    var errmsg="";
    var newsdate=document.getElementById('news_date');
    var newstitle=document.getElementById('news_title');
    //var newstext=document.getElementById('news_text');
    var newstext=tinyMCE.getInstanceById('news_text').getHTML()
    //var newstext=tinyMCE.get('news_text').getContent() 
    if ((newsdate.value=="")||(newstitle.value=="")||(newstext=="")) {
      errmsg='Date, Title and Full Bulletin must be specified!\n';
      isvalid=false;
    }
    if ((newsdate.value!="")&&(!isValidDate(newsdate.value))) {
      errmsg+='Specified Date is not a valid date!\n';
      isvalid=false;
    }
    if (isvalid==false) alert('Error:\n'+errmsg);
    return isvalid;

  }

  </script>
