##
## $Source: /usr/cvsroot/melati/melati/src/main/java/org/melati/templets/html/org.melati.poem.ReferencePoemType-URI.wm,v $
## $Revision: 1.6 $
##
## Copyright (C) 2000 William Chesters
##
##
## Expecting $object to be a Field
##
## Note that the template inheritance tree is not  backed up for templates specialised with renderinfo. 
##

<!--  \$Source: /usr/cvsroot/melati/melati/src/main/java/org/melati/templets/html/org.melati.poem.ReferencePoemType-URI.wm,v $ -->
$ml.inputAs($object, "org.melati.poem.IndexPoemType")

<span id="selected_field_$ml.rendered($object.Name)_display"></span>

<script language="JavaScript1.2" type="text/javascript">
var select_field_$ml.rendered($object.Name) = document.getElementById("field_$ml.rendered($object.Name)");
display_$ml.rendered($object.Name)(select_field_$ml.rendered($object.Name));
select_field_$(ml.rendered($object.Name)).addEventListener("change",function(){ display_$ml.rendered($object.Name)(this);},false);

function display_$ml.rendered($object.Name)(e){
  var url = e.options[e.selectedIndex].text.trim();
  var displayDiv = document.getElementById("selected_field_$ml.rendered($object.Name)_display");
  var linkText = "<a id='zoomOut_$ml.rendered($object.Name)' " + 
                           "target='ZoomOut_$ml.rendered($object.Name)' " + 
                           "title='Click to view in a new window' " + 
                           "href='" + url +"'>";
  if (url != "") {
    if(url.toLowerCase().lastIndexOf(".jpg") > 1) {
      displayDiv.innerHTML = linkText + 
                             "<img width='60' src='" + url + "' ></a>"; 
    } else { 
      displayDiv.innerHTML = linkText +  
                             "Follow</a>"; 
    }
  }
}

</script>

