var path = "http://cfo.geol.iastate.edu:8080/";

function Hello(){

//var wd_onsubmit = document.form2.onsubmit;
document.forms["form2"].onsubmit = busyForm;


}


//A form submit handler. Since it is not allowed to use "<ui:form onsubmit="" >
//so I wrote a handler to handle form submit
function busyForm() {


    var img = document.getElementById('busyImg');
    img.style.display = "block" ;

    var applet = document.getElementById('applet');
    applet.style.display = "none" ;		    
}


/*function showAgeChart() {
  
  var arc_Div = document.getElementById('arcDiv'); 
  
    if (document.images && document["arc_button"].src == path + "gridsphere/html/images/hideshow_infohidden.gif") {
    arc_Div.style.display='block';
    document.form2.hideshow_arc.value="show_arc"; 

   // document["arc_button"].src = "http://portal.chronos.org/gridsphere/html/images/hideshow_infoshown.gif";
    document["arc_button"].src = path + "gridsphere/html/images/hideshow_infoshown.gif";
    document["arc_button"].title = "hide age range chart";
   }
  else if (document.images && document["arc_button"].src == path + "gridsphere/html/images/hideshow_infoshown.gif"){
    hideAgeChart();     

  }
}

function hideAgeChart() {

  var arc_Div = document.getElementById('arcDiv');  
  arc_Div.style.display='none'; 
  document.form2.hideshow_arc.value="hide_arc";  
  
  document["arc_button"].src = path + "gridsphere/html/images/hideshow_infohidden.gif";	
  document["arc_button"].title = "show age range chart";
}

function doWriteToBox(){

      var lst = document.getElementsByTagName("input");
      	    
      html_block = '<table border="1"><tr><td>&nbsp;</td><td>genus</td><td>species</td><td>subspecies</td><td>hole id</td></tr>';
      
      for (var j = 0; j < lst.length; j++){
      
          if (lst.item(j).getAttribute("name")=='HGS' && lst.item(j).getAttribute("type")=="checkbox"){
      
          var sel = " ";
          if (lst.item(j).checked == true){
              sel=" checked" ;
          }
                        
          var value = lst.item(j).getAttribute("value");
          var v_ary = value.split("##");
          var str = v_ary[1] + "/" + v_ary[2];
          if (v_ary[3] != 'null'){
              str += "/" + v_ary[3]
          }
      
          html_block += '<tr><td><input type="checkbox" ' + sel + ' onclick="doWriteToBox();" ' + ' name= "HGS" value="' + lst.item(j).getAttribute("value") + ' " ></td>';
          html_block += '<td>' + v_ary[1]+ '</td>';
          html_block += '<td>' + v_ary[2]+ '</td>';
          html_block += '<td>' + v_ary[3]+ '</td>'
          html_block += '<td>' + v_ary[0] + '</td></tr>';
         }
		
      }
      html_block += '</table>';  
      document.form2.html_block.value=html_block;
      
}*/
