  function getMsg (){
    var pmid = document.edit_metadata.dc_citation_pmid.value;
    var url = '/cgi-bin/pubmed.cgi';
    var pars = 'pmid=' + pmid;
    var myAjax = new Ajax.Request (
               url,
               {
	           method: 'get',
		   parameters: pars,
		   onSuccess : function(httpObj) {
			eval("var res  = "+httpObj.responseText);
			if (res.error) {
			    alert(res.error);
			} else {
			   //set metadata
			   if (res.title) {
			   	document.edit_metadata.dc_title.value = res.title;
			   }
			   if (res.journal) {
			     document.edit_metadata.dc_citation_stitle.value = res.journal;
			   }
			   if (res.vol) {
			     document.edit_metadata.dc_citation_volume.value = res.vol;
			   }
			   if (res.issue) {
			     document.edit_metadata.dc_citation_issue.value = res.issue;
			   }
			   if (res.spage) {
			     document.edit_metadata.dc_citation_spage.value = res.spage;
			   }
			   if (res.epage) {
			     document.edit_metadata.dc_citation_epage.value = res.epage;
			   }
			   if (res.date) {
				if (typeof(res.date) == "number") {
				   document.edit_metadata.dc_date_issued_year.value = res.date;
				} else {
				  var month = {"Jan":"1", "Feb":"2", "Mar":"3", "Apr":"4", "May":"5", "Jun":"6", "Jul":"7", "Aug":"8", "Sep":"9", "Oct":"10", "Nov":"11", "Dec":"12", "":""};

				  if (res.date.length > 6) {
				     document.edit_metadata.dc_date_issued_month.value = month[res.date.substring(5,8)];
				  }

				  if (res.date.length > 9) {
				     document.edit_metadata.dc_date_issued_day.value = res.date.substring(9,11);
				  }
			       document.edit_metadata.dc_date_issued_year.value = res.date.substring(0,4);
			     }
			   }


			 if (res.authors) {
			    var len = res.authors.length;
			    if (res.authors[0]) document.edit_metadata.dc_creator_last_0.value = res.authors[0][0];
			    if (res.authors[0]) document.edit_metadata.dc_creator_first_0.value = res.authors[0][1];
			    if (res.authors[1]) document.edit_metadata.dc_creator_last_1.value = res.authors[1][0];
			    if (res.authors[1]) document.edit_metadata.dc_creator_first_1.value = res.authors[1][1];
			    if (res.authors[2]) document.edit_metadata.dc_creator_last_2.value = res.authors[2][0];
			    if (res.authors[2]) document.edit_metadata.dc_creator_first_2.value = res.authors[2][1];
			    if (res.authors[3]) document.edit_metadata.dc_creator_last_3.value = res.authors[3][0];
			    if (res.authors[3]) document.edit_metadata.dc_creator_first_3.value = res.authors[3][1];
			 }
			}
			$("result_pmid").innerHTML = "";
		   },
		   onFailure : function(httpObj) {
			$("result_pmid").innerHTML = "error";
		   },
               });
    $("result_pmid").innerHTML = "<b>Wait..</b>";
  }

